This commit is contained in:
guozhigq
2024-12-09 00:05:43 +08:00
parent 9666ab780a
commit a53429dc10
13 changed files with 92 additions and 107 deletions

View File

@ -366,13 +366,7 @@ class PlPlayerController {
}
// 配置Player 音轨、字幕等等
_videoPlayerController = await _createVideoController(
dataSource,
_looping,
enableHA,
width,
height,
seekTo,
);
dataSource, _looping, enableHA, width, height, seekTo);
// 获取视频时长 00:00
_duration.value = duration ?? _videoPlayerController!.state.duration;
updateDurationSecond();
@ -403,7 +397,7 @@ class PlPlayerController {
bool enableHA,
double? width,
double? height,
Duration? seekTo,
Duration seekTo,
) async {
// 每次配置时先移除监听
removeListeners();
@ -491,12 +485,9 @@ class PlPlayerController {
play: false,
);
}
player.open(
Media(
dataSource.videoSource!,
httpHeaders: dataSource.httpHeaders,
start: seekTo ?? Duration.zero,
),
await player.open(
Media(dataSource.videoSource!,
httpHeaders: dataSource.httpHeaders, start: seekTo),
play: false,
);
// 音轨
@ -536,15 +527,6 @@ class PlPlayerController {
await setPlaybackSpeed(1.0);
}
}
getVideoFit();
// if (_looping) {
// await setLooping(_looping);
// }
// 自动播放
if (_autoPlay) {
await play(duration: duration);
}
}
List<StreamSubscription> subscriptions = [];