Fixed crash when losing audio focus

This commit is contained in:
daniel oeh 2012-06-30 12:59:04 +02:00
parent b3c3e04fd9
commit 119892f6b5
1 changed files with 3 additions and 0 deletions

View File

@ -325,6 +325,9 @@ public class PlaybackService extends Service {
if (player.isPlaying()) { if (player.isPlaying()) {
Log.d(TAG, "Pausing playback."); Log.d(TAG, "Pausing playback.");
player.pause(); player.pause();
if (positionSaver != null) {
positionSaver.cancel(true);
}
saveCurrentPosition(); saveCurrentPosition();
setStatus(PlayerStatus.PAUSED); setStatus(PlayerStatus.PAUSED);
stopForeground(true); stopForeground(true);