- Skipping an episode did not work
- pauseOnHeadsetDisconnect preference was not updated correctly
This commit is contained in:
daniel oeh 2014-02-11 18:57:19 +01:00
parent ff285c5ad5
commit 8e05212c75
3 changed files with 25 additions and 10 deletions

View File

@ -319,7 +319,9 @@ public class UserPreferences implements
PREF_PLAYBACK_SPEED_ARRAY, null));
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
}
} else if (key.equals(PREF_PAUSE_ON_HEADSET_DISCONNECT)) {
pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
}
}
public static void setPlaybackSpeed(String speed) {

View File

@ -899,7 +899,7 @@ public class PlaybackService extends Service {
intent.getAction().equals(ACTION_SKIP_CURRENT_EPISODE)) {
if (AppConfig.DEBUG)
Log.d(TAG, "Received SKIP_CURRENT_EPISODE intent");
endPlayback(true);
mediaPlayer.endPlayback();
}
}
};

View File

@ -737,6 +737,26 @@ public class PlaybackServiceMediaPlayer {
}
};
public void endPlayback() {
executor.submit(new Runnable() {
@Override
public void run() {
playerLock.lock();
if (playerStatus != PlayerStatus.INDETERMINATE) {
setPlayerStatus(PlayerStatus.INDETERMINATE, media);
}
if (mediaPlayer != null) {
mediaPlayer.reset();
}
callback.endPlayback(true);
playerLock.unlock();
}
});
}
/**
* Holds information about a PSMP object.
*/
@ -808,14 +828,7 @@ public class PlaybackServiceMediaPlayer {
};
private void genericOnCompletion() {
executor.submit(new Runnable() {
@Override
public void run() {
audioManager.abandonAudioFocus(audioFocusChangeListener);
callback.endPlayback(true);
}
});
endPlayback();
}
private final com.aocate.media.MediaPlayer.OnBufferingUpdateListener audioBufferingUpdateListener = new com.aocate.media.MediaPlayer.OnBufferingUpdateListener() {