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

[IOS] play() not completing when stop() is called #1297

Closed
DominicOrga opened this issue Jul 29, 2024 · 3 comments · Fixed by #1339
Closed

[IOS] play() not completing when stop() is called #1297

DominicOrga opened this issue Jul 29, 2024 · 3 comments · Fixed by #1339
Assignees
Labels
1 backlog bug Something isn't working

Comments

@DominicOrga
Copy link

Which API doesn't behave as documented, and how does it misbehave?
On IOS, awaiting the AudioPlayer.play() method does not end when AudioPlayer.stop() is called.

Minimal reproduction project
https://github.com/DominicOrga/bug_report_just_audio

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run the sample project.
  2. Press the Play audio button and wait for the audio to start playing.
  3. Press the Stop audio button.
  4. Notice that the AudioPlayer.play() completed logs is not being printed on IOS.

IOS Logs:

flutter: AudioPlayer.playerState: playing=false,processingState=ProcessingState.loading
flutter: AudioPlayer.playerState: playing=false,processingState=ProcessingState.buffering
flutter: AudioPlayer.play() call
flutter: AudioPlayer.playerState: playing=true,processingState=ProcessingState.buffering
flutter: AudioPlayer.playerState: playing=true,processingState=ProcessingState.ready
flutter: AudioPlayer.playerState: playing=true,processingState=ProcessingState.buffering
flutter: AudioPlayer.playerState: playing=true,processingState=ProcessingState.ready
flutter: AudioPlayer.stop() call
flutter: AudioPlayer.stop() completed
flutter: AudioPlayer.playerState: playing=false,processingState=ProcessingState.ready
flutter: AudioPlayer.playerState: playing=false,processingState=ProcessingState.idle

Android Logs:

AudioPlayer.playerState: playing=false,processingState=ProcessingState.loading
AudioPlayer.playerState: playing=false,processingState=ProcessingState.ready
AudioPlayer.play() call
AudioPlayer.playerState: playing=true,processingState=ProcessingState.ready
AudioPlayer.stop() call
AudioPlayer.stop() completed
AudioPlayer.playerState: playing=false,processingState=ProcessingState.ready
AudioPlayer.play() completed # This is not being called on IOS.
AudioPlayer.playerState: playing=false,processingState=ProcessingState.idle

Expected behavior
The behavior should be similar to Android, wherein the AudioPlayer.play() method should end whenever AudioPlayer.stop() is called.

Smartphone:

  • Device: iPhone 13 mini

  • OS: 17.5.1

  • Device: Google Pixel 8

  • OS: 14

Flutter SDK version

[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale en-PH)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.91.1)
[✓] Connected device (5 available)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the
      same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!
@ryanheise
Copy link
Owner

I've made a PR to fix this: #1339

Can you please test and let me know if it addresses your issue?

@ryanheise
Copy link
Owner

The fix has been merged and released.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants