Fix sometimes stopping at the end of each episode (#6753)

The bug is on this line [#145](f7a13065a9/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java (L145)) - the call to `PlaybackPreferences.getCurrentlyPlayingFeedMediaId()` returns the episode that was playing and deleted, hence it stops playing the next episode like it is supposed to.  Because it's called in a Thread, the next episode already started playing for 1 second or so and then stops

The fix will now save into the preference the correct episode that is playing on the PREPARE stage.
This commit is contained in:
Tony Tam 2023-11-11 01:55:01 -08:00 committed by GitHub
parent 8af06a9f25
commit 7bfb53cc00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -799,6 +799,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
updateNotificationAndMediaSession(newInfo.playable); updateNotificationAndMediaSession(newInfo.playable);
break; break;
case PREPARED: case PREPARED:
if (mediaPlayer.getPSMPInfo().playable != null) {
PlaybackPreferences.writeMediaPlaying(mediaPlayer.getPSMPInfo().playable,
mediaPlayer.getPSMPInfo().playerStatus);
}
taskManager.startChapterLoader(newInfo.playable); taskManager.startChapterLoader(newInfo.playable);
break; break;
case PAUSED: case PAUSED: