diff --git a/.github/workflows/flutter-linux-release.yml b/.github/workflows/flutter-linux-release.yml index d3160503c..2d5cbe998 100644 --- a/.github/workflows/flutter-linux-release.yml +++ b/.github/workflows/flutter-linux-release.yml @@ -18,7 +18,7 @@ jobs: - name: Update apt-get run: sudo apt-get update - name: Install libraries - run: sudo apt-get install libgtk-3-dev cmake cmake-doc ninja-build libsecret-1-dev libjsoncpp-dev libsecret-1-0 sqlite3 libsqlite3-dev keybinder-3.0 network-manager + run: sudo apt-get install libgtk-3-dev cmake cmake-doc ninja-build libsecret-1-dev libjsoncpp-dev libsecret-1-0 sqlite3 libsqlite3-dev keybinder-3.0 network-manager mpv libmpv-dev - name: Enable Linux Desktop run: flutter config --enable-linux-desktop - name: Flutter Doctor diff --git a/.github/workflows/flutter-test.yml b/.github/workflows/flutter-test.yml index d1f8a9255..08401d461 100644 --- a/.github/workflows/flutter-test.yml +++ b/.github/workflows/flutter-test.yml @@ -13,7 +13,7 @@ jobs: - name: Update apt-get run: sudo apt-get update - name: Install libraries - run: sudo apt-get install network-manager + run: sudo apt-get install network-manager mpv libmpv-dev - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c7a71844..7d4dc7ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added: +- Audio playback on Linux + +## [0.8.330] - 2023-04-24 ### Changed: - Sync assistant styling - Upgraded dependencies diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c098df364..59b19b67f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,6 +1,4 @@ PODS: - - audio_session (0.0.1): - - Flutter - connectivity_plus (0.0.1): - Flutter - ReachabilitySwift @@ -33,8 +31,6 @@ PODS: - Flutter - integration_test (0.0.1): - Flutter - - just_audio (0.0.1): - - Flutter - libwebp (1.2.4): - libwebp/demux (= 1.2.4) - libwebp/mux (= 1.2.4) @@ -49,6 +45,10 @@ PODS: - Mantle (2.2.0): - Mantle/extobjc (= 2.2.0) - Mantle/extobjc (2.2.0) + - media_kit_libs_ios_audio (1.0.4): + - Flutter + - media_kit_native_event_loop (1.0.0): + - Flutter - MTBBarcodeScanner (5.0.11) - package_info_plus (0.4.5): - Flutter @@ -103,7 +103,6 @@ PODS: - Flutter DEPENDENCIES: - - audio_session (from `.symlinks/plugins/audio_session/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) @@ -117,8 +116,9 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - health (from `.symlinks/plugins/health/ios`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - - just_audio (from `.symlinks/plugins/just_audio/ios`) - location (from `.symlinks/plugins/location/ios`) + - media_kit_libs_ios_audio (from `.symlinks/plugins/media_kit_libs_ios_audio/ios`) + - media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - pasteboard (from `.symlinks/plugins/pasteboard/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) @@ -145,8 +145,6 @@ SPEC REPOS: - sqlite3 EXTERNAL SOURCES: - audio_session: - :path: ".symlinks/plugins/audio_session/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" device_info_plus: @@ -173,10 +171,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/health/ios" integration_test: :path: ".symlinks/plugins/integration_test/ios" - just_audio: - :path: ".symlinks/plugins/just_audio/ios" location: :path: ".symlinks/plugins/location/ios" + media_kit_libs_ios_audio: + :path: ".symlinks/plugins/media_kit_libs_ios_audio/ios" + media_kit_native_event_loop: + :path: ".symlinks/plugins/media_kit_native_event_loop/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" pasteboard: @@ -205,7 +205,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/video_player_avfoundation/ios" SPEC CHECKSUMS: - audio_session: 4f3e461722055d21515cf3261b64c973c062f345 connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 @@ -220,10 +219,11 @@ SPEC CHECKSUMS: FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a health: 5a380c0f6c4f619535845992993964293962e99e integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 - just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d + media_kit_libs_ios_audio: 54c8c3556addbc15f3e8100306f5fa866c1233ab + media_kit_native_event_loop: 4aee6fad741e020d6935e204b8b1388bbd68beeb MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e pasteboard: 982969ebaa7c78af3e6cc7761e8f5e77565d9ce0 diff --git a/lib/blocs/audio/player_cubit.dart b/lib/blocs/audio/player_cubit.dart index 846d4bb7d..3eeee6d7b 100644 --- a/lib/blocs/audio/player_cubit.dart +++ b/lib/blocs/audio/player_cubit.dart @@ -1,11 +1,11 @@ import 'package:bloc/bloc.dart'; -import 'package:just_audio/just_audio.dart'; import 'package:lotti/blocs/audio/player_state.dart'; import 'package:lotti/classes/journal_entities.dart'; import 'package:lotti/database/logging_db.dart'; import 'package:lotti/get_it.dart'; import 'package:lotti/utils/audio_utils.dart'; import 'package:lotti/widgets/journal/entry_tools.dart'; +import 'package:media_kit/media_kit.dart'; class AudioPlayerCubit extends Cubit { AudioPlayerCubit() @@ -18,15 +18,10 @@ class AudioPlayerCubit extends Cubit { speed: 1, ), ) { - _audioPlayer.positionStream.listen(updateProgress); - _audioPlayer.playbackEventStream.listen((event) { - if (event.processingState == ProcessingState.completed) { - stopPlay(); - } - }); + _audioPlayer.streams.position.listen(updateProgress); } - final AudioPlayer _audioPlayer = AudioPlayer(); + final Player _audioPlayer = Player(); final LoggingDb _loggingDb = getIt(); void updateProgress(Duration duration) { @@ -49,11 +44,9 @@ class AudioPlayerCubit extends Cubit { audioNote: audioNote, ); emit(newState); - - final totalDuration = await _audioPlayer.setFilePath(localPath); - if (totalDuration != null) { - emit(newState.copyWith(totalDuration: totalDuration)); - } + await _audioPlayer.open(Media(localPath)); + final totalDuration = _audioPlayer.state.duration; + emit(newState.copyWith(totalDuration: totalDuration)); } catch (exception, stackTrace) { _loggingDb.captureException( exception, @@ -65,7 +58,7 @@ class AudioPlayerCubit extends Cubit { Future play() async { try { - await _audioPlayer.setSpeed(state.speed); + await _audioPlayer.setRate(state.speed); await _audioPlayer.play(); await _audioPlayer.seek(state.pausedAt); emit(state.copyWith(status: AudioPlayerStatus.playing)); @@ -80,7 +73,8 @@ class AudioPlayerCubit extends Cubit { Future stopPlay() async { try { - await _audioPlayer.stop(); + await _audioPlayer.pause(); + await _audioPlayer.seek(Duration.zero); emit( state.copyWith( status: AudioPlayerStatus.stopped, @@ -116,7 +110,7 @@ class AudioPlayerCubit extends Cubit { Future setSpeed(double speed) async { try { - await _audioPlayer.setSpeed(speed); + await _audioPlayer.setRate(speed); emit(state.copyWith(speed: speed)); } catch (exception, stackTrace) { _loggingDb.captureException( diff --git a/lib/main.dart b/lib/main.dart index 67941e4f1..59c63914e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,12 +11,14 @@ import 'package:lotti/database/settings_db.dart'; import 'package:lotti/get_it.dart'; import 'package:lotti/services/window_service.dart'; import 'package:lotti/sync/secure_storage.dart'; +import 'package:media_kit/media_kit.dart'; import 'package:path_provider/path_provider.dart'; import 'package:timezone/data/latest.dart' as tz; import 'package:window_manager/window_manager.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); + MediaKit.ensureInitialized(); if (Platform.isMacOS) { await windowManager.ensureInitialized(); diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 3c0d43bed..3330f07ad 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) hotkey_manager_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "HotkeyManagerPlugin"); hotkey_manager_plugin_register_with_registrar(hotkey_manager_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) pasteboard_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); pasteboard_plugin_register_with_registrar(pasteboard_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 394268df9..66d09b3f2 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color flutter_secure_storage_linux hotkey_manager + media_kit_libs_linux pasteboard record_linux screen_retriever @@ -15,6 +16,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8d325c7a3..4b3d13f70 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,7 +5,6 @@ import FlutterMacOS import Foundation -import audio_session import connectivity_plus import device_info_plus import dynamic_color @@ -13,9 +12,9 @@ import flutter_local_notifications import flutter_native_timezone import flutter_secure_storage_macos import hotkey_manager -import just_audio import location import macos_ui +import media_kit_libs_macos_audio import package_info_plus import pasteboard import path_provider_foundation @@ -30,7 +29,6 @@ import url_launcher_macos import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) @@ -38,9 +36,9 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterNativeTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterNativeTimezonePlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) HotkeyManagerPlugin.register(with: registry.registrar(forPlugin: "HotkeyManagerPlugin")) - JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin")) + MediaKitLibsMacosAudioPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosAudioPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/macos/Podfile b/macos/Podfile index 1198f6ede..03bd6bbdc 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 2d134ae71..23c6bf400 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,6 +1,4 @@ PODS: - - audio_session (0.0.1): - - FlutterMacOS - connectivity_plus (0.0.1): - FlutterMacOS - ReachabilitySwift @@ -22,12 +20,14 @@ PODS: - hotkey_manager (0.0.1): - FlutterMacOS - HotKey - - just_audio (0.0.1): - - FlutterMacOS - location (0.0.1): - FlutterMacOS - macos_ui (0.1.0): - FlutterMacOS + - media_kit_libs_macos_audio (1.0.4): + - FlutterMacOS + - media_kit_native_event_loop (1.0.0): + - FlutterMacOS - package_info_plus (0.0.1): - FlutterMacOS - pasteboard (0.0.1): @@ -72,7 +72,6 @@ PODS: - FlutterMacOS DEPENDENCIES: - - audio_session (from `Flutter/ephemeral/.symlinks/plugins/audio_session/macos`) - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`) @@ -81,9 +80,10 @@ DEPENDENCIES: - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - hotkey_manager (from `Flutter/ephemeral/.symlinks/plugins/hotkey_manager/macos`) - - just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`) - location (from `Flutter/ephemeral/.symlinks/plugins/location/macos`) - macos_ui (from `Flutter/ephemeral/.symlinks/plugins/macos_ui/macos`) + - media_kit_libs_macos_audio (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_audio/macos`) + - media_kit_native_event_loop (from `Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - pasteboard (from `Flutter/ephemeral/.symlinks/plugins/pasteboard/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) @@ -105,8 +105,6 @@ SPEC REPOS: - sqlite3 EXTERNAL SOURCES: - audio_session: - :path: Flutter/ephemeral/.symlinks/plugins/audio_session/macos connectivity_plus: :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos device_info_plus: @@ -123,12 +121,14 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral hotkey_manager: :path: Flutter/ephemeral/.symlinks/plugins/hotkey_manager/macos - just_audio: - :path: Flutter/ephemeral/.symlinks/plugins/just_audio/macos location: :path: Flutter/ephemeral/.symlinks/plugins/location/macos macos_ui: :path: Flutter/ephemeral/.symlinks/plugins/macos_ui/macos + media_kit_libs_macos_audio: + :path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_audio/macos + media_kit_native_event_loop: + :path: Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos pasteboard: @@ -155,7 +155,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos SPEC CHECKSUMS: - audio_session: dea1f41890dbf1718f04a56f1d6150fd50039b72 connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f @@ -166,9 +165,10 @@ SPEC CHECKSUMS: FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a HotKey: ad59450195936c10992438c4210f673de5aee43e hotkey_manager: ad673457691f4d39e481be04a61da2ae07d81c62 - just_audio: 9b67ca7b97c61cfc9784ea23cd8cc55eb226d489 location: 7cdb0665bd6577d382b0a343acdadbcb7f964775 macos_ui: 6229a8922cd97bafb7d9636c8eb8dfb0744183ca + media_kit_libs_macos_audio: f4a889541a2317614c98d2ad3f08e358accaa39b + media_kit_native_event_loop: 81f3d1888a9bd283e5416276fd5716aa331d1751 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce pasteboard: 9b69dba6fedbb04866be632205d532fe2f6b1d99 path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 @@ -184,6 +184,6 @@ SPEC CHECKSUMS: url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 -PODFILE CHECKSUM: 9323785527ecef788ef9f2b3408155b4bb242a79 +PODFILE CHECKSUM: 0d353b18ff12f5d7cf17ff0e726ed751fc815029 COCOAPODS: 1.12.0 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index a9b666937..dd182fc65 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -428,7 +428,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = com.matthiasnehlsen.lotti.profile; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -559,7 +559,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = com.matthiasn.lotti.dev; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -584,7 +584,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = com.matthiasnehlsen.lotti; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; diff --git a/pubspec.lock b/pubspec.lock index cbc77cf2a..4f3c1dad3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -97,14 +97,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.10.0" - audio_session: - dependency: transitive - description: - name: audio_session - sha256: e4acc4e9eaa32436dfc5d7aed7f0a370f2d7bb27ee27de30d6c4f220c2a05c73 - url: "https://pub.dev" - source: hosted - version: "0.1.13" audio_video_progress_bar: dependency: "direct main" description: @@ -1183,30 +1175,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.6.1" - just_audio: - dependency: "direct main" - description: - name: just_audio - sha256: "7e6d31508dacd01a066e3889caf6282e5f1eb60707c230203b21a83af5c55586" - url: "https://pub.dev" - source: hosted - version: "0.9.32" - just_audio_platform_interface: - dependency: transitive - description: - name: just_audio_platform_interface - sha256: eff112d5138bea3ba544b6338b1e0537a32b5e1425e4d0dc38f732771cda7c84 - url: "https://pub.dev" - source: hosted - version: "4.2.0" - just_audio_web: - dependency: transitive - description: - name: just_audio_web - sha256: "89d8db6f19f3821bb6bf908c4bfb846079afb2ab575b783d781a6bf119e3abaf" - url: "https://pub.dev" - source: hosted - version: "0.4.7" latlong2: dependency: "direct main" description: @@ -1327,6 +1295,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + media_kit: + dependency: "direct main" + description: + name: media_kit + sha256: "47292aae58bb0b118b7097d3aba1db86807b5ea8ecf056f1a2493663b801ff29" + url: "https://pub.dev" + source: hosted + version: "0.0.6" + media_kit_libs_android_audio: + dependency: "direct main" + description: + name: media_kit_libs_android_audio + sha256: a2a9f0a5eda7d4ace1c7a4260654cc46a82c3d5387fe89904bbdf3bd0f7f5d45 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + media_kit_libs_ios_audio: + dependency: "direct main" + description: + name: media_kit_libs_ios_audio + sha256: bb18ed87e8a155fc1d2ee4bf59462ca04d02a0eeb38d0b454facee6d32441ce7 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + media_kit_libs_linux: + dependency: "direct main" + description: + name: media_kit_libs_linux + sha256: "21acc71cbae3518b3aeef9023a6a3a3decb579a40153764333814987ccd61040" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + media_kit_libs_macos_audio: + dependency: "direct main" + description: + name: media_kit_libs_macos_audio + sha256: "86b0c9d7d81a87958a302c323c0c645613d455c8ed4454116e5f89afb151b0e1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + media_kit_libs_windows_audio: + dependency: "direct main" + description: + name: media_kit_libs_windows_audio + sha256: f6ad5a1b910a6748a7350360756cd99a718fc9661a9583a7fd86a308d068dd81 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + media_kit_native_event_loop: + dependency: "direct main" + description: + name: media_kit_native_event_loop + sha256: ed87140ad4b64156b2b470c8105f48d8cad7923c952ca05d23e02d28978d2cb3 + url: "https://pub.dev" + source: hosted + version: "1.0.3" meta: dependency: transitive description: @@ -1817,6 +1841,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" screen_retriever: dependency: transitive description: @@ -2206,6 +2238,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.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: diff --git a/pubspec.yaml b/pubspec.yaml index 298c3cd16..0a61eb863 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: lotti description: Achieve your goals and keep your data private with Lotti. publish_to: 'none' -version: 0.9.330+2032 +version: 0.9.331+2037 msix_config: display_name: LottiApp @@ -98,11 +98,17 @@ dependencies: intl: ^0.18.0 jiffy: ^6.1.0 json_annotation: ^4.6.0 - just_audio: ^0.9.12 latlong2: ^0.8.1 location: ^4.3.0 lottie: ^2.2.0 material_design_icons_flutter: ^6.0.7096 + media_kit: ^0.0.6 + media_kit_libs_android_audio: ^1.0.0 + media_kit_libs_ios_audio: ^1.0.4 + media_kit_libs_linux: ^1.0.2 + media_kit_libs_macos_audio: ^1.0.4 + media_kit_libs_windows_audio: ^1.0.3 + media_kit_native_event_loop: ^1.0.3 multi_select_flutter: ^4.0.0 package_info_plus: ^3.1.0 path: ^1.8.1 diff --git a/test/pages/dashboards/dashboard_page_test.dart b/test/pages/dashboards/dashboard_page_test.dart index 93ad456d9..1ad9e7076 100644 --- a/test/pages/dashboards/dashboard_page_test.dart +++ b/test/pages/dashboards/dashboard_page_test.dart @@ -18,6 +18,7 @@ import 'package:mocktail/mocktail.dart'; import '../../mocks/mocks.dart'; import '../../test_data/test_data.dart'; +import '../../utils/utils.dart'; import '../../widget_test_utils.dart'; void main() { @@ -29,6 +30,7 @@ void main() { group('DashboardPage Widget Tests - ', () { setUpAll(() { registerFallbackValue(FakeMeasurementData()); + ensureMpvInitialized(); }); setUp(() { diff --git a/test/pages/journal/infinite_journal_page_test.dart b/test/pages/journal/infinite_journal_page_test.dart index 42a285e1f..0ff310282 100644 --- a/test/pages/journal/infinite_journal_page_test.dart +++ b/test/pages/journal/infinite_journal_page_test.dart @@ -27,6 +27,7 @@ import 'package:path_provider/path_provider.dart'; import '../../helpers/path_provider.dart'; import '../../mocks/mocks.dart'; import '../../test_data/test_data.dart'; +import '../../utils/utils.dart'; import '../../widget_test_utils.dart'; void main() { @@ -41,6 +42,7 @@ void main() { group('JournalPage Widget Tests - ', () { setUpAll(() { setFakeDocumentsPath(); + ensureMpvInitialized(); registerFallbackValue(FakeMeasurementData()); }); diff --git a/test/utils/utils.dart b/test/utils/utils.dart new file mode 100644 index 000000000..b2fe423b6 --- /dev/null +++ b/test/utils/utils.dart @@ -0,0 +1,11 @@ +import 'package:lotti/utils/platform.dart'; +import 'package:media_kit/src/libmpv/core/native_library.dart'; + +void ensureMpvInitialized() { + if (isMacOS) { + NativeLibrary.ensureInitialized(libmpv: '/opt/homebrew/bin/mpv'); + } + if (isLinux || isWindows) { + NativeLibrary.ensureInitialized(); + } +} diff --git a/test/widgets/journal/journal_card_test.dart b/test/widgets/journal/journal_card_test.dart index a54acc4aa..db50a58f7 100644 --- a/test/widgets/journal/journal_card_test.dart +++ b/test/widgets/journal/journal_card_test.dart @@ -19,17 +19,19 @@ import 'package:path_provider/path_provider.dart'; import '../../helpers/path_provider.dart'; import '../../mocks/mocks.dart'; import '../../test_data/test_data.dart'; +import '../../utils/utils.dart'; import '../../widget_test_utils.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - var mockJournalDb = MockJournalDb(); group('JournalCard Widget Tests - ', () { setFakeDocumentsPath(); setUp(() async { + ensureMpvInitialized(); + mockJournalDb = mockJournalDbWithMeasurableTypes([ measurableWater, measurableChocolate, diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 281705a8e..7a9695811 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); HotkeyManagerPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("HotkeyManagerPlugin")); + MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("MediaKitLibsWindowsAudioPluginCApi")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3833fa2e8..549042f9b 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color flutter_secure_storage_windows hotkey_manager + media_kit_libs_windows_audio pasteboard permission_handler_windows record_windows @@ -18,6 +19,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + media_kit_native_event_loop ) set(PLUGIN_BUNDLED_LIBRARIES)