com.google.android.exoplayer2.trackselection.RandomTrackSelection Java Examples

The following examples show how to use com.google.android.exoplayer2.trackselection.RandomTrackSelection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackSelectionHelper.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
private void updateViews() {
  disableView.setChecked(isDisabled);
  defaultView.setChecked(!isDisabled && override == null);
  for (int i = 0; i < trackViews.length; i++) {
    for (int j = 0; j < trackViews[i].length; j++) {
      trackViews[i][j].setChecked(override != null && override.groupIndex == i
          && override.containsTrack(j));
    }
  }
  if (enableRandomAdaptationView != null) {
    boolean enableView = !isDisabled && override != null && override.length > 1;
    enableRandomAdaptationView.setEnabled(enableView);
    enableRandomAdaptationView.setFocusable(enableView);
    if (enableView) {
      enableRandomAdaptationView.setChecked(!isDisabled
          && override.factory instanceof RandomTrackSelection.Factory);
    }
  }
}
 
Example #2
Source File: TrackSelectionHelper.java    From ExoPlayer-Offline with Apache License 2.0 6 votes vote down vote up
private void updateViews() {
  disableView.setChecked(isDisabled);
  defaultView.setChecked(!isDisabled && override == null);
  for (int i = 0; i < trackViews.length; i++) {
    for (int j = 0; j < trackViews[i].length; j++) {
      trackViews[i][j].setChecked(override != null && override.groupIndex == i
          && override.containsTrack(j));
    }
  }
  if (enableRandomAdaptationView != null) {
    boolean enableView = !isDisabled && override != null && override.length > 1;
    enableRandomAdaptationView.setEnabled(enableView);
    enableRandomAdaptationView.setFocusable(enableView);
    if (enableView) {
      enableRandomAdaptationView.setChecked(!isDisabled
          && override.factory instanceof RandomTrackSelection.Factory);
    }
  }
}
 
Example #3
Source File: DashTest.java    From ExoPlayer-Offline with Apache License 2.0 6 votes vote down vote up
@Override
protected TrackSelection[] selectTracks(RendererCapabilities[] rendererCapabilities,
    TrackGroupArray[] rendererTrackGroupArrays, int[][][] rendererFormatSupports)
    throws ExoPlaybackException {
  Assertions.checkState(rendererCapabilities[VIDEO_RENDERER_INDEX].getTrackType()
      == C.TRACK_TYPE_VIDEO);
  Assertions.checkState(rendererCapabilities[AUDIO_RENDERER_INDEX].getTrackType()
      == C.TRACK_TYPE_AUDIO);
  Assertions.checkState(rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].length == 1);
  Assertions.checkState(rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].length == 1);
  TrackSelection[] selections = new TrackSelection[rendererCapabilities.length];
  selections[VIDEO_RENDERER_INDEX] = new RandomTrackSelection(
      rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].get(0),
      getVideoTrackIndices(rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].get(0),
          rendererFormatSupports[VIDEO_RENDERER_INDEX][0], videoFormatIds,
          canIncludeAdditionalVideoFormats),
      0 /* seed */);
  selections[AUDIO_RENDERER_INDEX] = new FixedTrackSelection(
      rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].get(0),
      getTrackIndex(rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].get(0), audioFormatId));
  includedAdditionalVideoFormats =
      selections[VIDEO_RENDERER_INDEX].length() > videoFormatIds.length;
  return selections;
}