fix media progress bar on android 10
This commit is contained in:
parent
03e4afd79b
commit
0788037154
1 changed files with 5 additions and 1 deletions
|
|
@ -516,7 +516,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
mediaSession.setPlaybackState(
|
mediaSession.setPlaybackState(
|
||||||
new PlaybackStateCompat.Builder()
|
new PlaybackStateCompat.Builder()
|
||||||
.setActions(MEDIA_SESSION_ACTIONS)
|
.setActions(MEDIA_SESSION_ACTIONS)
|
||||||
.setState(isPlaying() ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED, getPosition(), 1)
|
.setState(isPlaying() ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED, getSongProgressMillis(), 1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -983,6 +983,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
case META_CHANGED:
|
case META_CHANGED:
|
||||||
updateNotification();
|
updateNotification();
|
||||||
updateMediaSessionMetaData();
|
updateMediaSessionMetaData();
|
||||||
|
updateMediaSessionPlaybackState();
|
||||||
savePosition();
|
savePosition();
|
||||||
saveProgress();
|
saveProgress();
|
||||||
break;
|
break;
|
||||||
|
|
@ -1099,6 +1100,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
if (service.getRepeatMode() == REPEAT_MODE_NONE && service.isLastTrack()) {
|
if (service.getRepeatMode() == REPEAT_MODE_NONE && service.isLastTrack()) {
|
||||||
service.pause();
|
service.pause();
|
||||||
service.seek(0);
|
service.seek(0);
|
||||||
|
service.notifyChange(PLAY_STATE_CHANGED);
|
||||||
} else {
|
} else {
|
||||||
service.position = service.nextPosition;
|
service.position = service.nextPosition;
|
||||||
service.prepareNextImpl();
|
service.prepareNextImpl();
|
||||||
|
|
@ -1129,6 +1131,8 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
|
|
||||||
case PLAY_SONG:
|
case PLAY_SONG:
|
||||||
service.playSongAtImpl(msg.arg1);
|
service.playSongAtImpl(msg.arg1);
|
||||||
|
// notification progress needs to be reset
|
||||||
|
service.notifyChange(PLAY_STATE_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SET_POSITION:
|
case SET_POSITION:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue