public DemoPlayer(RendererBuilder rendererBuilder) { this.rendererBuilder = rendererBuilder; player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000); player.addListener(this); playerControl = new PlayerControl(player); mainHandler = new Handler(); listeners = new CopyOnWriteArrayList<>(); lastReportedPlaybackState = STATE_IDLE; rendererBuildingState = RENDERER_BUILDING_STATE_IDLE; // Disable text initially. player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED); }
public void setSelectedTrack(int type, int index) { player.setSelectedTrack(type, index); if (type == TYPE_TEXT && index < 0 && captionListener != null) { captionListener.onCues(Collections.<Cue>emptyList()); } }
@Override protected void doActionImpl(ExoPlayer player) { player.setSelectedTrack(rendererIndex, trackIndex); }