App music continues to play (with choppy audio) in iOS 13.2, 13.3, and 13.5 simulators when app is put into background
See original GitHub issueI don’t currently have a real iOS device to test on, so I haven’t yet confirmed whether this affects real devices as well. If anyone reading this issue is able to test, I’d appreciate the confirmation.
Issue details
When running a libgdx app in the iOS 13.3 simulator: If the app has music playing and you swipe the app to the background, the music unexpectedly continues to play and sounds very choppy. This problem exists for brand new, minimally-configured libgdx apps. Please see the “Reproduction steps/code” section for more info.
I’m using Eclipse with the RoboVM plugin to run the app, and this error message appears when the app is sent to the background:
2020-05-14 11:46:37.815 IOSLauncher[91140:2360202] Can't end BackgroundTask: no background task exists with identifier 1 (0x1), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
And then when you bring it to the foreground and send it to the background again:
2020-05-14 11:47:09.100 IOSLauncher[91140:2360202] Can't end BackgroundTask: no background task exists with identifier 4 (0x4), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
This background music behavior didn’t exist in the past (e.g. testing on iOS 11.3). Normally, putting the app in the background silenced any playing music.
Reproduction steps/code
- Create new app using latest gdx-setup.jar (as of this writing, 2020-05-14)
- Import into Eclipse
- Install version 2.3.9 of the RoboVM plugin for Eclipse (because it seems that you can’t build/run for the iOS 13 simulator with earlier releases)
- Add an mp3 file called “music.mp3” at
android/assets/music.mp3
- Update the
create()
method incore/src/com/mygdx/game/MyGdxGame.java
(or wherever your app entry point is – the class that extends ApplicationAdapter) so it looks like this:
public void create () {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
music = Gdx.audio.newMusic(Gdx.files.internal("music.mp3"));
music.setLooping(true);
music.play();
}
- Run the game via RoboVM Eclipse plugin Run Configuration, selecting project
my-gdx-game-ios
, device typeiPhone 11 ..., 13.3
and arch64-bit (x86_64)
.
One thing to note, for the above instructions, is that the current gdx-setup.jar creates an app with a top level build.gradle robovm version of 2.3.8. You can leave that version as is or update to 2.3.9, but it doesn’t change the problem I’m describing. Both cases build for the iOS 13 simulator as long as your RoboVM Eclipse plugin is 2.3.9.
Version of LibGDX and/or relevant dependencies
Tested with:
- libgdx 1.9.8 and 1.9.10
- RoboVM 2.3.9 Eclipse plugin
- Gradle RoboVM version of 2.3.8 or 2.3.9 (but Eclipse plugin must be 2.3.9)
- iOS Simulator - iPhone 11 with iOS 13.2 or 13.3
- Xcode 11.3.1
Stacktrace
No relevant stacktrace.
Please select the affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
@MrStahlfelge Yes, I’ll close now.
If you want to follow up on the issue it is you who should run those tests 😃