I have some rather large audio files that the regular Android player won’t play, so I switched to the OpenSL player even though I’m not using a Galaxy phone. I noticed a bug that probably applies to that device as well though. When I lock my phone’s screen, and then unlock it, any sound that has been played will play again. This is because the callback function that sets the play state to stopped is never called, which causes the sounds to pause when the screen is locked and then play when it is unlocked. While investigating, I noticed that the callback is registered in the recreatePlayer method, but that method is only called in playEffect if the effect is already playing. I switched the playEffect code to call recreatePlayer if the audio isn’t playing instead and the sounds paused and resumed correctly. However, looping stopped working. So I tried adding the code to register the callback to the preloadEffect method and that seemed to solve the issue of the effects not pausing, but now some of my audio files crash the app instead of playing. I have no knowledge of OpenSL so I’m hoping somebody here can help me figure out how to best ensure that all effects have the callback properly registered.
OpenSL engine bug?