fix an issue manually seeking during playback
This commit is contained in:
parent
eb5b4787ed
commit
8327c7d1ba
6 changed files with 44 additions and 16 deletions
|
|
@ -70,6 +70,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
||||
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED;
|
||||
import static com.google.android.exoplayer2.Player.PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM;
|
||||
|
||||
public class MusicService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener, Playback.PlaybackCallbacks {
|
||||
|
|
@ -1062,6 +1063,9 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO) {
|
||||
playerHandler.sendEmptyMessage(TRACK_CHANGED);
|
||||
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
||||
} else if (reason == MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED) {
|
||||
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
||||
prepareNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,6 @@ public class LocalPlayer implements Playback {
|
|||
private PlaybackCallbacks callbacks;
|
||||
|
||||
private final ExoPlayer.EventListener eventListener = new ExoPlayer.EventListener() {
|
||||
@Override
|
||||
public void onIsLoadingChanged(boolean isLoading) {
|
||||
Log.i(TAG, String.format("onIsLoadingChanged: %b", isLoading));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyChanged(boolean playWhenReady, int reason) {
|
||||
Log.i(TAG, String.format("onPlayWhenReadyChanged: %b %d", playWhenReady, reason));
|
||||
|
|
@ -60,6 +55,9 @@ public class LocalPlayer implements Playback {
|
|||
|
||||
if (exoPlayer.getMediaItemCount() > 1) {
|
||||
exoPlayer.removeMediaItem(0);
|
||||
}
|
||||
|
||||
if (callbacks != null) {
|
||||
callbacks.onTrackChanged(reason);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue