@Override public void onTrackSelectionsChanged(TrackSelections<? extends MappedTrackInfo> trackSelections) { // updateButtonVisibilities(); MappedTrackInfo trackInfo = trackSelections.info; if (trackInfo.hasOnlyUnplayableTracks(C.TRACK_TYPE_VIDEO)) { showToast(R.string.error_unsupported_video); } if (trackInfo.hasOnlyUnplayableTracks(C.TRACK_TYPE_AUDIO)) { showToast(R.string.error_unsupported_audio); } }
public boolean selectTracks() throws ExoPlaybackException { TrackSelections<T> newTrackSelections = trackSelector.selectTracks(rendererCapabilities, mediaPeriod.getTrackGroups()); if (newTrackSelections.equals(periodTrackSelections)) { return false; } trackSelections = newTrackSelections; return true; }
@Override public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelections<?> trackSelections) { targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelections.get(i) != null) { targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType()); } } allocator.setTargetBufferSize(targetBufferSize); }
@Override public void onTrackSelectionsChanged(TrackSelections<?> trackSelections) { boolean videoTracksEnabled = false; for (int i = 0; i < renderers.length; i++) { if (renderers[i].getTrackType() == C.TRACK_TYPE_VIDEO && trackSelections.get(i) != null) { videoTracksEnabled = true; break; } } if (videoListener != null && SimpleExoPlayer.this.videoTracksEnabled && !videoTracksEnabled) { videoListener.onVideoTracksDisabled(); } SimpleExoPlayer.this.videoTracksEnabled = videoTracksEnabled; }
@Override public void onTrackSelectionsChanged(TrackSelections<? extends MappingTrackSelector.MappedTrackInfo> trackSelections) { int textRenderIndex = getRenderIndex(C.TRACK_TYPE_TEXT); boolean status = trackSelector.getRendererDisabled(textRenderIndex); closedCaptionAction.setIndex(status ? PlaybackControlsRow.ClosedCaptioningAction.ON : PlaybackControlsRow.ClosedCaptioningAction.OFF); primaryActionsAdapter.notifyArrayItemRangeChanged(primaryActionsAdapter.indexOf(closedCaptionAction), 1); }
/** * Called by the player when a track selection occurs. * * @param renderers The renderers. * @param trackGroups The {@link TrackGroup}s from which the selection was made. * @param trackSelections The track selections that were made. */ void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelections<?> trackSelections);