Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

feat(android): mpv 0.41 (#1651)

Predidit0f3416ce8f4e
diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dart
index 71972afa..765d6c0e 100644
--- a/lib/pages/player/player_controller.dart
+++ b/lib/pages/player/player_controller.dart
@@ -314,7 +314,6 @@ abstract class _PlayerController with Store {
),
);
- // 记录播放器内部日志
playerLog.clear();
setupPlayerDebugInfoSubscription();
@@ -350,9 +349,20 @@ abstract class _PlayerController with Store {
AudioTrack.auto(),
);
+ // Android 11 及以上使用基于 Vulkan 的 MPV GPU-NEXT 视频输出,着色器性能更好
+ // 同时避免 Android 10 及以下设备上部分机型 Vulkan 支持不佳导致的黑屏问题
+ bool enableGPUNext = false;
+ if (Platform.isAndroid) {
+ final int androidSdkVersion = await Utils.getAndroidSdkVersion();
+ if (androidSdkVersion >= 30) {
+ enableGPUNext = true;
+ }
+ }
+
videoController ??= VideoController(
mediaPlayer!,
configuration: VideoControllerConfiguration(
+ vo: enableGPUNext ? 'gpu-next' : null,
enableHardwareAcceleration: hAenable,
hwdec: hAenable ? hardwareDecoder : 'no',
androidAttachSurfaceAfterVideoParameters: false,
diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
index 79ca9a6f..f5d5bea9 100644
--- a/lib/utils/utils.dart
+++ b/lib/utils/utils.dart
@@ -417,6 +417,21 @@ class Utils {
await landScape();
}
+ static Future<int> getAndroidSdkVersion() async {
+ if (Platform.isAndroid) {
+ const platform = MethodChannel('com.predidit.kazumi/intent');
+ try {
+ final int sdkVersion =
+ await platform.invokeMethod('getAndroidSdkVersion');
+ return sdkVersion;
+ } on PlatformException catch (e) {
+ KazumiLogger().e("Failed to get Android SDK version: '${e.message}'.");
+ return 0;
+ }
+ }
+ return 0;
+ }
+
//退出全屏显示
static Future<void> exitFullScreen({bool lockOrientation = true}) async {
// if (Platform.isWindows) {
diff --git a/pubspec.lock b/pubspec.lock
index 629101bd..4bfbf32e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -730,8 +730,8 @@ packages:
dependency: "direct main"
description:
path: media_kit
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.1.11"
@@ -739,8 +739,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/android/media_kit_libs_android_video"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.3.6"
@@ -748,8 +748,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/ios/media_kit_libs_ios_video"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.1.4"
@@ -757,8 +757,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/linux/media_kit_libs_linux"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.1.3"
@@ -766,8 +766,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/macos/media_kit_libs_macos_video"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.1.4"
@@ -775,8 +775,8 @@ packages:
dependency: "direct main"
description:
path: "libs/universal/media_kit_libs_video"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.0.5"
@@ -784,8 +784,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/windows/media_kit_libs_windows_video"
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.0.10"
@@ -793,8 +793,8 @@ packages:
dependency: "direct main"
description:
path: media_kit_video
- ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
- resolved-ref: "5bd14c6d13d901de79e44e9c21b2f3cd51afda85"
+ ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
+ resolved-ref: "90ea55985e5e0d1d66e90504d9c2cba165cee1c2"
url: "https://github.com/Predidit/media-kit.git"
source: git
version: "1.2.5"
diff --git a/pubspec.yaml b/pubspec.yaml
index 00a084c8..6dd55098 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -99,44 +99,44 @@ dependencies:
media_kit:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./media_kit
media_kit_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./media_kit_video
media_kit_libs_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/universal/media_kit_libs_video
dependency_overrides:
media_kit_libs_linux:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/linux/media_kit_libs_linux
media_kit_libs_ios_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/ios/media_kit_libs_ios_video
media_kit_libs_android_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/android/media_kit_libs_android_video
media_kit_libs_windows_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/windows/media_kit_libs_windows_video
media_kit_libs_macos_video:
git:
url: https://github.com/Predidit/media-kit.git
- ref: 5bd14c6d13d901de79e44e9c21b2f3cd51afda85
+ ref: 90ea55985e5e0d1d66e90504d9c2cba165cee1c2
path: ./libs/macos/media_kit_libs_macos_video
dev_dependencies: