diff --git a/Makefile b/Makefile index 9f8570d..85f1847 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ proto: protoc -I protobuf/ --dart_out=lib/pb protobuf/stillbox.proto google/protobuf/timestamp.proto +patch: + dart run patch_package apply diff --git a/patches/just_audio_media_kit.patch b/patches/just_audio_media_kit.patch new file mode 100644 index 0000000..07f226d --- /dev/null +++ b/patches/just_audio_media_kit.patch @@ -0,0 +1,35 @@ +diff -ruN /tmp/just_audio_media_kit/lib/mediakit_player.dart /home/dponte/.pub-cache/hosted/pub.dev/just_audio_media_kit-2.0.5/lib/mediakit_player.dart +--- /tmp/just_audio_media_kit/lib/mediakit_player.dart 2024-08-14 15:47:51.698551487 -0400 ++++ /home/dponte/.pub-cache/hosted/pub.dev/just_audio_media_kit-2.0.5/lib/mediakit_player.dart 2024-08-14 15:48:02.401944337 -0400 +@@ -35,8 +35,11 @@ + /// [LoadRequest.initialPosition] or [seek] request before [Player.play] was called and/or finished loading. + Duration? _setPosition; + +- Media get _currentMedia => +- _player.state.playlist.medias[_player.state.playlist.index]; ++ Media? get _currentMedia { ++ var medias = _player.state.playlist.medias; ++ if (medias.isEmpty) return null; ++ return medias[_player.state.playlist.index]; ++ } + + MediaKitPlayer(super.id) { + _player = Player( +@@ -57,7 +60,7 @@ + + _streamSubscriptions = [ + _player.stream.duration.listen((duration) { +- if (_currentMedia.extras?['overrideDuration'] != null) return; ++ if (_currentMedia?.extras?['overrideDuration'] != null) return; + + _processingState = ProcessingStateMessage.ready; + if (_setPosition != null && duration.inSeconds > 0) { +@@ -111,7 +114,7 @@ + _currentIndex = playlist.index; + } + _updatePlaybackEvent( +- duration: _currentMedia.extras?['overrideDuration']); ++ duration: _currentMedia?.extras?['overrideDuration']); + }), + _player.stream.playlistMode.listen((playlistMode) { + _dataController.add( diff --git a/pubspec.lock b/pubspec.lock index eb23829..298c4c5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -110,14 +110,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" - flutter_patch_package: - dependency: "direct main" - description: - name: flutter_patch_package - sha256: d24e953a5d223d53fded329e66c9037ddf3ea90f2ee85c730c4c846f287f4738 - url: "https://pub.dev" - source: hosted - version: "0.0.11" flutter_secure_storage: dependency: "direct main" description: @@ -352,6 +344,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + patch_package: + dependency: "direct main" + description: + name: patch_package + sha256: ade4baf6e726395435e1d74cfe035978cf089024663e479e80fbe6c9d94b90a3 + url: "https://pub.dev" + source: hosted + version: "0.0.8" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e85c377..7cb70bc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,7 +47,7 @@ dependencies: media_kit_libs_linux: any media_kit_libs_windows_audio: any media_kit_native_event_loop: ^1.0.8 - flutter_patch_package: '^0.0.11' + patch_package: ^0.0.8 dev_dependencies: flutter_test: