Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(darwin): Start observing AVPlayerItem.status before being assigned to AVPlayer #1549

Merged
merged 27 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
83ff794
fix: start observing `AVPlayerItem.status` before setting it on `AVPl…
blaugold Jun 17, 2023
257a6a7
Remove debug print
blaugold Jun 17, 2023
aa9449c
Fix spelling
blaugold Jun 19, 2023
d8ff1a7
Merge branch 'main' into fix/player-item-status
Gustl22 Jul 28, 2023
711fe1f
chore: update darwin dependencies
Gustl22 Jul 28, 2023
58b1868
refactor(darwin): cast maps
Gustl22 Jul 28, 2023
47388e8
refactor: format
Gustl22 Jul 28, 2023
b4eb212
refactor: rearrange methods
Gustl22 Jul 28, 2023
f2ba251
refactor: releaseSync to release
Gustl22 Jul 28, 2023
b11351a
reafactor(darwin): create player item as own method
Gustl22 Jul 28, 2023
20657c7
refactor(darwin): setUpPlayerItemStatusObservation as own method
Gustl22 Jul 28, 2023
f922ed5
refactor(darwin): setUpPositionObserver as own method
Gustl22 Jul 28, 2023
fda9f4d
refactor(darwin): setUpSoundCompletedObserver
blaugold Jul 28, 2023
51b49e7
Merge branch 'gustl22/darwin-refactor' into fix/player-item-status
Gustl22 Jul 28, 2023
dabf06f
Merge branch 'fix/player-item-status' of https://github.com/blaugold/…
Gustl22 Jul 28, 2023
ba4d121
Merge remote-tracking branch 'upstream/main' into fix/player-item-status
Gustl22 Aug 1, 2023
d4b2812
Merge branch 'main' into fix/player-item-status
Gustl22 Sep 9, 2023
3403df8
swift-format
Gustl22 Sep 9, 2023
c79df69
Merge remote-tracking branch 'upstream/main' into fix/player-item-status
Gustl22 Sep 23, 2023
69b347c
avoid catching unknown errors
Gustl22 Sep 23, 2023
2634da6
remove log
Gustl22 Sep 23, 2023
52de571
darwin: simplify assignment
Gustl22 Sep 23, 2023
00d0285
darwin: observer improvements
Gustl22 Sep 23, 2023
67478d4
darwin: Make player not nullable
Gustl22 Sep 24, 2023
2c62ba7
recreate ios folder
Gustl22 Sep 25, 2023
9429b76
recreate macos folder
Gustl22 Sep 25, 2023
98c04b6
Merge branch 'main' into fix/player-item-status
Gustl22 Sep 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/audioplayers/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)

SPEC REPOS:
trunk:
Expand All @@ -70,19 +70,19 @@ EXTERNAL SOURCES:
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"

SPEC CHECKSUMS:
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
integration_test: 13825b8a9334a850581300559b8839134b124670
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
8 changes: 4 additions & 4 deletions packages/audioplayers/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ PODS:
DEPENDENCIES:
- audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)

EXTERNAL SOURCES:
audioplayers_darwin:
:path: Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos
FlutterMacOS:
:path: Flutter/ephemeral
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin

SPEC CHECKSUMS:
audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
9 changes: 6 additions & 3 deletions packages/audioplayers/lib/src/audioplayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ class AudioPlayer {
}
},
);
await fun();
await preparedCompleter.future.timeout(const Duration(seconds: 30));
onPreparedSubscription.cancel();
try {
await fun();
await preparedCompleter.future.timeout(const Duration(seconds: 30));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not the right way here: we should avoid catching any error and instead try to not emit the prepared more than once or reinitialize the onPreparedCompleter.

} finally {
onPreparedSubscription.cancel();
}
}

/// Sets the URL to a remote link.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,19 @@ class AudioPlayersStreamHandler: NSObject, FlutterStreamHandler {

func onCurrentPosition(millis: Int) {
if let eventSink = self.sink {
eventSink(["event": "audio.onCurrentPosition", "value": millis])
eventSink(["event": "audio.onCurrentPosition", "value": millis] as [String : Any])
}
}

func onDuration(millis: Int) {
if let eventSink = self.sink {
eventSink(["event": "audio.onDuration", "value": millis])
eventSink(["event": "audio.onDuration", "value": millis] as [String : Any])
}
}

func onPrepared(isPrepared: Bool) {
if let eventSink = self.sink {
eventSink(["event": "audio.onPrepared", "value": isPrepared])
eventSink(["event": "audio.onPrepared", "value": isPrepared] as [String : Any])
}
}

Expand Down
Loading