feat!: Add PlayingStateUpdate event#1995
Merged
Merged
Conversation
Gustl22
marked this pull request as draft
June 7, 2026 05:21
Gustl22
marked this pull request as ready for review
June 8, 2026 19:55
Gustl22
marked this pull request as draft
June 9, 2026 00:55
Gustl22
marked this pull request as ready for review
June 18, 2026 12:28
Gustl22
force-pushed
the
gustl22/playingStateUpdate
branch
2 times, most recently
from
July 9, 2026 06:51
62b3cb4 to
1e2ab4b
Compare
Gustl22
force-pushed
the
gustl22/playingStateUpdate
branch
2 times, most recently
from
July 20, 2026 22:23
5165bc0 to
76a33a7
Compare
Gustl22
force-pushed
the
gustl22/playingStateUpdate
branch
from
July 21, 2026 21:10
76a33a7 to
bc76ef5
Compare
Gustl22
commented
Jul 21, 2026
spydon
approved these changes
Jul 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new cross-platform playingStateUpdate event and wires it through Dart + all federated implementations so AudioPlayer can reflect externally-triggered play/pause changes and reliably await play/pause/stop transitions based on actual playback state.
Changes:
- Introduces
AudioEventType.playingStateUpdate(+isPlaying) and maps native events to it across platform implementations. - Updates
AudioPlayerto track “desired vs actual” state and wait for playing-state transitions with a timeout. - Adjusts unit + integration tests to account for the new event ordering and more deterministic state transitions.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/audioplayers/test/fake_audioplayers_platform.dart | Emits playingStateUpdate events in the fake platform for state-affecting calls. |
| packages/audioplayers/test/audioplayers_test.dart | Updates expectations for dispose/event ordering with the new playing-state behavior. |
| packages/audioplayers/test/audio_pool_test.dart | Awaits async stop to align with new stop semantics. |
| packages/audioplayers/lib/src/audioplayer.dart | Implements desired-vs-actual state tracking and awaits playing-state transitions. |
| packages/audioplayers/example/pubspec.yaml | Removes pub_semver dev dependency from example. |
| packages/audioplayers/example/integration_test/platform_test.dart | Simplifies platform test gating and removes old Flutter-version workaround. |
| packages/audioplayers/example/integration_test/lib_test.dart | Makes integration assertions more robust with updated state/position expectations; adds “call twice” tests. |
| packages/audioplayers_windows/windows/MediaEngineWrapper.h | Adds playing-state callback wiring in Windows media engine wrapper. |
| packages/audioplayers_windows/windows/MediaEngineWrapper.cpp | Emits audio.onPlayingStateUpdate on PLAYING/PAUSE media engine events. |
| packages/audioplayers_windows/windows/audio_player.h | Declares Windows OnPlayingStateUpdate handler. |
| packages/audioplayers_windows/windows/audio_player.cpp | Sends audio.onPlayingStateUpdate events over the Windows event channel. |
| packages/audioplayers_web/lib/wrapped_player.dart | Emits playingStateUpdate from HTML audio play/pause events. |
| packages/audioplayers_platform_interface/lib/src/audioplayers_platform.dart | Maps audio.onPlayingStateUpdate to the new AudioEventType. |
| packages/audioplayers_platform_interface/lib/src/api/audio_event.dart | Adds playingStateUpdate type and isPlaying field on AudioEvent. |
| packages/audioplayers_linux/linux/audio_player.h | Declares Linux OnPlayingStateUpdate. |
| packages/audioplayers_linux/linux/audio_player.cc | Emits audio.onPlayingStateUpdate on GStreamer paused/playing transitions. |
| packages/audioplayers_darwin/darwin/audioplayers_darwin/Sources/audioplayers_darwin/WrappedMediaPlayer.swift | Observes AVPlayer timeControlStatus to emit playing-state updates. |
| packages/audioplayers_darwin/darwin/audioplayers_darwin/Sources/audioplayers_darwin/AudioplayersDarwinPlugin.swift | Adds stream handler method to forward audio.onPlayingStateUpdate. |
| packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt | Adds Android callback entrypoint for playing-state updates. |
| packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/SoundPoolPlayer.kt | Emits playing-state updates for SoundPool actions. |
| packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/MediaPlayerWrapper.kt | Manually emits playing-state updates for MediaPlayer operations lacking suitable callbacks. |
| packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt | Sends audio.onPlayingStateUpdate events from Android plugin. |
| packages/audioplayers_android_exo/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt | Adds Exo callback entrypoint for playing-state updates. |
| packages/audioplayers_android_exo/android/src/main/kotlin/xyz/luan/audioplayers/player/ExoPlayerWrapper.kt | Hooks onIsPlayingChanged to emit playing-state updates. |
| packages/audioplayers_android_exo/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt | Sends audio.onPlayingStateUpdate events from Android Exo plugin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Gustl22
marked this pull request as draft
July 22, 2026 05:44
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Gustl22
marked this pull request as ready for review
July 22, 2026 05:49
Gustl22
enabled auto-merge (squash)
July 22, 2026 10:28
Sebastien-VZN
pushed a commit
to Sebastien-VZN/audioplayers
that referenced
this pull request
Jul 23, 2026
Commits marqués comme analyses et non portes: - 310304d ci: Upgrade CI Flutter version to v3.44.6 (bluefireteam#2014) — cosmétique CI - 244a4a0 ci: Support verbose debugging in tests (bluefireteam#2015) — cosmétique CI - 0b89829 test: Set timeouts for integration tests (bluefireteam#2016) — cosmétique tests - 6efd636 refactor: Handle common ReleaseMode.release logic in Dart (bluefireteam#2017) — redondant, deja gere nativement - fa6ec8e feat!: Add PlayingStateUpdate event (bluefireteam#1995) — over-engineering, 500 lignes pour rien - cd475c7 fix(windows): Crash Windows N Media Feature Pack (bluefireteam#2019) — try-catch global du fork couvre deja le cas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduce
PlayingStateUpdateevent. This has the following advantages:Checklist
fix:,feat:,refactor:,docs:,chore:,test:,ci:etc).///, where necessary.Breaking Change
Again, this is not a hard breaking change, but in this case, the behavior actually changes:
resume/playare waiting, until the playback actually has startedstop/pauseare waiting, until the playback actually stopsMigration instructions
Before:
After: