Merge pull request #2157 from ShadowIce/1264-Playback-position-regularly-moves-back-to-pre-last-position-after-pause

Prepare media on app start/resume and not on playback start
This commit is contained in:
Martin Fietz 2016-10-16 13:58:15 +02:00 committed by GitHub
commit 3c10fb119a
2 changed files with 4 additions and 1 deletions

View File

@ -383,6 +383,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
statusBeforeSeeking = playerStatus;
setPlayerStatus(PlayerStatus.SEEKING, media, getPosition());
mediaPlayer.seekTo(t);
if (statusBeforeSeeking == PlayerStatus.PREPARED) {
media.setPosition(t);
}
try {
seekLatch.await(3, TimeUnit.SECONDS);
} catch (InterruptedException e) {

View File

@ -216,7 +216,7 @@ public abstract class PlaybackController {
Intent serviceIntent = new Intent(activity, PlaybackService.class);
serviceIntent.putExtra(PlaybackService.EXTRA_PLAYABLE, media);
serviceIntent.putExtra(PlaybackService.EXTRA_START_WHEN_PREPARED, false);
serviceIntent.putExtra(PlaybackService.EXTRA_PREPARE_IMMEDIATELY, false);
serviceIntent.putExtra(PlaybackService.EXTRA_PREPARE_IMMEDIATELY, true);
boolean fileExists = media.localFileAvailable();
boolean lastIsStream = PlaybackPreferences.getCurrentEpisodeIsStream();
if (!fileExists && !lastIsStream && media instanceof FeedMedia) {