Fix playback state not being updated (#7050)
This commit is contained in:
parent
edb440a5a9
commit
a846e417b0
|
@ -831,6 +831,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
break;
|
break;
|
||||||
case PAUSED:
|
case PAUSED:
|
||||||
updateNotificationAndMediaSession(newInfo.playable);
|
updateNotificationAndMediaSession(newInfo.playable);
|
||||||
|
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PAUSED);
|
||||||
if (!isCasting) {
|
if (!isCasting) {
|
||||||
stateManager.stopForeground(!UserPreferences.isPersistNotify());
|
stateManager.stopForeground(!UserPreferences.isPersistNotify());
|
||||||
}
|
}
|
||||||
|
@ -841,6 +842,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
//stopService();
|
//stopService();
|
||||||
break;
|
break;
|
||||||
case PLAYING:
|
case PLAYING:
|
||||||
|
PlaybackPreferences.setCurrentPlayerStatus(PlaybackPreferences.PLAYER_STATUS_PLAYING);
|
||||||
saveCurrentPosition(true, null, Playable.INVALID_TIME);
|
saveCurrentPosition(true, null, Playable.INVALID_TIME);
|
||||||
recreateMediaSessionIfNeeded();
|
recreateMediaSessionIfNeeded();
|
||||||
updateNotificationAndMediaSession(newInfo.playable);
|
updateNotificationAndMediaSession(newInfo.playable);
|
||||||
|
|
|
@ -109,6 +109,10 @@ public abstract class PlaybackPreferences {
|
||||||
return prefs.getInt(PREF_CURRENT_PLAYER_STATUS, PLAYER_STATUS_OTHER);
|
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() {
|
public static float getCurrentlyPlayingTemporaryPlaybackSpeed() {
|
||||||
return prefs.getFloat(PREF_CURRENTLY_PLAYING_TEMPORARY_PLAYBACK_SPEED, FeedPreferences.SPEED_USE_GLOBAL);
|
return prefs.getFloat(PREF_CURRENTLY_PLAYING_TEMPORARY_PLAYBACK_SPEED, FeedPreferences.SPEED_USE_GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue