fix: 尝试修复记忆播放
This commit is contained in:
@ -437,11 +437,6 @@ class PlPlayerController {
|
|||||||
Future _initializePlayer({
|
Future _initializePlayer({
|
||||||
Duration seekTo = Duration.zero,
|
Duration seekTo = Duration.zero,
|
||||||
}) async {
|
}) async {
|
||||||
// 跳转播放
|
|
||||||
if (seekTo != Duration.zero) {
|
|
||||||
await this.seekTo(seekTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置倍速
|
// 设置倍速
|
||||||
if (_playbackSpeed.value != 1.0) {
|
if (_playbackSpeed.value != 1.0) {
|
||||||
await setPlaybackSpeed(_playbackSpeed.value);
|
await setPlaybackSpeed(_playbackSpeed.value);
|
||||||
@ -453,6 +448,11 @@ class PlPlayerController {
|
|||||||
// await setLooping(_looping);
|
// await setLooping(_looping);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 跳转播放
|
||||||
|
if (seekTo != Duration.zero) {
|
||||||
|
await this.seekTo(seekTo);
|
||||||
|
}
|
||||||
|
|
||||||
// 自动播放
|
// 自动播放
|
||||||
if (_autoPlay) {
|
if (_autoPlay) {
|
||||||
await play();
|
await play();
|
||||||
@ -542,7 +542,6 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
_position.value = position;
|
_position.value = position;
|
||||||
_heartDuration = position.inSeconds;
|
_heartDuration = position.inSeconds;
|
||||||
print('seek duration: $duration');
|
|
||||||
if (duration.value.inSeconds != 0) {
|
if (duration.value.inSeconds != 0) {
|
||||||
if (type != 'slider') {
|
if (type != 'slider') {
|
||||||
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
||||||
@ -561,9 +560,9 @@ class PlPlayerController {
|
|||||||
if (duration.value.inSeconds != 0) {
|
if (duration.value.inSeconds != 0) {
|
||||||
await _videoPlayerController!.stream.buffer.first;
|
await _videoPlayerController!.stream.buffer.first;
|
||||||
await _videoPlayerController?.seek(position);
|
await _videoPlayerController?.seek(position);
|
||||||
if (playerStatus.status.value == PlayerStatus.paused) {
|
// if (playerStatus.status.value == PlayerStatus.paused) {
|
||||||
play();
|
// play();
|
||||||
}
|
// }
|
||||||
t.cancel();
|
t.cancel();
|
||||||
_timerForSeek = null;
|
_timerForSeek = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user