private void maybeReportPlayerState() { boolean playWhenReady = player.getPlayWhenReady(); int playbackState = getPlaybackState(); if (lastReportedPlayWhenReady != playWhenReady || lastReportedPlaybackState != playbackState) { for (Listener listener : listeners) { listener.onStateChanged(playWhenReady, playbackState); } lastReportedPlayWhenReady = playWhenReady; lastReportedPlaybackState = playbackState; } }
private void pushTrackSelection(int type, boolean allowRendererEnable) { if (rendererBuildingState != RenderBuildingState.BUILT) { return; } int trackIndex = selectedTracks[type]; if (trackIndex == DISABLED_TRACK) { player.setRendererEnabled(type, false); } else if (multiTrackSources[type] == null) { player.setRendererEnabled(type, allowRendererEnable); } else { boolean playWhenReady = player.getPlayWhenReady(); player.setPlayWhenReady(false); player.setRendererEnabled(type, false); player.sendMessage( multiTrackSources[type], MultiTrackChunkSource.MSG_SELECT_TRACK, trackIndex); player.setRendererEnabled(type, allowRendererEnable); player.setPlayWhenReady(playWhenReady); } }
public boolean getPlayWhenReady() { return player.getPlayWhenReady(); }