From b52811d66e274388b5f1c4d3649f45abb59bd9c2 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 21 Nov 2024 23:28:02 +0800 Subject: [PATCH] :sparkles: Ability to play video and audio :heavy_plus_sign: Add media kit --- ios/Podfile.lock | 42 ++ lib/widgets/attachment/attachment_item.dart | 442 ++++++++++++++++++ lib/widgets/attachment/attachment_list.dart | 7 +- linux/flutter/generated_plugin_registrant.cc | 8 + linux/flutter/generated_plugins.cmake | 3 + macos/Flutter/GeneratedPluginRegistrant.swift | 10 + pubspec.lock | 196 +++++++- pubspec.yaml | 3 + .../flutter/generated_plugin_registrant.cc | 9 + windows/flutter/generated_plugins.cmake | 4 + 10 files changed, 717 insertions(+), 7 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6522f45..e4fa17a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -189,11 +189,19 @@ PODS: - Flutter - isar_flutter_libs (1.0.0): - Flutter + - media_kit_libs_ios_video (1.0.4): + - Flutter + - media_kit_native_event_loop (1.0.0): + - Flutter + - media_kit_video (0.0.1): + - Flutter - nanopb (3.30910.0): - nanopb/decode (= 3.30910.0) - nanopb/encode (= 3.30910.0) - nanopb/decode (3.30910.0) - nanopb/encode (3.30910.0) + - package_info_plus (0.4.5): + - Flutter - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS @@ -201,6 +209,8 @@ PODS: - PromisesSwift (2.4.0): - PromisesObjC (= 2.4.0) - SAMKeychain (1.5.3) + - screen_brightness_ios (0.1.0): + - Flutter - SDWebImage (5.19.7): - SDWebImage/Core (= 5.19.7) - SDWebImage/Core (5.19.7) @@ -213,6 +223,10 @@ PODS: - SwiftyGif (5.4.5) - url_launcher_ios (0.0.1): - Flutter + - volume_controller (0.0.1): + - Flutter + - wakelock_plus (0.0.1): + - Flutter DEPENDENCIES: - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`) @@ -229,10 +243,17 @@ DEPENDENCIES: - flutter_udid (from `.symlinks/plugins/flutter_udid/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`) + - media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`) + - media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`) + - media_kit_video (from `.symlinks/plugins/media_kit_video/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + - volume_controller (from `.symlinks/plugins/volume_controller/ios`) + - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) SPEC REPOS: trunk: @@ -287,14 +308,28 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/image_picker_ios/ios" isar_flutter_libs: :path: ".symlinks/plugins/isar_flutter_libs/ios" + media_kit_libs_ios_video: + :path: ".symlinks/plugins/media_kit_libs_ios_video/ios" + media_kit_native_event_loop: + :path: ".symlinks/plugins/media_kit_native_event_loop/ios" + media_kit_video: + :path: ".symlinks/plugins/media_kit_video/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" + screen_brightness_ios: + :path: ".symlinks/plugins/screen_brightness_ios/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" sqflite_darwin: :path: ".symlinks/plugins/sqflite_darwin/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" + volume_controller: + :path: ".symlinks/plugins/volume_controller/ios" + wakelock_plus: + :path: ".symlinks/plugins/wakelock_plus/ios" SPEC CHECKSUMS: connectivity_plus: 4c41c08fc6d7c91f63bc7aec70ffe3730b04f563 @@ -326,16 +361,23 @@ SPEC CHECKSUMS: GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073 + media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1 + media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a + media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 + package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c + screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625 SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9 + wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5 diff --git a/lib/widgets/attachment/attachment_item.dart b/lib/widgets/attachment/attachment_item.dart index 941e18e..4b7e934 100644 --- a/lib/widgets/attachment/attachment_item.dart +++ b/lib/widgets/attachment/attachment_item.dart @@ -1,10 +1,14 @@ import 'dart:ui'; +import 'dart:math' as math; import 'package:dismissible_page/dismissible_page.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:material_symbols_icons/symbols.dart'; +import 'package:media_kit/media_kit.dart'; +import 'package:media_kit_video/media_kit_video.dart'; import 'package:provider/provider.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/sn_network.dart'; @@ -39,6 +43,16 @@ class AttachmentItem extends StatelessWidget { fit: BoxFit.cover, ), ); + case 'video': + return _AttachmentItemContentVideo( + data: data!, + isAutoload: false, + ); + case 'audio': + return _AttachmentItemContentAudio( + data: data!, + isAutoload: false, + ); default: return const Placeholder(); } @@ -154,3 +168,431 @@ class _AttachmentItemSensitiveBlurState ); } } + +class _AttachmentItemContentVideo extends StatefulWidget { + final SnAttachment data; + final bool isAutoload; + const _AttachmentItemContentVideo({ + super.key, + required this.data, + this.isAutoload = false, + }); + + @override + State<_AttachmentItemContentVideo> createState() => + _AttachmentItemContentVideoState(); +} + +class _AttachmentItemContentVideoState + extends State<_AttachmentItemContentVideo> { + bool _showContent = false; + + Player? _videoPlayer; + VideoController? _videoController; + + Future _startLoad() async { + setState(() => _showContent = true); + MediaKit.ensureInitialized(); + final sn = context.read(); + final url = sn.getAttachmentUrl(widget.data.rid); + _videoPlayer = Player(); + _videoController = VideoController(_videoPlayer!); + _videoPlayer!.open(Media(url), play: !widget.isAutoload); + } + + @override + void initState() { + super.initState(); + if (widget.isAutoload) _startLoad(); + } + + @override + Widget build(BuildContext context) { + const labelShadows = [ + Shadow( + offset: Offset(1, 1), + blurRadius: 5.0, + color: Color.fromARGB(255, 0, 0, 0), + ), + ]; + + final ratio = widget.data.metadata['ratio'] ?? 16 / 9; + + final sn = context.read(); + + if (!_showContent) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + child: Stack( + children: [ + if (widget.data.metadata['thumbnail'] != null) + AutoResizeUniversalImage( + sn.getAttachmentUrl(widget.data.metadata['thumbnail']), + fit: BoxFit.cover, + ) + else + const Center( + child: Icon(Icons.movie, size: 64), + ), + Align( + alignment: Alignment.bottomCenter, + child: IgnorePointer( + child: Container( + height: 56, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Theme.of(context).colorScheme.surface, + Theme.of(context).colorScheme.surface.withOpacity(0), + ], + ), + ), + ), + ), + ), + Positioned( + bottom: 4, + left: 16, + right: 16, + child: SizedBox( + height: 45, + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.data.alt, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + shadows: labelShadows, + color: Colors.white, + ), + ), + Text( + Duration( + milliseconds: + (widget.data.metadata['duration'] ?? 0) + .toInt() * + 1000, + ).toString(), + style: GoogleFonts.robotoMono( + fontSize: 12, + shadows: labelShadows, + color: Colors.white, + ), + ), + ], + ), + ), + const Icon( + Icons.play_arrow, + shadows: labelShadows, + color: Colors.white, + ).padding(bottom: 4, right: 8), + ], + ), + ), + ), + ], + ), + onTap: () { + _startLoad(); + }, + ); + } else if (_videoController == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } + + return Video( + controller: _videoController!, + aspectRatio: ratio, + ); + } + + @override + void dispose() { + _videoPlayer?.dispose(); + super.dispose(); + } +} + +class _AttachmentItemContentAudio extends StatefulWidget { + final SnAttachment data; + final bool isAutoload; + const _AttachmentItemContentAudio({ + super.key, + required this.data, + this.isAutoload = false, + }); + + @override + State<_AttachmentItemContentAudio> createState() => + _AttachmentItemContentAudioState(); +} + +class _AttachmentItemContentAudioState + extends State<_AttachmentItemContentAudio> { + bool _showContent = false; + + double? _draggingValue; + bool _isPlaying = false; + Duration _duration = Duration.zero; + Duration _position = Duration.zero; + Duration _bufferedPosition = Duration.zero; + + Player? _audioPlayer; + + Future _startLoad() async { + setState(() => _showContent = true); + MediaKit.ensureInitialized(); + final sn = context.read(); + final url = sn.getAttachmentUrl(widget.data.rid); + _audioPlayer = Player(); + await _audioPlayer!.open(Media(url), play: !widget.isAutoload); + _audioPlayer!.stream.playing.listen((v) => setState(() => _isPlaying = v)); + _audioPlayer!.stream.position.listen((v) => setState(() => _position = v)); + _audioPlayer!.stream.duration.listen((v) => setState(() => _duration = v)); + _audioPlayer!.stream.buffer.listen( + (v) => setState(() => _bufferedPosition = v), + ); + } + + @override + void initState() { + super.initState(); + if (widget.isAutoload) _startLoad(); + } + + @override + Widget build(BuildContext context) { + const labelShadows = [ + Shadow( + offset: Offset(1, 1), + blurRadius: 5.0, + color: Color.fromARGB(255, 0, 0, 0), + ), + ]; + + final sn = context.read(); + + if (!_showContent) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + child: Stack( + children: [ + if (widget.data.metadata['thumbnail'] != null) + AspectRatio( + aspectRatio: 16 / 9, + child: AutoResizeUniversalImage( + sn.getAttachmentUrl(widget.data.metadata['thumbnail']), + fit: BoxFit.cover, + ), + ) + else + const Center( + child: Icon(Icons.radio, size: 64), + ), + Align( + alignment: Alignment.bottomCenter, + child: IgnorePointer( + child: Container( + height: 56, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Theme.of(context).colorScheme.surface, + Theme.of(context).colorScheme.surface.withOpacity(0), + ], + ), + ), + ), + ), + ), + Positioned( + bottom: 4, + left: 16, + right: 16, + child: SizedBox( + height: 45, + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.data.alt, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + shadows: labelShadows, + color: Colors.white, + ), + ), + Text( + widget.data.size.toString(), + style: GoogleFonts.robotoMono( + fontSize: 12, + shadows: labelShadows, + color: Colors.white, + ), + ), + ], + ), + ), + const Icon( + Icons.play_arrow, + shadows: labelShadows, + color: Colors.white, + ).padding(bottom: 4, right: 8), + ], + ), + ), + ), + ], + ), + onTap: () { + _startLoad(); + }, + ); + } else if (_audioPlayer == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } + + return Stack( + children: [ + if (widget.data.metadata['thumbnail'] != null) + AspectRatio( + aspectRatio: 16 / 9, + child: AutoResizeUniversalImage( + sn.getAttachmentUrl(widget.data.metadata['thumbnail']), + fit: BoxFit.cover, + ), + ), + Container( + constraints: const BoxConstraints(maxWidth: 320), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.audio_file, size: 32), + const Gap(8), + Text( + widget.data.alt, + style: const TextStyle(fontSize: 13), + textAlign: TextAlign.center, + ), + const Gap(12), + Row( + children: [ + Expanded( + child: Column( + children: [ + SliderTheme( + data: SliderThemeData( + trackHeight: 2, + trackShape: _PlayerProgressTrackShape(), + thumbShape: const RoundSliderThumbShape( + enabledThumbRadius: 8, + ), + overlayShape: SliderComponentShape.noOverlay, + ), + child: Slider( + secondaryTrackValue: _bufferedPosition + .inMilliseconds + .abs() + .toDouble(), + value: _draggingValue?.abs() ?? + _position.inMilliseconds.toDouble().abs(), + min: 0, + max: math + .max( + _bufferedPosition.inMilliseconds.abs(), + math.max( + _position.inMilliseconds.abs(), + _duration.inMilliseconds.abs(), + ), + ) + .toDouble(), + onChanged: (value) { + setState(() => _draggingValue = value); + }, + onChangeEnd: (value) { + _audioPlayer!.seek( + Duration(milliseconds: value.toInt()), + ); + setState(() => _draggingValue = null); + }, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + _position.toString(), + style: GoogleFonts.robotoMono(fontSize: 12), + ), + Text( + _duration.toString(), + style: GoogleFonts.robotoMono(fontSize: 12), + ), + ], + ).padding(horizontal: 8, vertical: 4), + ], + ), + ), + const Gap(16), + IconButton.filled( + icon: _isPlaying + ? const Icon(Icons.pause) + : const Icon(Icons.play_arrow), + onPressed: () { + _audioPlayer!.playOrPause(); + }, + visualDensity: const VisualDensity( + horizontal: -4, + vertical: 0, + ), + ), + ], + ), + ], + ), + ).center(), + ], + ); + } + + @override + void dispose() { + _audioPlayer?.dispose(); + super.dispose(); + } +} + +class _PlayerProgressTrackShape extends RoundedRectSliderTrackShape { + @override + Rect getPreferredRect({ + required RenderBox parentBox, + Offset offset = Offset.zero, + required SliderThemeData sliderTheme, + bool isEnabled = false, + bool isDiscrete = false, + }) { + final trackHeight = sliderTheme.trackHeight; + final trackLeft = offset.dx; + final trackTop = offset.dy + (parentBox.size.height - trackHeight!) / 2; + final trackWidth = parentBox.size.width; + return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight); + } +} diff --git a/lib/widgets/attachment/attachment_list.dart b/lib/widgets/attachment/attachment_list.dart index 0c6605c..4f32525 100644 --- a/lib/widgets/attachment/attachment_list.dart +++ b/lib/widgets/attachment/attachment_list.dart @@ -48,7 +48,12 @@ class AttachmentList extends StatelessWidget { borderRadius: kDefaultRadius, ), child: AspectRatio( - aspectRatio: data[0]?.metadata['ratio']?.toDouble() ?? 1, + aspectRatio: data[0]?.metadata['ratio']?.toDouble() ?? + switch (data[0]?.mimetype.split('/').firstOrNull) { + 'audio' => 16 / 9, + 'video' => 16 / 9, + _ => 1, + }, child: ClipRRect( borderRadius: kDefaultRadius, child: AttachmentItem(data: data[0], isExpandable: true), diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index a9f5cf3..7298075 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include void fl_register_plugins(FlPluginRegistry* registry) { @@ -25,6 +27,12 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin"); isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_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) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 683c9bc..33ddc1f 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,12 +7,15 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_secure_storage_linux flutter_udid isar_flutter_libs + media_kit_libs_linux + media_kit_video url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST croppy jni + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index a6567d5..13a1aca 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -14,10 +14,15 @@ import firebase_messaging import flutter_secure_storage_macos import flutter_udid import isar_flutter_libs +import media_kit_libs_macos_video +import media_kit_video +import package_info_plus import path_provider_foundation +import screen_brightness_macos import shared_preferences_foundation import sqflite_darwin import url_launcher_macos +import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) @@ -29,8 +34,13 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterUdidPlugin.register(with: registry.registrar(forPlugin: "FlutterUdidPlugin")) IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin")) + 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")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 05b988a..a1c1277 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -386,10 +386,10 @@ packages: dependency: transitive description: name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + sha256: b35578f687b79243d39008c44d638474d93e9091e578c970efef41ce0c3fa000 url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.6" fake_async: dependency: transitive description: @@ -604,10 +604,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: f0e599ba89c9946c8e051780f0ec99aba4ba15895e0380a7ab68f420046fc44e + sha256: "999a4e3cb3e1532a971c86d6c73a480264f6a687959d4887cb4e2990821827e4" url: "https://pub.dev" source: hosted - version: "0.7.4+1" + version: "0.7.4+2" flutter_native_splash: dependency: "direct dev" description: @@ -1058,6 +1058,78 @@ packages: url: "https://pub.dev" source: hosted version: "4.2799.0" + media_kit: + dependency: "direct main" + description: + name: media_kit + sha256: "1f1deee148533d75129a6f38251ff8388e33ee05fc2d20a6a80e57d6051b7b62" + url: "https://pub.dev" + source: hosted + version: "1.1.11" + media_kit_libs_android_video: + dependency: transitive + description: + name: media_kit_libs_android_video + sha256: "9dd8012572e4aff47516e55f2597998f0a378e3d588d0fad0ca1f11a53ae090c" + url: "https://pub.dev" + source: hosted + version: "1.3.6" + media_kit_libs_ios_video: + dependency: transitive + description: + name: media_kit_libs_ios_video + sha256: b5382994eb37a4564c368386c154ad70ba0cc78dacdd3fb0cd9f30db6d837991 + url: "https://pub.dev" + source: hosted + version: "1.1.4" + media_kit_libs_linux: + dependency: transitive + description: + name: media_kit_libs_linux + sha256: e186891c31daa6bedab4d74dcdb4e8adfccc7d786bfed6ad81fe24a3b3010310 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + media_kit_libs_macos_video: + dependency: transitive + description: + name: media_kit_libs_macos_video + sha256: f26aa1452b665df288e360393758f84b911f70ffb3878032e1aabba23aa1032d + url: "https://pub.dev" + source: hosted + version: "1.1.4" + media_kit_libs_video: + dependency: "direct main" + description: + name: media_kit_libs_video + sha256: "20bb4aefa8fece282b59580e1cd8528117297083a6640c98c2e98cfc96b93288" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + media_kit_libs_windows_video: + dependency: transitive + description: + name: media_kit_libs_windows_video + sha256: "32654572167825c42c55466f5d08eee23ea11061c84aa91b09d0e0f69bdd0887" + url: "https://pub.dev" + source: hosted + version: "1.0.10" + media_kit_native_event_loop: + dependency: transitive + description: + name: media_kit_native_event_loop + sha256: "7d82e3b3e9ded5c35c3146c5ba1da3118d1dd8ac3435bac7f29f458181471b40" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + media_kit_video: + dependency: "direct main" + description: + name: media_kit_video + sha256: "2cc3b966679963ba25a4ce5b771e532a521ebde7c6aa20e9802bec95d9916c8f" + url: "https://pub.dev" + source: hosted + version: "1.2.5" meta: dependency: transitive description: @@ -1114,6 +1186,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: da8d9ac8c4b1df253d1a328b7bf01ae77ef132833479ab40763334db13b91cce + url: "https://pub.dev" + source: hosted + version: "8.1.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66 + url: "https://pub.dev" + source: hosted + version: "3.0.1" path: dependency: "direct main" description: @@ -1258,6 +1346,62 @@ packages: url: "https://pub.dev" source: hosted version: "0.28.0" + safe_local_storage: + dependency: transitive + description: + name: safe_local_storage + sha256: ede4eb6cb7d88a116b3d3bf1df70790b9e2038bc37cb19112e381217c74d9440 + url: "https://pub.dev" + source: hosted + version: "1.0.2" + screen_brightness: + dependency: transitive + description: + name: screen_brightness + sha256: ed8da4a4511e79422fc1aa88138e920e4008cd312b72cdaa15ccb426c0faaedd + url: "https://pub.dev" + source: hosted + version: "0.2.2+1" + screen_brightness_android: + dependency: transitive + description: + name: screen_brightness_android + sha256: "3df10961e3a9e968a5e076fe27e7f4741fa8a1d3950bdeb48cf121ed529d0caf" + url: "https://pub.dev" + source: hosted + version: "0.1.0+2" + screen_brightness_ios: + dependency: transitive + description: + name: screen_brightness_ios + sha256: "99adc3ca5490b8294284aad5fcc87f061ad685050e03cf45d3d018fe398fd9a2" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + screen_brightness_macos: + dependency: transitive + description: + name: screen_brightness_macos + sha256: "64b34e7e3f4900d7687c8e8fb514246845a73ecec05ab53483ed025bd4a899fd" + url: "https://pub.dev" + source: hosted + version: "0.1.0+1" + screen_brightness_platform_interface: + dependency: transitive + description: + name: screen_brightness_platform_interface + sha256: b211d07f0c96637a15fb06f6168617e18030d5d74ad03795dd8547a52717c171 + url: "https://pub.dev" + source: hosted + version: "0.1.0" + screen_brightness_windows: + dependency: transitive + description: + name: screen_brightness_windows + sha256: "9261bf33d0fc2707d8cf16339ce25768100a65e70af0fcabaf032fc12408ba86" + url: "https://pub.dev" + source: hosted + version: "0.1.3" shared_preferences: dependency: "direct main" description: @@ -1387,10 +1531,10 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490" + sha256: "761b9740ecbd4d3e66b8916d784e581861fd3c3553eda85e167bc49fdb68f709" url: "https://pub.dev" source: hosted - version: "2.5.4+5" + version: "2.5.4+6" sqflite_darwin: dependency: transitive description: @@ -1511,6 +1655,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: "6543c9fd86d2862fac55d800a43e67c0dcd1a41677cb69c2f8edfe73bbcf1835" + url: "https://pub.dev" + source: hosted + version: "2.0.2" url_launcher: dependency: "direct main" description: @@ -1607,6 +1767,30 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.5" + volume_controller: + dependency: transitive + description: + name: volume_controller + sha256: c71d4c62631305df63b72da79089e078af2659649301807fa746088f365cb48e + url: "https://pub.dev" + source: hosted + version: "2.0.8" + wakelock_plus: + dependency: transitive + description: + name: wakelock_plus + sha256: bf4ee6f17a2fa373ed3753ad0e602b7603f8c75af006d5b9bdade263928c0484 + url: "https://pub.dev" + source: hosted + version: "1.2.8" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16" + url: "https://pub.dev" + source: hosted + version: "1.2.1" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d51f2a7..5460f46 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -84,6 +84,9 @@ dependencies: firebase_analytics: ^11.3.5 firebase_crashlytics: ^4.1.5 flutter_udid: ^3.0.0 + media_kit: ^1.1.11 + media_kit_video: ^1.2.5 + media_kit_libs_video: ^1.0.5 dev_dependencies: flutter_test: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index c885e3e..cfd4273 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -12,6 +12,9 @@ #include #include #include +#include +#include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { @@ -27,6 +30,12 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FlutterUdidPluginCApi")); IsarFlutterLibsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin")); + MediaKitLibsWindowsVideoPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); + MediaKitVideoPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); + ScreenBrightnessWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index dbc4464..30c0351 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -9,12 +9,16 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_secure_storage_windows flutter_udid isar_flutter_libs + media_kit_libs_windows_video + media_kit_video + screen_brightness_windows url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST croppy jni + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES)