From 801a5968cf30409517bcd5797602441134ce17fc Mon Sep 17 00:00:00 2001 From: Predidit <34627277+Predidit@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:42:06 +0800 Subject: [PATCH] enable media-kit & add player error dialog --- lib/bean/anime/anime_card.dart | 4 +- lib/main.dart | 2 + lib/pages/init_page.dart | 23 --- lib/pages/player/player_controller.dart | 89 ++++++--- lib/pages/player/player_item.dart | 31 ++- lib/pages/settings/player_settings_page.dart | 2 +- lib/pages/timeline/timeline_page.dart | 2 +- lib/pages/video/video_page.dart | 13 +- linux/flutter/generated_plugin_registrant.cc | 12 +- linux/flutter/generated_plugins.cmake | 3 +- macos/Flutter/GeneratedPluginRegistrant.swift | 6 +- pubspec.lock | 186 ++++++++++++------ pubspec.yaml | 74 ++++++- .../flutter/generated_plugin_registrant.cc | 9 +- windows/flutter/generated_plugins.cmake | 3 +- 15 files changed, 307 insertions(+), 152 deletions(-) diff --git a/lib/bean/anime/anime_card.dart b/lib/bean/anime/anime_card.dart index cf88f93..f00d90e 100644 --- a/lib/bean/anime/anime_card.dart +++ b/lib/bean/anime/anime_card.dart @@ -77,7 +77,7 @@ class _AnimeInfoCardState extends State { SmartDialog.dismiss(); if (widget.info.progress != 1) { SmartDialog.showToast(i18n.toast.historyToast(episode: widget.info.progress ?? 1), - displayType: SmartToastType.last); + displayType: SmartToastType.onlyRefresh); } videoController.link = widget.info.link!; videoController.offset = history?.offset ?? 0; @@ -213,7 +213,7 @@ class _AnimeInfoCardState extends State { }); SmartDialog.showToast( follow ? i18n.toast.favoriteToast : i18n.toast.dismissFavorite, - displayType: SmartToastType.last); + displayType: SmartToastType.onlyRefresh); } }, splashColor: Theme.of(context) diff --git a/lib/main.dart b/lib/main.dart index 9b3e511..9cce9f9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,10 +9,12 @@ import 'package:oneanime/utils/storage.dart'; import 'package:flutter/services.dart'; import 'package:oneanime/utils/utils.dart'; import 'package:oneanime/pages/error/error.dart'; +import 'package:media_kit/media_kit.dart'; import 'package:oneanime/i18n/strings.g.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + MediaKit.ensureInitialized(); LocaleSettings.useDeviceLocale(); if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) { await windowManager.ensureInitialized(); diff --git a/lib/pages/init_page.dart b/lib/pages/init_page.dart index 2e0ae9b..e8d6942 100644 --- a/lib/pages/init_page.dart +++ b/lib/pages/init_page.dart @@ -3,7 +3,6 @@ import 'dart:ffi'; import 'package:flutter/material.dart'; import 'package:flutter_modular/flutter_modular.dart'; -import 'package:fvp/fvp.dart' as fvp; import 'package:hive/hive.dart'; import 'package:oneanime/pages/my/my_controller.dart'; import 'package:oneanime/utils/storage.dart'; @@ -37,28 +36,6 @@ class _InitPageState extends State { if (autoUpdate) { update(); } - - /// mdk初始化 - HAenable = setting.get(SettingBoxKey.HAenable, defaultValue: true); - if (HAenable) { - fvp.registerWith(options: { - 'player': { - 'avio.reconnect': '1', - 'avio.reconnect_delay_max': '7', - 'buffer': '2000+150000', - }, - }); - } else { - fvp.registerWith(options: { - 'video.decoders': ['FFmpeg'], - 'player': { - 'avio.reconnect': '1', - 'avio.reconnect_delay_max': '7', - 'buffer': '2000+150000', - }, - }); - } - _checkStatements(); } diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dart index d908258..eda452a 100644 --- a/lib/pages/player/player_controller.dart +++ b/lib/pages/player/player_controller.dart @@ -1,5 +1,8 @@ +import 'dart:io'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:mobx/mobx.dart'; -import 'package:video_player/video_player.dart'; +import 'package:media_kit/media_kit.dart'; +import 'package:media_kit_video/media_kit_video.dart'; import 'package:canvas_danmaku/canvas_danmaku.dart'; import 'package:oneanime/utils/constans.dart'; import 'package:flutter/foundation.dart'; @@ -16,7 +19,8 @@ abstract class _PlayerController with Store { String videoCookie = ''; bool playResume = false; Box setting = GStorage.setting; - late VideoPlayerController mediaPlayer; + late Player mediaPlayer; + late VideoController videoController; late DanmakuController danmakuController; // 当前播放器状态 @@ -34,14 +38,7 @@ abstract class _PlayerController with Store { debugPrint('未找到已经存在的 player'); } debugPrint('VideoURL开始初始化'); - mediaPlayer = await createVideoController(); - bool aotoPlay = setting.get(SettingBoxKey.autoPlay, defaultValue: true); - if (offset != 0 && playResume) { - await mediaPlayer.seekTo(Duration(seconds: offset)); - } - if (aotoPlay) { - await mediaPlayer.play(); - } + mediaPlayer = await createVideoController(offset: offset); danmakuController.clear(); debugPrint('VideoURL初始化完成'); dataStatus = 'loaded'; @@ -56,58 +53,86 @@ abstract class _PlayerController with Store { } } - Future createVideoController() async { - debugPrint('videoController 配置成功'); - + Future createVideoController({int offset = 0}) async { var httpHeaders = { - 'user-agent': - Utils.getRandomUA(), + 'user-agent': Utils.getRandomUA(), 'referer': HttpString.baseUrl, 'Cookie': videoCookie, }; + bool hAenable = setting.get(SettingBoxKey.HAenable, defaultValue: true); + bool aotoPlay = setting.get(SettingBoxKey.autoPlay, defaultValue: true); + mediaPlayer = Player( + configuration: const PlayerConfiguration( + bufferSize: 15 * 1024 * 1024, + ), + ); + + var pp = mediaPlayer.platform as NativePlayer; + await pp.setProperty("af", "scaletempo2=max-speed=8"); + if (Platform.isAndroid) { + await pp.setProperty("volume-max", "100"); + await pp.setProperty("ao", "opensles"); + } - mediaPlayer = VideoPlayerController.networkUrl(Uri.parse(videoUrl), - httpHeaders: httpHeaders); - await mediaPlayer.initialize(); + await mediaPlayer.setAudioTrack( + AudioTrack.auto(), + ); + + videoController = VideoController( + mediaPlayer, + configuration: VideoControllerConfiguration( + enableHardwareAcceleration: hAenable, + androidAttachSurfaceAfterVideoParameters: false, + ), + ); + mediaPlayer.setPlaylistMode(PlaylistMode.none); + + // error handle + mediaPlayer.stream.error.listen((event) { + SmartDialog.showToast( + 'Player intent error ${event.toString()} $videoUrl', displayType: SmartToastType.onlyRefresh, + ); + }); + + await mediaPlayer.open( + Media(videoUrl, + start: Duration(seconds: offset), httpHeaders: httpHeaders), + play: aotoPlay, + ); return mediaPlayer; } Function get setRate { - return mediaPlayer.setPlaybackSpeed; + return mediaPlayer.setRate; } bool get playing { - return mediaPlayer.value.isPlaying; + return mediaPlayer.state.playing; } bool get buffering { - return mediaPlayer.value.isBuffering; + return mediaPlayer.state.buffering; } Duration get position { - return mediaPlayer.value.position; + return mediaPlayer.state.position; } Duration get buffer { - if (mediaPlayer.value.buffered.isEmpty) { - return Duration.zero; - } - - Duration maxDuration = mediaPlayer.value.buffered[0].end; - return maxDuration; + return mediaPlayer.state.buffer; } Duration get duration { - return mediaPlayer.value.duration; + return mediaPlayer.state.duration; } bool get completed { - return mediaPlayer.value.isCompleted; + return mediaPlayer.state.completed; } Future seek(Duration duration) async { danmakuController.clear(); - await mediaPlayer.seekTo(duration); + await mediaPlayer.seek(duration); } Future pause() async { @@ -121,7 +146,7 @@ abstract class _PlayerController with Store { } Future playOrPause() async { - if (mediaPlayer.value.isPlaying) { + if (mediaPlayer.state.playing) { pause(); } else { play(); diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart index bf09a7f..74530ff 100644 --- a/lib/pages/player/player_item.dart +++ b/lib/pages/player/player_item.dart @@ -1,7 +1,7 @@ import 'package:oneanime/pages/player/player_controller.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:video_player/video_player.dart'; +import 'package:media_kit_video/media_kit_video.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:oneanime/pages/video/video_controller.dart' as videoPage; @@ -33,10 +33,31 @@ class _PlayerItemState extends State { Widget build(BuildContext context) { return Observer(builder: (context) { return playerController.dataStatus == 'loaded' - ? AspectRatio( - aspectRatio: playerController.mediaPlayer.value.aspectRatio, - child: VideoPlayer( - playerController.mediaPlayer, + ? Video( + controller: playerController.videoController, + controls: NoVideoControls, + subtitleViewConfiguration: SubtitleViewConfiguration( + style: TextStyle( + color: Colors.pink, + fontSize: 48.0, + background: Paint()..color = Colors.transparent, + decoration: TextDecoration.none, + fontWeight: FontWeight.bold, + shadows: const [ + Shadow( + offset: Offset(1.0, 1.0), + blurRadius: 3.0, + color: Color.fromARGB(255, 255, 255, 255), + ), + Shadow( + offset: Offset(-1.0, -1.0), + blurRadius: 3.0, + color: Color.fromARGB(125, 255, 255, 255), + ), + ], + ), + textAlign: TextAlign.center, + padding: const EdgeInsets.all(24.0), ), ) : const Center(child: CircularProgressIndicator()); diff --git a/lib/pages/settings/player_settings_page.dart b/lib/pages/settings/player_settings_page.dart index ad29eb6..1deac19 100644 --- a/lib/pages/settings/player_settings_page.dart +++ b/lib/pages/settings/player_settings_page.dart @@ -46,7 +46,7 @@ class _PlayerSettingsPageState extends State { title: i18n.my.playerSettings.hardwareAcceleration, setKey: SettingBoxKey.HAenable, defaultVal: true, - needReboot: true, + needReboot: false, ), ), InkWell( diff --git a/lib/pages/timeline/timeline_page.dart b/lib/pages/timeline/timeline_page.dart index 7cfa302..a0878b6 100644 --- a/lib/pages/timeline/timeline_page.dart +++ b/lib/pages/timeline/timeline_page.dart @@ -242,7 +242,7 @@ class _TimelinePageState extends State listen: false); Modular.to.pushNamed('/video/'); } else { - SmartDialog.showToast(i18n.toast.animeNotExist, displayType: SmartToastType.last); + SmartDialog.showToast(i18n.toast.animeNotExist, displayType: SmartToastType.onlyRefresh); } }, child: Align( diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart index 8c290f6..a347f1d 100644 --- a/lib/pages/video/video_page.dart +++ b/lib/pages/video/video_page.dart @@ -23,7 +23,6 @@ import 'package:hive/hive.dart'; import 'package:oneanime/bean/appbar/drag_to_move_bar.dart' as dtb; import 'package:oneanime/utils/storage.dart'; import 'package:oneanime/utils/utils.dart'; -import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:oneanime/i18n/strings.g.dart'; class VideoPage extends StatefulWidget { @@ -129,7 +128,7 @@ class _VideoPageState extends State void _handleDanmaku() { if (videoController.danDanmakus.isEmpty) { - SmartDialog.showToast('当前剧集没有找到弹幕的说', displayType: SmartToastType.last); + SmartDialog.showToast('当前剧集没有找到弹幕的说', displayType: SmartToastType.onlyRefresh); return; } danmakuController.clear(); @@ -158,7 +157,6 @@ class _VideoPageState extends State WidgetsBinding.instance.addPostFrameCallback((_) { FocusScope.of(context).requestFocus(_focusNode); }); - WakelockPlus.enable(); bool alwaysOntop = setting.get(SettingBoxKey.alwaysOntop, defaultValue: true); if (alwaysOntop && @@ -202,7 +200,6 @@ class _VideoPageState extends State @override void dispose() { _focusNode.dispose(); - WakelockPlus.disable(); WidgetsBinding.instance.removeObserver(this); try { playerTimer!.cancel(); @@ -887,7 +884,7 @@ class _VideoPageState extends State // 自定义顶部组件 Visibility( visible: showPositioned || - !playerController.mediaPlayer.value.isPlaying, + !playerController.mediaPlayer.state.playing, child: Positioned( top: 0, left: 0, @@ -935,7 +932,7 @@ class _VideoPageState extends State videoController.follow ? i18n.toast.favoriteToast : i18n.toast.dismissFavorite, - displayType: SmartToastType.last); + displayType: SmartToastType.onlyRefresh); }, splashColor: Theme.of(context) .colorScheme @@ -950,7 +947,7 @@ class _VideoPageState extends State // 自定义播放器底部组件 Visibility( visible: showPositioned || - !playerController.mediaPlayer.value.isPlaying, + !playerController.mediaPlayer.state.playing, child: Positioned( bottom: 0, left: 0, @@ -978,7 +975,7 @@ class _VideoPageState extends State if (videoController.episode == videoController.token.length) { SmartDialog.showToast('已经是最新一集', - displayType: SmartToastType.last); + displayType: SmartToastType.onlyRefresh); return; } SmartDialog.showToast( diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index c5f2c76..c99530e 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,7 +7,8 @@ #include "generated_plugin_registrant.h" #include -#include +#include +#include #include #include #include @@ -16,9 +17,12 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) flutter_volume_controller_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterVolumeControllerPlugin"); flutter_volume_controller_plugin_register_with_registrar(flutter_volume_controller_registrar); - g_autoptr(FlPluginRegistrar) fvp_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "FvpPlugin"); - fvp_plugin_register_with_registrar(fvp_registrar); + g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin"); + media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar); + g_autoptr(FlPluginRegistrar) media_kit_video_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); + media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin"); screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index e90e57b..ba1ef6c 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,7 +4,8 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_volume_controller - fvp + media_kit_libs_linux + media_kit_video screen_retriever_linux url_launcher_linux window_manager diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8728b7c..c180d52 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,7 +8,8 @@ import Foundation import connectivity_plus import device_info_plus import flutter_volume_controller -import fvp +import media_kit_libs_macos_video +import media_kit_video import package_info_plus import path_provider_foundation import screen_brightness_macos @@ -23,7 +24,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FlutterVolumeControllerPlugin.register(with: registry.registrar(forPlugin: "FlutterVolumeControllerPlugin")) - FvpPlugin.register(with: registry.registrar(forPlugin: "FvpPlugin")) + MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) + MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 7c2476b..2ad8965 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -459,14 +459,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" - fvp: - dependency: "direct main" - description: - name: fvp - sha256: "3dd245cac5dfba36311cbf5834d8f275ba1f3e49a5cdcb4a98e01cb41e9a21d8" - url: "https://pub.dev" - source: hosted - version: "0.28.0" glob: dependency: transitive description: @@ -651,6 +643,78 @@ packages: url: "https://pub.dev" source: hosted version: "0.11.1" + media_kit: + dependency: "direct main" + description: + path: media_kit + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.1.11" + media_kit_libs_android_video: + dependency: "direct overridden" + description: + path: "libs/android/media_kit_libs_android_video" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.3.6" + media_kit_libs_ios_video: + dependency: "direct overridden" + description: + path: "libs/ios/media_kit_libs_ios_video" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.1.4" + media_kit_libs_linux: + dependency: "direct overridden" + description: + path: "libs/linux/media_kit_libs_linux" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.1.3" + media_kit_libs_macos_video: + dependency: "direct overridden" + description: + path: "libs/macos/media_kit_libs_macos_video" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.1.4" + media_kit_libs_video: + dependency: "direct main" + description: + path: "libs/universal/media_kit_libs_video" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.0.5" + media_kit_libs_windows_video: + dependency: "direct overridden" + description: + path: "libs/windows/media_kit_libs_windows_video" + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.0.10" + media_kit_video: + dependency: "direct main" + description: + path: media_kit_video + ref: main + resolved-ref: eefa578ea41f594b8392653edff6fe8da05cc95b + url: "https://github.com/Predidit/media-kit.git" + source: git + version: "1.2.5" meta: dependency: transitive description: @@ -867,54 +931,62 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + safe_local_storage: + dependency: transitive + description: + name: safe_local_storage + sha256: e9a21b6fec7a8aa62cc2585ff4c1b127df42f3185adbd2aca66b47abe2e80236 + url: "https://pub.dev" + source: hosted + version: "2.0.1" screen_brightness: dependency: "direct main" description: name: screen_brightness - sha256: "7d4ac84ae26b37c01d6f5db7123a72db7933e1f2a2a8c369a51e08f81b3178d8" + sha256: a9a98666045ad4ea0d82bca09fe5f007b8440e315075dc948c1507a9b72ee41f url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.1" screen_brightness_android: dependency: transitive description: name: screen_brightness_android - sha256: "8c69d3ac475e4d625e7fa682a3a51a69ff59abe5b4a9e57f6ec7d830a6c69bd6" + sha256: "74455f9901ab8a1a45c9097b83855dbbb7498110cc2bc249cb5a86570dd1cf7c" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" screen_brightness_ios: dependency: transitive description: name: screen_brightness_ios - sha256: f08f70ca1ac3e30719764b5cfb8b3fe1e28163065018a41b3e6f243ab146c2f1 + sha256: caee02b34e0089b138a7aee35c461bd2d7c78446dd417f07613def192598ca08 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" screen_brightness_macos: dependency: transitive description: name: screen_brightness_macos - sha256: "70c2efa4534e22b927e82693488f127dd4a0f008469fccf4f0eefe9061bbdd6a" + sha256: "84fc8ffcbcf19c03d76b7673b0f2c2a2663c09aa2bc37c76ea83ab049294a97a" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" screen_brightness_platform_interface: dependency: transitive description: name: screen_brightness_platform_interface - sha256: "9f3ebf7f22d5487e7676fe9ddaf3fc55b6ff8057707cf6dc0121c7dfda346a16" + sha256: "321e9455b0057e3647fd37700931e063739d94a8aa1b094f98133c01cb56c27b" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" screen_brightness_windows: dependency: transitive description: name: screen_brightness_windows - sha256: c8e12a91cf6dd912a48bd41fcf749282a51afa17f536c3460d8d05702fb89ffa + sha256: "5edbfb1dcaedf960f6858efac8ca45d6c18faae17df86e2c03137d3a563ea155" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.1" screen_pixel: dependency: "direct main" description: @@ -1128,6 +1200,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" + url: "https://pub.dev" + source: hosted + version: "3.3.0+3" term_glyph: dependency: transitive description: @@ -1168,6 +1248,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.2" + universal_platform: + dependency: transitive + description: + name: universal_platform + sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + uri_parser: + dependency: transitive + description: + name: uri_parser + sha256: ff4d2c720aca3f4f7d5445e23b11b2d15ef8af5ddce5164643f38ff962dcb270 + url: "https://pub.dev" + source: hosted + version: "3.0.0" url_launcher: dependency: "direct main" description: @@ -1248,46 +1344,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - video_player: - dependency: "direct main" - description: - name: video_player - sha256: "4a8c3492d734f7c39c2588a3206707a05ee80cef52e8c7f3b2078d430c84bc17" - url: "https://pub.dev" - source: hosted - version: "2.9.2" - video_player_android: - dependency: transitive - description: - name: video_player_android - sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898" - url: "https://pub.dev" - source: hosted - version: "2.7.16" - video_player_avfoundation: - dependency: transitive - description: - name: video_player_avfoundation - sha256: "33224c19775fd244be2d6e3dbd8e1826ab162877bd61123bf71890772119a2b7" - url: "https://pub.dev" - source: hosted - version: "2.6.5" - video_player_platform_interface: - dependency: transitive - description: - name: video_player_platform_interface - sha256: "229d7642ccd9f3dc4aba169609dd6b5f3f443bb4cc15b82f7785fcada5af9bbb" - url: "https://pub.dev" - source: hosted - version: "6.2.3" - video_player_web: - dependency: transitive - description: - name: video_player_web - sha256: "881b375a934d8ebf868c7fb1423b2bfaa393a0a265fa3f733079a86536064a10" - url: "https://pub.dev" - source: hosted - version: "2.3.3" vm_service: dependency: transitive description: @@ -1296,8 +1352,16 @@ packages: url: "https://pub.dev" source: hosted version: "14.3.0" + volume_controller: + dependency: transitive + description: + name: volume_controller + sha256: c71d4c62631305df63b72da79089e078af2659649301807fa746088f365cb48e + url: "https://pub.dev" + source: hosted + version: "2.0.8" wakelock_plus: - dependency: "direct main" + dependency: transitive description: name: wakelock_plus sha256: bf4ee6f17a2fa373ed3753ad0e602b7603f8c75af006d5b9bdade263928c0484 diff --git a/pubspec.yaml b/pubspec.yaml index b180189..53ba036 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,31 +53,89 @@ dependencies: connectivity_plus: ^6.0.5 url_launcher: ^6.3.0 device_info_plus: ^10.1.2 - flutter_open_chinese_convert: - git: - url: https://github.com/Predidit/flutter_open_chinese_convert.git - ref: master flutter_launcher_icons: ^0.13.1 window_manager: ^0.4.2 slang: ^3.31.2 slang_flutter: ^3.31.0 - video_player: ^2.9.2 - fvp: ^0.28.0 + # video_player: ^2.9.2 + # fvp: ^0.28.0 audio_video_progress_bar: ^2.0.2 canvas_danmaku: ^0.2.0 flutter_volume_controller: ^1.3.2 - screen_brightness: ^1.0.1 + screen_brightness: ^2.0.1 screen_pixel: ^0.0.3 - wakelock_plus: ^1.1.1 adaptive_theme: ^3.6.0 flutter_displaymode: ^0.6.0 ffi: ^2.1.0 provider: any + + flutter_open_chinese_convert: + git: + url: https://github.com/Predidit/flutter_open_chinese_convert.git + ref: master + media_kit: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./media_kit + media_kit_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./media_kit_video + media_kit_libs_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/universal/media_kit_libs_video + +dependency_overrides: + media_kit: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./media_kit + media_kit_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./media_kit_video + media_kit_libs_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/universal/media_kit_libs_video + media_kit_libs_linux: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/linux/media_kit_libs_linux + media_kit_libs_ios_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/ios/media_kit_libs_ios_video + media_kit_libs_android_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/android/media_kit_libs_android_video + media_kit_libs_windows_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/windows/media_kit_libs_windows_video + media_kit_libs_macos_video: + git: + url: https://github.com/Predidit/media-kit.git + ref: main + path: ./libs/macos/media_kit_libs_macos_video + dev_dependencies: flutter_test: sdk: flutter diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index d6e0414..f76bfaa 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -8,7 +8,8 @@ #include #include -#include +#include +#include #include #include #include @@ -20,8 +21,10 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); FlutterVolumeControllerPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterVolumeControllerPluginCApi")); - FvpPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FvpPluginCApi")); + MediaKitLibsWindowsVideoPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); + MediaKitVideoPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); ScreenBrightnessWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); ScreenPixelPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 059b9b9..ba807c7 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -5,7 +5,8 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus flutter_volume_controller - fvp + media_kit_libs_windows_video + media_kit_video screen_brightness_windows screen_pixel screen_retriever_windows