diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 908d71ef..9197e3b3 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -1090,6 +1090,11 @@ class VideoDetailController extends GetxController epid: videoType == SearchType.media_bangumi ? epId : null, seasonId: videoType == SearchType.media_bangumi ? seasonId : null, subType: videoType == SearchType.media_bangumi ? subType : null, + callback: () { + if (videoState.value is! Success) { + videoState.value = LoadingState.success(null); + } + }, ); _initSkip(); @@ -1162,7 +1167,6 @@ class VideoDetailController extends GetxController if (autoPlay.value) { isShowCover.value = false; await playerInit(); - videoState.value = LoadingState.success(null); } isQuerying = false; return; @@ -1271,7 +1275,6 @@ class VideoDetailController extends GetxController if (autoPlay.value) { isShowCover.value = false; await playerInit(); - videoState.value = LoadingState.success(null); } } else { autoPlay.value = false; diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 2e871e75..f320d59a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -293,9 +293,8 @@ class _VideoDetailPageState extends State } plPlayerController = videoDetailController.plPlayerController; videoDetailController.isShowCover.value = false; - await videoDetailController.playerInit(autoplay: true); videoDetailController.autoPlay.value = true; - videoDetailController.videoState.value = LoadingState.success(null); + await videoDetailController.playerInit(autoplay: true); plPlayerController!.addStatusLister(playerListener); plPlayerController!.addPositionListener(positionListener); await plPlayerController!.autoEnterFullscreen(); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 76b21d81..a8896c36 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -464,6 +464,7 @@ class PlPlayerController { dynamic epid, dynamic seasonId, dynamic subType, + VoidCallback? callback, }) async { try { this.dataSource = dataSource; @@ -498,6 +499,7 @@ class PlPlayerController { // 配置Player 音轨、字幕等等 _videoPlayerController = await _createVideoController( dataSource, _looping, enableHA, hwdec, width, height); + callback?.call(); // 获取视频时长 00:00 _duration.value = duration ?? _videoPlayerController!.state.duration; _position.value = @@ -601,15 +603,14 @@ class PlPlayerController { await pp.setProperty("blend-subtitles", "video"); } - _videoController = _videoController ?? - VideoController( - player, - configuration: VideoControllerConfiguration( - enableHardwareAcceleration: enableHA, - androidAttachSurfaceAfterVideoParameters: false, - hwdec: enableHA ? hwdec : null, - ), - ); + _videoController ??= VideoController( + player, + configuration: VideoControllerConfiguration( + enableHardwareAcceleration: enableHA, + androidAttachSurfaceAfterVideoParameters: false, + hwdec: enableHA ? hwdec : null, + ), + ); player.setPlaylistMode(looping); if (dataSource.type == DataSourceType.asset) {