mirror of https://github.com/TeamNewPipe/NewPipe
24 lines
674 B
Java
24 lines
674 B
Java
package org.schabi.newpipe.player.mediasession;
|
|
|
|
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
|
import com.google.android.exoplayer2.Player;
|
|
|
|
public class PlayQueuePlaybackController extends DefaultControlDispatcher {
|
|
private final MediaSessionCallback callback;
|
|
|
|
public PlayQueuePlaybackController(final MediaSessionCallback callback) {
|
|
super();
|
|
this.callback = callback;
|
|
}
|
|
|
|
@Override
|
|
public boolean dispatchSetPlayWhenReady(final Player player, final boolean playWhenReady) {
|
|
if (playWhenReady) {
|
|
callback.play();
|
|
} else {
|
|
callback.pause();
|
|
}
|
|
return true;
|
|
}
|
|
}
|