From 97d2b7ed7e6cf0104bddaa16dda9cd925685b8da Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Mon, 3 Apr 2023 13:42:46 -0400 Subject: [PATCH 01/13] Fix loading GIF media attachments, at least if it is being added as a literal attachment --- lib/models/attachment_media_type_enum.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/models/attachment_media_type_enum.dart b/lib/models/attachment_media_type_enum.dart index e40752e..90831fd 100644 --- a/lib/models/attachment_media_type_enum.dart +++ b/lib/models/attachment_media_type_enum.dart @@ -8,6 +8,10 @@ enum AttachmentMediaType { return AttachmentMediaType.unknown; } + if (text == 'gif' || text == 'gifv') { + return AttachmentMediaType.image; + } + return AttachmentMediaType.values.firstWhere( (e) => e.name == text, orElse: () => unknown, From df77a234520b1a6292cbaa6f7107a8d538431496 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Mon, 3 Apr 2023 17:11:25 -0400 Subject: [PATCH 02/13] Initial implementation of MediaKit for desktop platforms --- lib/controls/audio_video/av_control.dart | 127 ++++++++++++++++++ .../audio_video/media_kit_av_control.dart | 108 +++++++++++++++ .../video_player_lib_av_control.dart} | 59 +++----- .../media_attachment_viewer_control.dart | 59 +------- .../flattened_tree_entry_control.dart | 2 +- lib/globals.dart | 4 +- linux/flutter/generated_plugin_registrant.cc | 8 ++ linux/flutter/generated_plugins.cmake | 2 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 42 +++++- pubspec.yaml | 3 + .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 13 files changed, 326 insertions(+), 94 deletions(-) create mode 100644 lib/controls/audio_video/av_control.dart create mode 100644 lib/controls/audio_video/media_kit_av_control.dart rename lib/controls/{video_control.dart => audio_video/video_player_lib_av_control.dart} (66%) diff --git a/lib/controls/audio_video/av_control.dart b/lib/controls/audio_video/av_control.dart new file mode 100644 index 0000000..cce02b8 --- /dev/null +++ b/lib/controls/audio_video/av_control.dart @@ -0,0 +1,127 @@ +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:relatica/controls/audio_video/media_kit_av_control.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../globals.dart'; +import '../../services/setting_service.dart'; +import '../../utils/snackbar_builder.dart'; +import 'video_player_lib_av_control.dart'; + +final _shownVideos = {}; + +final _useVideoPlayer = kIsWeb || Platform.isAndroid || Platform.isIOS; +final _useMediaKit = Platform.isWindows || Platform.isMacOS || Platform.isLinux; + +class AVControl extends StatefulWidget { + final String videoUrl; + final String description; + final double width; + final double height; + + const AVControl({ + super.key, + required this.videoUrl, + required this.width, + required this.height, + required this.description, + }); + + @override + State createState() => _AVControlState(); +} + +class _AVControlState extends State { + void showVideo() { + _shownVideos.add(widget.videoUrl); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + final shown = !context.watch().lowBandwidthMode || + _shownVideos.contains(widget.videoUrl); + + final placeHolderBox = SizedBox( + width: widget.width, + height: widget.height, + child: const Card( + color: Colors.black12, + shape: RoundedRectangleBorder(), + child: Icon(Icons.movie)), + ); + + if (!shown) { + return GestureDetector( + onTap: showVideo, + child: placeHolderBox, + ); + } + + if (_useVideoPlayer) { + return VideoPlayerLibAvControl( + videoUrl: widget.videoUrl, + width: widget.width, + height: widget.height, + ); + } + + if (_useMediaKit) { + return MediaKitAvControl( + videoUrl: widget.videoUrl, + width: widget.width, + height: widget.height, + ); + } + + return buildStandinWidget(context); + } + + Widget buildStandinWidget(BuildContext context) { + return GestureDetector( + onTap: () async { + final confirm = await showYesNoDialog( + context, 'Open Link in external app? ${widget.videoUrl}'); + if (confirm != true) { + return; + } + if (await canLaunchUrl(Uri.parse(widget.videoUrl))) { + if (context.mounted) { + buildSnackbar( + context, + 'Attempting to launch video: ${widget.videoUrl}', + ); + } + await launchUrl(Uri.parse(widget.videoUrl)); + } else { + if (context.mounted) { + buildSnackbar( + context, 'Unable to launch video: ${widget.videoUrl}'); + } + } + }, + child: SizedBox( + height: widget.height, + width: widget.width, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Card( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + widget.description.isNotEmpty + ? widget.description + : 'Video: ${widget.videoUrl}', + softWrap: true, + ), + ), + ), + ], + ), + )); + } +} diff --git a/lib/controls/audio_video/media_kit_av_control.dart b/lib/controls/audio_video/media_kit_av_control.dart new file mode 100644 index 0000000..01ad83a --- /dev/null +++ b/lib/controls/audio_video/media_kit_av_control.dart @@ -0,0 +1,108 @@ +import 'package:flutter/material.dart'; +import 'package:logging/logging.dart'; +import 'package:media_kit/media_kit.dart'; +import 'package:media_kit_video/media_kit_video.dart'; + +class MediaKitAvControl extends StatefulWidget { + final String videoUrl; + final double width; + final double height; + + const MediaKitAvControl({ + super.key, + required this.videoUrl, + required this.width, + required this.height, + }); + + @override + State createState() => _MediaKitAvControlState(); +} + +class _MediaKitAvControlState extends State { + static final _logger = Logger('$MediaKitAvControl'); + final player = Player(); + VideoController? controller; + + @override + void initState() { + super.initState(); + Future.microtask(() async { + _logger.info('initializing'); + controller = await VideoController.create(player.handle); + if (!context.mounted) { + return; + } + setState(() {}); + _logger.info('opening player'); + await player.open(Media(widget.videoUrl), play: false); + if (!context.mounted) { + return; + } + setState(() {}); + _logger.info('done'); + }); + } + + @override + void dispose() { + Future.microtask(() async { + await controller?.dispose(); + await player.dispose(); + }); + super.dispose(); + } + + @override + void deactivate() { + player.pause(); + super.deactivate(); + } + + void toggleVideoPlay() async { + player.playOrPause(); + setState(() {}); + } + + void resetPlay() async { + await player.pause(); + await player.seek(Duration.zero); + await player.play(); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + print('Building MediaKit Control'); + if (controller == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } + + return GestureDetector( + onTap: toggleVideoPlay, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Video( + controller: controller, + width: widget.width, + height: widget.height, + ), + Row( + children: [ + IconButton( + icon: player.state.playing + ? const Icon(Icons.pause) + : const Icon(Icons.play_arrow), + onPressed: toggleVideoPlay, + ), + IconButton(onPressed: resetPlay, icon: const Icon(Icons.replay)), + ], + ) + ], + ), + ); + } +} diff --git a/lib/controls/video_control.dart b/lib/controls/audio_video/video_player_lib_av_control.dart similarity index 66% rename from lib/controls/video_control.dart rename to lib/controls/audio_video/video_player_lib_av_control.dart index 6a36a74..26845d0 100644 --- a/lib/controls/video_control.dart +++ b/lib/controls/audio_video/video_player_lib_av_control.dart @@ -1,17 +1,14 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import 'package:video_player/video_player.dart'; -import '../services/setting_service.dart'; - -final _shownVideos = {}; - -class VideoControl extends StatefulWidget { +class VideoPlayerLibAvControl extends StatefulWidget { final String videoUrl; final double width; final double height; - const VideoControl({ + const VideoPlayerLibAvControl({ super.key, required this.videoUrl, required this.width, @@ -19,14 +16,16 @@ class VideoControl extends StatefulWidget { }); @override - State createState() => _VideoControlState(); + State createState() => + _VideoPlayerLibAvControlState(); } -class _VideoControlState extends State { +class _VideoPlayerLibAvControlState extends State { late final VideoPlayerController videoPlayerController; @override void initState() { + super.initState(); videoPlayerController = VideoPlayerController.network(widget.videoUrl) ..initialize().then((_) { setState(() {}); @@ -35,8 +34,8 @@ class _VideoControlState extends State { @override void dispose() { - super.dispose(); videoPlayerController.dispose(); + super.dispose(); } @override @@ -45,11 +44,6 @@ class _VideoControlState extends State { super.deactivate(); } - void showVideo() { - _shownVideos.add(widget.videoUrl); - setState(() {}); - } - void toggleVideoPlay() { videoPlayerController.value.isPlaying ? videoPlayerController.pause() @@ -59,34 +53,25 @@ class _VideoControlState extends State { @override Widget build(BuildContext context) { - final shown = !context.watch().lowBandwidthMode || - _shownVideos.contains(widget.videoUrl); + final size = videoPlayerController.value.size; + final horizontalScale = size.width / widget.width; + final verticalScale = size.height / widget.height; + final scaling = min(horizontalScale, verticalScale); + final videoWidth = scaling * size.width; + final videoHeight = scaling * size.height; - final placeHolderBox = SizedBox( - width: widget.width, - height: widget.height, - child: const Card( + if (!videoPlayerController.value.isInitialized) { + return SizedBox( + width: videoWidth, + height: videoHeight, + child: const Card( color: Colors.black12, shape: RoundedRectangleBorder(), - child: Icon(Icons.movie)), - ); - - if (!shown) { - return GestureDetector( - onTap: showVideo, - child: placeHolderBox, + child: CircularProgressIndicator(), + ), ); } - _shownVideos.add(widget.videoUrl); - if (!videoPlayerController.value.isInitialized) { - return placeHolderBox; - } - final size = videoPlayerController.value.size; - final videoWidth = size.width <= widget.width ? size.width : widget.width; - final videoHeight = size.width <= widget.width - ? size.height - : size.height * videoWidth / size.width; return GestureDetector( onTap: toggleVideoPlay, child: Column( diff --git a/lib/controls/media_attachment_viewer_control.dart b/lib/controls/media_attachment_viewer_control.dart index f404c56..86f8226 100644 --- a/lib/controls/media_attachment_viewer_control.dart +++ b/lib/controls/media_attachment_viewer_control.dart @@ -1,13 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; -import '../globals.dart'; import '../models/attachment_media_type_enum.dart'; import '../models/media_attachment.dart'; import '../screens/image_viewer_screen.dart'; -import '../utils/snackbar_builder.dart'; +import 'audio_video/av_control.dart'; import 'image_control.dart'; -import 'video_control.dart'; class MediaAttachmentViewerControl extends StatefulWidget { final List attachments; @@ -32,54 +29,12 @@ class _MediaAttachmentViewerControlState const width = 250.0; const height = 250.0; if (item.explicitType == AttachmentMediaType.video) { - if (useVideoPlayer) { - return VideoControl( - videoUrl: item.uri.toString(), - width: width, - height: height, - ); - } - return GestureDetector( - onTap: () async { - final confirm = await showYesNoDialog( - context, 'Open Video Link in external app? ${item.uri}'); - if (confirm != true) { - return; - } - if (await canLaunchUrl(item.uri)) { - if (mounted) { - buildSnackbar( - context, - 'Attempting to launch video: ${item.uri}', - ); - } - await launchUrl(item.uri); - } else { - if (mounted) { - buildSnackbar(context, 'Unable to launch video: ${item.uri}'); - } - } - }, - child: SizedBox( - height: height, - width: width, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - item.description.isNotEmpty - ? item.description - : 'Video: ${item.uri}', - softWrap: true, - ), - ), - ), - ], - ), - )); + return AVControl( + videoUrl: item.uri.toString(), + width: width, + height: height, + description: item.description, + ); } if (item.explicitType != AttachmentMediaType.image) { return Text('${item.explicitType}: ${item.uri}'); diff --git a/lib/controls/timeline/flattened_tree_entry_control.dart b/lib/controls/timeline/flattened_tree_entry_control.dart index 0bf9b05..716597e 100644 --- a/lib/controls/timeline/flattened_tree_entry_control.dart +++ b/lib/controls/timeline/flattened_tree_entry_control.dart @@ -155,7 +155,7 @@ class _StatusControlState extends State { return const SizedBox(); } return SizedBox( - height: 250.0, + height: 300.0, child: ListView.separated( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { diff --git a/lib/globals.dart b/lib/globals.dart index 8e722d0..25f090a 100644 --- a/lib/globals.dart +++ b/lib/globals.dart @@ -15,9 +15,7 @@ final platformHasCamera = Platform.isIOS || Platform.isAndroid; final useImagePicker = kIsWeb || Platform.isAndroid || Platform.isIOS; -final useVideoPlayer = kIsWeb || Platform.isAndroid || Platform.isIOS; - -final usePhpDebugging = true; +const usePhpDebugging = true; Future showConfirmDialog(BuildContext context, String caption) { return showDialog( diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index c1e3da3..6f4e824 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -8,6 +8,8 @@ #include #include +#include +#include #include #include @@ -18,6 +20,12 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_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) objectbox_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ObjectboxFlutterLibsPlugin"); objectbox_flutter_libs_plugin_register_with_registrar(objectbox_flutter_libs_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 28dcfea..119861d 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -5,6 +5,8 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_window flutter_secure_storage_linux + media_kit_libs_linux + media_kit_video objectbox_flutter_libs url_launcher_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e662fd7..976a22b 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,6 +9,7 @@ import desktop_window import device_info_plus import flutter_secure_storage_macos import flutter_web_auth_2 +import media_kit_video import objectbox_flutter_libs import path_provider_foundation import shared_preferences_foundation @@ -20,6 +21,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) + MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) ObjectboxFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "ObjectboxFlutterLibsPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/pubspec.lock b/pubspec.lock index f0e8a0e..5c9e336 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -665,6 +665,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.0" + media_kit: + dependency: "direct main" + description: + name: media_kit + sha256: baaaaa025bffba908e9b4a1c824181a8b3ce44bbf77c82be1728427dbaa848d4 + url: "https://pub.dev" + source: hosted + version: "0.0.2" + media_kit_libs_linux: + dependency: "direct main" + description: + name: media_kit_libs_linux + sha256: "7310b17dd2abc2e7363f78a273086445c2216c7b6dfb60933ca3814031d03814" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + media_kit_video: + dependency: "direct main" + description: + name: media_kit_video + sha256: f9987d92182f42852fa77e5ca98d11a91482b9f45f7a559ca3453f258026041b + url: "https://pub.dev" + source: hosted + version: "0.0.2" meta: dependency: transitive description: @@ -905,6 +929,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.27.7" + safe_local_storage: + dependency: transitive + description: + name: safe_local_storage + sha256: ede4eb6cb7d88a116b3d3bf1df70790b9e2038bc37cb19112e381217c74d9440 + url: "https://pub.dev" + source: hosted + version: "1.0.2" scrollable_positioned_list: dependency: "direct main" description: @@ -1118,6 +1150,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + 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: @@ -1288,4 +1328,4 @@ packages: version: "3.1.1" sdks: dart: ">=2.19.0 <3.0.0" - flutter: ">=3.7.0-0" + flutter: ">=3.7.0" diff --git a/pubspec.yaml b/pubspec.yaml index d93ebec..4fda134 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,6 +30,9 @@ dependencies: image_picker: ^0.8.6 logging: ^1.1.0 markdown: ^7.0.1 + media_kit: ^0.0.2 + media_kit_video: ^0.0.2 + media_kit_libs_linux: ^1.0.1 metadata_fetch: ^0.4.1 multi_trigger_autocomplete: ^0.1.1 network_to_file_image: ^4.0.1 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 4c170c8..8e36776 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -16,6 +17,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DesktopWindowPlugin")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); + MediaKitVideoPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); ObjectboxFlutterLibsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ObjectboxFlutterLibsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 5a12988..6a63f50 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -5,6 +5,7 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_window flutter_secure_storage_windows + media_kit_video objectbox_flutter_libs url_launcher_windows ) From 3b3a12c124a4bea7226b5f4b4171104cc0759a69 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Mon, 3 Apr 2023 18:08:34 -0400 Subject: [PATCH 03/13] Delay pre-loading of video --- .../audio_video/media_kit_av_control.dart | 19 +++++++++---------- .../video_player_lib_av_control.dart | 12 +++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/controls/audio_video/media_kit_av_control.dart b/lib/controls/audio_video/media_kit_av_control.dart index 01ad83a..08e9800 100644 --- a/lib/controls/audio_video/media_kit_av_control.dart +++ b/lib/controls/audio_video/media_kit_av_control.dart @@ -23,6 +23,7 @@ class _MediaKitAvControlState extends State { static final _logger = Logger('$MediaKitAvControl'); final player = Player(); VideoController? controller; + var needToOpen = true; @override void initState() { @@ -30,17 +31,10 @@ class _MediaKitAvControlState extends State { Future.microtask(() async { _logger.info('initializing'); controller = await VideoController.create(player.handle); - if (!context.mounted) { - return; + _logger.info('initialized'); + if (context.mounted) { + setState(() {}); } - setState(() {}); - _logger.info('opening player'); - await player.open(Media(widget.videoUrl), play: false); - if (!context.mounted) { - return; - } - setState(() {}); - _logger.info('done'); }); } @@ -60,6 +54,11 @@ class _MediaKitAvControlState extends State { } void toggleVideoPlay() async { + _logger.fine('Toggling play on: ${widget.videoUrl}'); + if (needToOpen) { + await player.open(Media(widget.videoUrl), play: false); + needToOpen = false; + } player.playOrPause(); setState(() {}); } diff --git a/lib/controls/audio_video/video_player_lib_av_control.dart b/lib/controls/audio_video/video_player_lib_av_control.dart index 26845d0..8981b45 100644 --- a/lib/controls/audio_video/video_player_lib_av_control.dart +++ b/lib/controls/audio_video/video_player_lib_av_control.dart @@ -22,14 +22,12 @@ class VideoPlayerLibAvControl extends StatefulWidget { class _VideoPlayerLibAvControlState extends State { late final VideoPlayerController videoPlayerController; + var needsToLoad = true; @override void initState() { super.initState(); - videoPlayerController = VideoPlayerController.network(widget.videoUrl) - ..initialize().then((_) { - setState(() {}); - }); + videoPlayerController = VideoPlayerController.network(widget.videoUrl); } @override @@ -44,7 +42,11 @@ class _VideoPlayerLibAvControlState extends State { super.deactivate(); } - void toggleVideoPlay() { + void toggleVideoPlay() async { + if (needsToLoad) { + await videoPlayerController.initialize(); + needsToLoad = false; + } videoPlayerController.value.isPlaying ? videoPlayerController.pause() : videoPlayerController.play(); From 8364e54e729ba4f590779a72639f3c7b9573ce9a Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Mon, 3 Apr 2023 18:08:46 -0400 Subject: [PATCH 04/13] Fix shut down error by usin native event loop --- linux/flutter/generated_plugins.cmake | 1 + pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + windows/flutter/generated_plugins.cmake | 1 + 4 files changed, 11 insertions(+) diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 119861d..e1c5756 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -12,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/pubspec.lock b/pubspec.lock index 5c9e336..61f09ae 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -681,6 +681,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + media_kit_native_event_loop: + dependency: "direct main" + description: + name: media_kit_native_event_loop + sha256: "677ea41d13a2013ca7fe050674eac3b5d891185d4300779727a5860a85cdda60" + url: "https://pub.dev" + source: hosted + version: "1.0.2" media_kit_video: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 4fda134..ceb3b13 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,7 @@ dependencies: logging: ^1.1.0 markdown: ^7.0.1 media_kit: ^0.0.2 + media_kit_native_event_loop: ^1.0.2 media_kit_video: ^0.0.2 media_kit_libs_linux: ^1.0.1 metadata_fetch: ^0.4.1 diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 6a63f50..5286474 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES) From f47d27dc85681627895c9161ca9e901a577a0867 Mon Sep 17 00:00:00 2001 From: HankG Date: Tue, 4 Apr 2023 09:54:31 -0400 Subject: [PATCH 05/13] Add Windows media_kit dependencies --- pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 2 files changed, 9 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index 61f09ae..a217cd5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -681,6 +681,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + media_kit_libs_windows_video: + dependency: "direct main" + description: + name: media_kit_libs_windows_video + sha256: c2bcbe31e6e6f1e6ae5813c5fe9b7bfde1110c2e95643869919972a7845948e1 + url: "https://pub.dev" + source: hosted + version: "1.0.1" media_kit_native_event_loop: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index ceb3b13..fee7911 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,7 @@ dependencies: carousel_slider: ^4.2.1 device_info_plus: ^8.0.0 string_validator: ^0.3.0 + media_kit_libs_windows_video: ^1.0.1 dev_dependencies: flutter_test: From 6de89aef26a36758e4a795702155750aaea0e572 Mon Sep 17 00:00:00 2001 From: HankG Date: Tue, 4 Apr 2023 09:56:06 -0400 Subject: [PATCH 06/13] Add Windows media_kit dependencies --- windows/flutter/generated_plugins.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 5286474..e0e6829 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + media_kit_libs_windows_video media_kit_native_event_loop ) From 2456ee9d38f5a341c717d90f6db587417ddb55ba Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 12:22:12 -0400 Subject: [PATCH 07/13] Fix video_control sizing calc for VideoPlayerLibAvControl. --- .../video_player_lib_av_control.dart | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/controls/audio_video/video_player_lib_av_control.dart b/lib/controls/audio_video/video_player_lib_av_control.dart index 8981b45..34c6d63 100644 --- a/lib/controls/audio_video/video_player_lib_av_control.dart +++ b/lib/controls/audio_video/video_player_lib_av_control.dart @@ -56,24 +56,19 @@ class _VideoPlayerLibAvControlState extends State { @override Widget build(BuildContext context) { final size = videoPlayerController.value.size; - final horizontalScale = size.width / widget.width; - final verticalScale = size.height / widget.height; - final scaling = min(horizontalScale, verticalScale); - final videoWidth = scaling * size.width; - final videoHeight = scaling * size.height; - - if (!videoPlayerController.value.isInitialized) { - return SizedBox( - width: videoWidth, - height: videoHeight, - child: const Card( - color: Colors.black12, - shape: RoundedRectangleBorder(), - child: CircularProgressIndicator(), - ), - ); + late final double videoWidth; + late final double videoHeight; + if (needsToLoad) { + videoWidth = widget.width; + videoHeight = widget.height; + } else { + final horizontalScale = widget.width / size.width; + final verticalScale = widget.height / size.height; + final scaling = min(horizontalScale, verticalScale); + videoWidth = scaling * size.width; + videoHeight = scaling * size.height; } - + print('Video Width: $videoWidth, Video Height: $videoHeight'); return GestureDetector( onTap: toggleVideoPlay, child: Column( @@ -82,10 +77,14 @@ class _VideoPlayerLibAvControlState extends State { SizedBox( width: videoWidth, height: videoHeight, - child: AspectRatio( - aspectRatio: videoPlayerController.value.aspectRatio, - child: VideoPlayer(videoPlayerController), - ), + child: needsToLoad + ? Container( + color: Colors.black, + ) + : AspectRatio( + aspectRatio: videoPlayerController.value.aspectRatio, + child: VideoPlayer(videoPlayerController), + ), ), Row( children: [ From d5c54126bf6040e6142800de3234266c28e6f7e2 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 13:50:52 -0400 Subject: [PATCH 08/13] Add macOS and iOS media_kit libraries --- ios/Podfile | 9 +++- ios/Podfile.lock | 52 +++++++++++++------ ios/Runner.xcodeproj/project.pbxproj | 9 ++-- lib/controls/audio_video/av_control.dart | 7 ++- macos/Flutter/GeneratedPluginRegistrant.swift | 2 + macos/Podfile | 2 +- macos/Podfile.lock | 38 ++++++++++---- macos/Runner.xcodeproj/project.pbxproj | 12 ++--- pubspec.lock | 24 +++++++-- pubspec.yaml | 10 ++-- 10 files changed, 117 insertions(+), 48 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 88359b2..3ec8f48 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -38,4 +38,11 @@ post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end + installer.generated_projects.each do |project| + project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + end + end + end end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 00fd2c4..074592f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -47,23 +47,29 @@ PODS: - FMDB/standard (2.7.5) - image_picker_ios (0.0.1): - Flutter - - ObjectBox (1.8.1-rc) + - media_kit_libs_ios_video (1.0.0): + - Flutter + - media_kit_native_event_loop (1.0.0): + - Flutter + - media_kit_video (0.0.1): + - Flutter + - ObjectBox (1.8.1) - objectbox_flutter_libs (0.0.1): - Flutter - - ObjectBox (= 1.8.1-rc) + - ObjectBox (= 1.8.1) - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - SDWebImage (5.13.2): - - SDWebImage/Core (= 5.13.2) - - SDWebImage/Core (5.13.2) + - SDWebImage (5.15.5): + - SDWebImage/Core (= 5.15.5) + - SDWebImage/Core (5.15.5) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) - - SwiftyGif (5.4.3) + - SwiftyGif (5.4.4) - url_launcher_ios (0.0.1): - Flutter - video_player_avfoundation (0.0.1): @@ -77,6 +83,9 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - flutter_web_auth_2 (from `.symlinks/plugins/flutter_web_auth_2/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/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`) - objectbox_flutter_libs (from `.symlinks/plugins/objectbox_flutter_libs/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) @@ -108,6 +117,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_web_auth_2/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/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" objectbox_flutter_libs: :path: ".symlinks/plugins/objectbox_flutter_libs/ios" path_provider_foundation: @@ -131,17 +146,20 @@ SPEC CHECKSUMS: flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be flutter_web_auth_2: a1bc00762c408a8f80b72a538cd7ff5b601c3e71 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb - ObjectBox: 7615cc462f2976cb45127d301a17cb473edf3f9e - objectbox_flutter_libs: 55835e03ff76bf9d5ce0a41a2ef3902d2e8c1f20 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 - SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 - shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca + image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 + media_kit_libs_ios_video: 045418d93c495fb3eaa7b8263839d991c206fa14 + media_kit_native_event_loop: 0d273668d0ad6011258e91db0e0301370a721195 + media_kit_video: 01504b1f7a2b4d11ebcf8637cd8919a4ed2452ed + ObjectBox: a7900d5335218cd437cbc080b7ccc38a5211f7b4 + objectbox_flutter_libs: 61d74196d924fbc773da5f5757d1e9fab7b3cc78 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 + SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe + shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 - SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 - url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 - video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff + SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f + url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 -PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 +PODFILE CHECKSUM: 1df1bb3ed89ef4be6115286519e24a9fad12e640 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5c601c4..07e7920 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -341,7 +341,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -361,6 +361,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -420,7 +421,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -469,7 +470,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -491,6 +492,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -515,6 +517,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/lib/controls/audio_video/av_control.dart b/lib/controls/audio_video/av_control.dart index cce02b8..836feb9 100644 --- a/lib/controls/audio_video/av_control.dart +++ b/lib/controls/audio_video/av_control.dart @@ -13,8 +13,11 @@ import 'video_player_lib_av_control.dart'; final _shownVideos = {}; -final _useVideoPlayer = kIsWeb || Platform.isAndroid || Platform.isIOS; -final _useMediaKit = Platform.isWindows || Platform.isMacOS || Platform.isLinux; +final _useVideoPlayer = kIsWeb || Platform.isAndroid; +final _useMediaKit = Platform.isIOS || + Platform.isWindows || + Platform.isMacOS || + Platform.isLinux; class AVControl extends StatefulWidget { final String videoUrl; diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 976a22b..305589f 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,6 +9,7 @@ import desktop_window import device_info_plus import flutter_secure_storage_macos import flutter_web_auth_2 +import media_kit_libs_macos_video import media_kit_video import objectbox_flutter_libs import path_provider_foundation @@ -21,6 +22,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) + MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) ObjectboxFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "ObjectboxFlutterLibsPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/macos/Podfile b/macos/Podfile index 9ec46f8..f9ebb8d 100644 --- a/macos/Podfile +++ b/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.15' +platform :osx, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 36c2113..42d6b68 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -11,10 +11,16 @@ PODS: - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - ObjectBox (1.8.1-rc) + - media_kit_libs_macos_video (1.0.0): + - FlutterMacOS + - media_kit_native_event_loop (1.0.0): + - FlutterMacOS + - media_kit_video (0.0.1): + - FlutterMacOS + - ObjectBox (1.8.1) - objectbox_flutter_libs (0.0.1): - FlutterMacOS - - ObjectBox (= 1.8.1-rc) + - ObjectBox (= 1.8.1) - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS @@ -33,6 +39,9 @@ DEPENDENCIES: - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) - flutter_web_auth_2 (from `Flutter/ephemeral/.symlinks/plugins/flutter_web_auth_2/macos`) - FlutterMacOS (from `Flutter/ephemeral`) + - media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`) + - media_kit_native_event_loop (from `Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos`) + - media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`) - objectbox_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/objectbox_flutter_libs/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`) @@ -55,6 +64,12 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/flutter_web_auth_2/macos FlutterMacOS: :path: Flutter/ephemeral + media_kit_libs_macos_video: + :path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos + media_kit_native_event_loop: + :path: Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos + media_kit_video: + :path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos objectbox_flutter_libs: :path: Flutter/ephemeral/.symlinks/plugins/objectbox_flutter_libs/macos path_provider_foundation: @@ -69,17 +84,20 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: desktop_window: fb7c4f12c1129f947ac482296b6f14059d57a3c3 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f - flutter_secure_storage_macos: 75c8cadfdba05ca007c0fa4ea0c16e5cf85e521b + flutter_secure_storage_macos: d56e2d218c1130b262bef8b4a7d64f88d7f9c9ea flutter_web_auth_2: 6695649132b6c71ea17700703761c0d18fdb8cf6 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - ObjectBox: 7615cc462f2976cb45127d301a17cb473edf3f9e - objectbox_flutter_libs: 6c6e858d1df4a7cd5cb664c2108e6fa0b412be38 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 - shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca + media_kit_libs_macos_video: d8f5b02cc1ab6f26dc3880e8367fd8ccaea73751 + media_kit_native_event_loop: db47f732bacd877aaaf78c38c4fa8cdd7127db3f + media_kit_video: 4e7996581172a6b1dfae7deda317c4036d0c458c + ObjectBox: a7900d5335218cd437cbc080b7ccc38a5211f7b4 + objectbox_flutter_libs: f89ab4878f0f764a49077cfaa59030be69ae1d7e + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 + shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea - url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2 + url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451 -PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 +PODFILE CHECKSUM: 8d40c19d3cbdb380d870685c3a564c989f1efa52 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.0 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 3967179..373d6ab 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -407,7 +407,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -436,7 +436,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -497,7 +497,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -545,7 +545,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -574,7 +574,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -602,7 +602,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/pubspec.lock b/pubspec.lock index a217cd5..e4505a4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -669,10 +669,18 @@ packages: dependency: "direct main" description: name: media_kit - sha256: baaaaa025bffba908e9b4a1c824181a8b3ce44bbf77c82be1728427dbaa848d4 + sha256: "6b1e851865c2da3d84e93e8132ee0add32f604bf7fc211d019db9101a44c8608" url: "https://pub.dev" source: hosted - version: "0.0.2" + version: "0.0.3+3" + media_kit_libs_ios_video: + dependency: "direct main" + description: + name: media_kit_libs_ios_video + sha256: "495d6e2db9b325aebda16dad3c5ae6593a9dfa37ebe08360b4765a43fa09a3b0" + url: "https://pub.dev" + source: hosted + version: "1.0.2" media_kit_libs_linux: dependency: "direct main" description: @@ -681,6 +689,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + media_kit_libs_macos_video: + dependency: "direct main" + description: + name: media_kit_libs_macos_video + sha256: ff06adff5f544b11aa1d3ad596f9add477264c6026a60aebeed69eda1c7d9d63 + url: "https://pub.dev" + source: hosted + version: "1.0.2" media_kit_libs_windows_video: dependency: "direct main" description: @@ -701,10 +717,10 @@ packages: dependency: "direct main" description: name: media_kit_video - sha256: f9987d92182f42852fa77e5ca98d11a91482b9f45f7a559ca3453f258026041b + sha256: "1a870a3d731a9ce34e12ec5baed05b3081164f0c85b71baf05900ca47ee5639c" url: "https://pub.dev" source: hosted - version: "0.0.2" + version: "0.0.4" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index fee7911..3643b60 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,10 +30,13 @@ dependencies: image_picker: ^0.8.6 logging: ^1.1.0 markdown: ^7.0.1 - media_kit: ^0.0.2 - media_kit_native_event_loop: ^1.0.2 - media_kit_video: ^0.0.2 + media_kit: ^0.0.3 + media_kit_libs_ios_video: ^1.0.2 media_kit_libs_linux: ^1.0.1 + media_kit_libs_macos_video: ^1.0.2 + media_kit_libs_windows_video: ^1.0.1 + media_kit_native_event_loop: ^1.0.2 + media_kit_video: ^0.0.4 metadata_fetch: ^0.4.1 multi_trigger_autocomplete: ^0.1.1 network_to_file_image: ^4.0.1 @@ -53,7 +56,6 @@ dependencies: carousel_slider: ^4.2.1 device_info_plus: ^8.0.0 string_validator: ^0.3.0 - media_kit_libs_windows_video: ^1.0.1 dev_dependencies: flutter_test: From c9138ce92b66546b0bff841c47b553318bd9ce5a Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 13:54:08 -0400 Subject: [PATCH 09/13] Fix overflow issue --- lib/controls/audio_video/media_kit_av_control.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/controls/audio_video/media_kit_av_control.dart b/lib/controls/audio_video/media_kit_av_control.dart index 08e9800..dee5254 100644 --- a/lib/controls/audio_video/media_kit_av_control.dart +++ b/lib/controls/audio_video/media_kit_av_control.dart @@ -70,6 +70,10 @@ class _MediaKitAvControlState extends State { setState(() {}); } + double get height => widget.height - 50; + + double get width => widget.width; + @override Widget build(BuildContext context) { print('Building MediaKit Control'); @@ -86,8 +90,8 @@ class _MediaKitAvControlState extends State { children: [ Video( controller: controller, - width: widget.width, - height: widget.height, + width: width, + height: height, ), Row( children: [ From 85697121972d93b9d9310848bf6cf89b897aae0a Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 14:03:01 -0400 Subject: [PATCH 10/13] Update version number, developer/install info, and changelog --- CHANGELOG.md | 4 +++- developers.md | 18 ++++++++++-------- install.md | 2 +- pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5762a03..0b4ad13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Relatica Change Log -## Unreleased Updates +## Version 0.4.0 (beta), 04 April 2023 * Changes * Uses "Sentence Capitalization" keyboard to have shift on for first letter of beginning of each @@ -10,7 +10,9 @@ * Fixes * Keyboard on Search Screen now dismisses when user clicks outside of the search text field or hits "Done" button (which also initiates the search). + * GIF images load correctly * New Features + * Adds video playing capability to desktop ## Version 0.3.0 (beta), 22 March 2023 diff --git a/developers.md b/developers.md index 2ba084e..cadc1c7 100644 --- a/developers.md +++ b/developers.md @@ -1,24 +1,26 @@ # Relatica Developer Notes -Relatica is written with [Flutter](https://flutter.dev/). Please follow +Relatica is written with [Flutter](https://flutter.dev/). Please follow [the install instructions](https://docs.flutter.dev/get-started/install) for your platform -to get started with development. +to get started with development. ## Linux Development -For Linux development be sure that libsecret-1-dev and libjsoncpp-dev are installed on the machine. -Also the ObjectBox library requires a more recent version of CMake than what is packaged in the -standard Flutter Snap install instructions. To get this working correctly on Linux you will -have to do the + +For Linux development be sure that libmpv-dev, mpv, libsecret-1-dev and libjsoncpp-dev are installed on the machine. +Also the ObjectBox library requires a more recent version of CMake than what is packaged in the +standard Flutter Snap install instructions. To get this working correctly on Linux you will +have to do the [manual installation version of the Flutter install instructions](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually). ## Additional Build Steps + Whenever a model is changed that is stored in ObjectBox it is necessary to execute the command: ```bash flutter pub run build_runner build ``` -Whenever building for deployment on a Linux machine you need to manually copy the libobjectbox.so -library file into the bundle's lib folder before zipping up. This issue has been filed with the +Whenever building for deployment on a Linux machine you need to manually copy the libobjectbox.so +library file into the bundle's lib folder before zipping up. This issue has been filed with the ObjectBox team to address: https://github.com/objectbox/objectbox-dart/issues/504 diff --git a/install.md b/install.md index c18da14..2c00a30 100644 --- a/install.md +++ b/install.md @@ -49,7 +49,7 @@ prompted again. The system does not work without the storage mechanism at this t ### Linux -1. Install libsecret-1-0 and libjsoncpp25 libraries from your system's package manager. +1. Install mpv, libsecret-1-0, and libjsoncpp25 libraries from your system's package manager. 2. Download the latest version (see above) 2. Unzip the archive. 3. Copy to wherever you want to store the applications diff --git a/pubspec.yaml b/pubspec.yaml index 3643b60..929bfce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: relatica description: A mobile and desktop client for interacting with the Friendica social network publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.3.0+1 +version: 0.4.0+1 environment: sdk: '>=2.18.2 <3.0.0' From 57452bb020ace2e065837fa2118a58bac6aca963 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 14:03:33 -0400 Subject: [PATCH 11/13] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4ad13..c9c9caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ sentence. * Add version error check messages on DM sending and Resharing Diaspora posts for pre-2023.03 Friendica servers + * Using media_kit instead of video_player library on iOS * Fixes * Keyboard on Search Screen now dismisses when user clicks outside of the search text field or hits "Done" button (which also initiates the search). From 80188757dc71a529ab09cbdfb4c0f7cbadefaa36 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 16:11:23 -0400 Subject: [PATCH 12/13] Update build links --- install.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install.md b/install.md index 2c00a30..d76a0f1 100644 --- a/install.md +++ b/install.md @@ -6,11 +6,11 @@ For more information about the current beta testing program # Latest Binaries: -* [Android v0.3.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.3.0%2Frelatica_v0.3.0.apk.zip) -* iPhone/iPad v0.3.0: This is only available through TestFlight. Please contact me for access. -* [Windows (Intel) v0.3.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.3.0%2FRelatica_v0.3.0_win_x64.zip) -* macOS v0.3.0 This is only available through TestFlight. Please contact me for access. -* [Linux (Intel Ubuntu 22) v0.3.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.3.0%2Frelatica_v0.3.0_linux_x64_ubuntu22.zip) +* [Android v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0.apk.zip) +* iPhone/iPad v0.4.0: This is only available through TestFlight. Please contact me for access. +* [Windows (Intel) v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0_win_x64.zip) +* macOS v0.4.0 This is only available through TestFlight. Please contact me for access. +* [Linux (Intel Ubuntu 22) v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0_linux_x64_ubuntu22.zip) ## Mobile From 02eb658e2f2eaf2faea165da065f5415121a4adf Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 4 Apr 2023 17:33:22 -0400 Subject: [PATCH 13/13] Update Mac install location... --- install.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.md b/install.md index d76a0f1..558fbd3 100644 --- a/install.md +++ b/install.md @@ -9,7 +9,8 @@ For more information about the current beta testing program * [Android v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0.apk.zip) * iPhone/iPad v0.4.0: This is only available through TestFlight. Please contact me for access. * [Windows (Intel) v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0_win_x64.zip) -* macOS v0.4.0 This is only available through TestFlight. Please contact me for access. +* [macOS v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2FRelatica_v0.4.0_mac.zip). The + TestFlight version is stuck at 0.3.0 for the time being. * [Linux (Intel Ubuntu 22) v0.4.0](https://mysocialportal-relatica.nyc3.cdn.digitaloceanspaces.com/v0.4.0%2Frelatica_v0.4.0_linux_x64_ubuntu22.zip) ## Mobile @@ -49,7 +50,7 @@ prompted again. The system does not work without the storage mechanism at this t ### Linux -1. Install mpv, libsecret-1-0, and libjsoncpp25 libraries from your system's package manager. +1. Install libmpv-dev, libsecret-1-0, and libjsoncpp25 libraries from your system's package manager. 2. Download the latest version (see above) 2. Unzip the archive. 3. Copy to wherever you want to store the applications