Skip to content

Audio stops playing after switching audio output route while app is in background #2479

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

Open
lucycycy opened this issue Mar 26, 2025 · 1 comment
Labels
needs-confirm wontfix This will not be worked on

Comments

@lucycycy
Copy link

  • axmol version: 2.3.2
  • devices test on: iPhone
  • developing environments
    • Xcode version: 16.2
    • cmake version: 3.31.5

On iOS, if I play background music using AudioEngine::play2d, then send the app to the background and change the audio route (e.g., from speaker to headphones or vice versa), the audio does not resume when returning to the app.

In this situation, the following log message appears:

AURemoteIO.cpp:1666 AUIOClient_StartIO failed

Steps to Reproduce:

  1. Start playing audio using AudioEngine::play2d("bgm.mp3").
  2. Send the app to the background.
  3. Switch the audio output (e.g., plug in or unplug headphones).
  4. Return to the app.
    The background music is no longer audible.

Workaround:
If I comment out the following lines in AudioEngineImpl.cpp, the issue no longer occurs:
else if ([notification.name isEqualToString:AVAudioSessionRouteChangeNotification])
{ // replay
//// ccALPauseDevice();
//// ccALResumeDevice();
}

Copy link

stale bot commented May 30, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-confirm wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants