use of com.google.android.exoplayer2.ForwardingPlayer in project ExoPlayer by google.
the class SessionPlayerConnectorTest method play_withForwardingPlayer_isSkipped.
@Test
@LargeTest
public void play_withForwardingPlayer_isSkipped() throws Exception {
if (Looper.myLooper() == null) {
Looper.prepare();
}
Player forwardingPlayer = null;
SessionPlayerConnector playerConnector = null;
try {
Player exoPlayer = new ExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
forwardingPlayer = new ForwardingPlayer(exoPlayer) {
@Override
public boolean isCommandAvailable(int command) {
if (command == COMMAND_PLAY_PAUSE) {
return false;
}
return super.isCommandAvailable(command);
}
@Override
public Commands getAvailableCommands() {
return super.getAvailableCommands().buildUpon().remove(COMMAND_PLAY_PAUSE).build();
}
};
playerConnector = new SessionPlayerConnector(forwardingPlayer);
assertPlayerResult(playerConnector.play(), RESULT_INFO_SKIPPED);
} finally {
if (playerConnector != null) {
playerConnector.close();
}
if (forwardingPlayer != null) {
forwardingPlayer.release();
}
}
}
Aggregations