Fix playback state not being updated (#7050)

This commit is contained in:
ByteHamster 2024-04-01 09:55:30 +02:00 committed by GitHub
parent edb440a5a9
commit a846e417b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -831,6 +831,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
break;
case PAUSED:
updateNotificationAndMediaSession(newInfo.playable);
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED);
if (!isCasting) {
stateManager.stopForeground(!UserPreferences.isPersistNotify());
}
@ -841,6 +842,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
//stopService();
break;
case PLAYING:
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING);
saveCurrentPosition(true, null, Playable.INVALID_TIME);
recreateMediaSessionIfNeeded();
updateNotificationAndMediaSession(newInfo.playable);

View File

@ -109,6 +109,10 @@ public abstract class PlaybackPreferences {
return prefs.getInt(PREF_CURRENT_PLAYER_STATUS, PLAYER_STATUS_OTHER);
}
public static void setCurrentPlayerStatus(int playerStatus) {
prefs.edit().putInt(PREF_CURRENT_PLAYER_STATUS, playerStatus).apply();
}
public static float getCurrentlyPlayingTemporaryPlaybackSpeed() {
return prefs.getFloat(PREF_CURRENTLY_PLAYING_TEMPORARY_PLAYBACK_SPEED, FeedPreferences.SPEED_USE_GLOBAL);
}