I'm hoping the Sony engineers will see this as advised in http://developer.sonymobile.com/about/how-do-i-get-in-contact/. :)
We have an app that plays audio content using a MediaPlayer instance retained by a Service. On all other manufacturer's devices we've tested with, things work as expected. However, with a range of Xperia devices we've received reports from users, and have observed ourselves, that the audio content will often cut off prematurely when the device is not connected to power. We're unsure of the reasons for this, and are not getting any clues from logcat, other than the following, which we're unsure about:
delay_us exceeds max timeout:59996570 us
and
Event 5 was not found in the queue, already cancelled?
Any ideas? We can provide more info if needed.
Many thanks.
EDIT
public class MyAudioPlayer extends Service {
private MediaPlayer mPlayer;
private void setupMediaPlayer() {
if (mPlayer != null) {
mPlayer.reset();
mPlayer.release();
}
mPlayer = new MediaPlayer();
mPlayer.setOnCompletionListener(completionListener);
mPlayer.setOnErrorListener(errorListener);
mPlayer.setVolume(100, 100);
}
void setupAudio(String path, int position, boolean shouldPlay, boolean updateWidgetsAndNotification) {
if (path == null || new File(path).exists() == false) {
Log.e(TAG, "File doesn't exist!!!");
}
if (mPlayer == null) {
setupMediaPlayer();
} else {
if (isPlaying()) {
mPlayer.stop();
}
mPlayer.reset();
}
try {
mPlayer.setDataSource(path);
mPlayer.prepare();
} catch (Exception e) {
Log.d("ERROR:", e.toString());
}
if (shouldPlay) {
mPlayer.start();
startForeground();
} else if (updateWidgetsAndNotification) {
updateWidgetsAndNotification();
}
}
}
I'm testing with an Xperia Z3, and some other team members are using other Xperia devices.
We've been sure to disable STAMINA mode.