2018-03-16 07:42:46 +01:00
|
|
|
package org.schabi.newpipe.player.mediasession;
|
|
|
|
|
2019-10-07 07:54:31 +02:00
|
|
|
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
2018-03-16 07:42:46 +01:00
|
|
|
import com.google.android.exoplayer2.Player;
|
|
|
|
|
2019-10-07 07:54:31 +02:00
|
|
|
public class PlayQueuePlaybackController extends DefaultControlDispatcher {
|
2018-03-16 07:42:46 +01:00
|
|
|
private final MediaSessionCallback callback;
|
|
|
|
|
|
|
|
public PlayQueuePlaybackController(final MediaSessionCallback callback) {
|
|
|
|
super();
|
|
|
|
this.callback = callback;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-10-07 07:54:31 +02:00
|
|
|
public boolean dispatchSetPlayWhenReady(Player player, boolean playWhenReady) {
|
|
|
|
if(playWhenReady) {
|
|
|
|
callback.onPlay();
|
|
|
|
} else {
|
|
|
|
callback.onPause();
|
|
|
|
}
|
|
|
|
return true;
|
2018-03-16 07:42:46 +01:00
|
|
|
}
|
|
|
|
}
|