diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 8ee6faa0..4b6c44a1 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -395,7 +395,7 @@ class PlPlayerController { } // 配置Player 音轨、字幕等等 _videoPlayerController = await _createVideoController( - dataSource, _looping, enableHA, width, height); + dataSource, _looping, enableHA, width, height, seekTo); // 获取视频时长 00:00 _duration.value = duration ?? _videoPlayerController!.state.duration; updateDurationSecond(); @@ -426,6 +426,7 @@ class PlPlayerController { bool enableHA, double? width, double? height, + Duration seekTo, ) async { // 每次配置时先移除监听 removeListeners(); @@ -507,8 +508,9 @@ class PlPlayerController { play: false, ); } - player.open( - Media(dataSource.videoSource!, httpHeaders: dataSource.httpHeaders), + await player.open( + Media(dataSource.videoSource!, + httpHeaders: dataSource.httpHeaders, start: seekTo), play: false, ); // 音轨 @@ -530,9 +532,9 @@ class PlPlayerController { // } /// 跳转播放 - if (seekTo != Duration.zero) { - await this.seekTo(seekTo); - } + // if (seekTo != Duration.zero) { + // await this.seekTo(seekTo); + // } /// 自动播放 if (_autoPlay) { diff --git a/pubspec.lock b/pubspec.lock index a64c85c0..46d1e646 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -873,10 +873,11 @@ packages: media_kit: dependency: "direct main" description: - name: media_kit - sha256: "3289062540e3b8b9746e5c50d95bd78a9289826b7227e253dff806d002b9e67a" - url: "https://pub.flutter-io.cn" - source: hosted + path: media_kit + ref: HEAD + resolved-ref: "7775f8b1aa5ec77815d5739bf25549fe37f17cae" + url: "https://github.com/media-kit/media-kit" + source: git version: "1.1.10+1" media_kit_libs_android_video: dependency: transitive @@ -913,10 +914,11 @@ packages: media_kit_libs_video: dependency: "direct main" description: - name: media_kit_libs_video - sha256: "3688e0c31482074578652bf038ce6301a5d21e1eda6b54fc3117ffeb4bdba067" - url: "https://pub.flutter-io.cn" - source: hosted + path: "libs/universal/media_kit_libs_video" + ref: HEAD + resolved-ref: "7775f8b1aa5ec77815d5739bf25549fe37f17cae" + url: "https://github.com/media-kit/media-kit" + source: git version: "1.0.4" media_kit_libs_windows_video: dependency: transitive @@ -937,10 +939,11 @@ packages: media_kit_video: dependency: "direct main" description: - name: media_kit_video - sha256: c048d11a19e379aebbe810647636e3fc6d18374637e2ae12def4ff8a4b99a882 - url: "https://pub.flutter-io.cn" - source: hosted + path: media_kit_video + ref: HEAD + resolved-ref: "7775f8b1aa5ec77815d5739bf25549fe37f17cae" + url: "https://github.com/media-kit/media-kit" + source: git version: "1.2.4" meta: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index 4402b646..06bf50e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -165,6 +165,20 @@ dev_dependencies: hive_generator: ^2.0.0 build_runner: ^2.4.8 +dependency_overrides: + media_kit: + git: + url: https://github.com/media-kit/media-kit + path: media_kit + media_kit_video: + git: + url: https://github.com/media-kit/media-kit + path: media_kit_video + media_kit_libs_video: + git: + url: https://github.com/media-kit/media-kit + path: libs/universal/media_kit_libs_video + flutter_launcher_icons: android: true ios: true