Java 类com.google.android.exoplayer2.trackselection.TrackSelectionArray 实例源码

项目:K-Sonic    文件:ExoPlayerImpl.java   
/**
 * Constructs an instance. Must be called from a thread that has an associated {@link Looper}.
 *
 * @param renderers The {@link Renderer}s that will be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 */
@SuppressLint("HandlerLeak")
public ExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector, LoadControl loadControl) {
  Log.i(TAG, "Init " + ExoPlayerLibraryInfo.VERSION + " [" + Util.DEVICE_DEBUG_INFO + "]");
  Assertions.checkState(renderers.length > 0);
  this.renderers = Assertions.checkNotNull(renderers);
  this.trackSelector = Assertions.checkNotNull(trackSelector);
  this.playWhenReady = false;
  this.playbackState = STATE_IDLE;
  this.listeners = new CopyOnWriteArraySet<>();
  emptyTrackSelections = new TrackSelectionArray(new TrackSelection[renderers.length]);
  timeline = Timeline.EMPTY;
  window = new Timeline.Window();
  period = new Timeline.Period();
  trackGroups = TrackGroupArray.EMPTY;
  trackSelections = emptyTrackSelections;
  eventHandler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
      ExoPlayerImpl.this.handleEvent(msg);
    }
  };
  playbackInfo = new ExoPlayerImplInternal.PlaybackInfo(0, 0);
  internalPlayer = new ExoPlayerImplInternal(renderers, trackSelector, loadControl, playWhenReady,
      eventHandler, playbackInfo, this);
}
项目:transistor    文件:PlayerActivity.java   
@Override
@SuppressWarnings("ReferenceEquality")
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
  updateButtonVisibilities();
  if (trackGroups != lastSeenTrackGroupArray) {
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
      if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
          == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
        showToast(R.string.error_unsupported_video);
      }
      if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
          == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
        showToast(R.string.error_unsupported_audio);
      }
    }
    lastSeenTrackGroupArray = trackGroups;
  }
}
项目:react-native-videoplayer    文件:ExoPlayerView.java   
private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    shutterView.setVisibility(VISIBLE);
}
项目:yjPlay    文件:BufferingLoadControl.java   
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelectionArray 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);
}
项目:yjPlay    文件:ExoUserPlayer.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    Log.d(TAG, "onTracksChanged:" + currentWindowIndex + "_:" + player.getCurrentTimeline().getWindowCount());
    if (getWindowCount() > 1) {
        if (isRemove) {
            isRemove = false;
            mediaSourceBuilder.removeMediaSource(resumeWindow);
            return;
        }
        if (windowListener != null) {
            windowListener.onCurrentIndex(currentWindowIndex, getWindowCount());
            currentWindowIndex += 1;
        }
        if (mediaSourceBuilder.getIndexType() < 0) {
            return;
        }
        GestureVideoPlayer gestureVideoPlayer = null;
        if (ExoUserPlayer.this instanceof GestureVideoPlayer) {
            gestureVideoPlayer = (GestureVideoPlayer) ExoUserPlayer.this;
        }
        boolean setOpenSeek = !(mediaSourceBuilder.getIndexType() == currentWindowIndex && mediaSourceBuilder.getIndexType() > 0);
        if (gestureVideoPlayer != null) {
            gestureVideoPlayer.setPlayerGestureOnTouch(setOpenSeek);
        }
        getPlayerViewListener().setOpenSeek(setOpenSeek);
    }
}
项目:yjPlay    文件:SimpleExoPlayerView.java   
private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            hideArtwork();
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    // Display artwork if enabled and available, else hide it.
    if (useArtwork) {
        for (int i = 0; i < selections.length; i++) {
            TrackSelection selection = selections.get(i);
            if (selection != null) {
                for (int j = 0; j < selection.length(); j++) {
                    Metadata metadata = selection.getFormat(j).metadata;
                    if (metadata != null && setArtworkFromMetadata(metadata)) {
                        return;
                    }
                }
            }
        }
        if (setArtworkFromBitmap(null)) {
            return;
        }
    }
    // Artwork disabled or unavailable.
    hideArtwork();
}
项目:TubiPlayer    文件:TubiExoPlayerView.java   
private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            hideArtwork();
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    // Display artwork if enabled and available, else hide it.
    if (useArtwork) {
        for (int i = 0; i < selections.length; i++) {
            TrackSelection selection = selections.get(i);
            if (selection != null) {
                for (int j = 0; j < selection.length(); j++) {
                    Metadata metadata = selection.getFormat(j).metadata;
                    if (metadata != null && setArtworkFromMetadata(metadata)) {
                        return;
                    }
                }
            }
        }
        if (setArtworkFromBitmap(defaultArtwork)) {
            return;
        }
    }
    // Artwork disabled or unavailable.
    hideArtwork();
}
项目:ExoPlayer-Offline    文件:PlayerActivity.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    updateButtonVisibilities();
    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo != null) {
        if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
                == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
            showToast(R.string.error_unsupported_video);
        }
        if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
                == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
            showToast(R.string.error_unsupported_audio);
        }
    }
}
项目:PreviewSeekBar-master    文件:PreviewLoadControl.java   
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups,
                             TrackSelectionArray trackSelections) {
    int targetBufferSize = 0;
    for (int i = 0; i < renderers.length; i++) {
        if (trackSelections.get(i) != null) {
            targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType());
        }
    }
    allocator.setTargetBufferSize(targetBufferSize);
}
项目:Exoplayer2Radio    文件:PlayerService.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    if (trackGroups.length > 0) {
        // update format metadata of station
        Format format = trackGroups.get(0).getFormat(0);
        mStation.setMimeType(format.sampleMimeType);
        mStation.setChannelCount(format.channelCount);
        mStation.setSampleRate(format.sampleRate);
        mStation.setBitrate(format.bitrate);
        saveAppState();
    }
}
项目:Exoplayer2Radio    文件:ExoPlayerImplInternal.java   
public long updatePeriodTrackSelection(long positionUs, boolean forceRecreateStreams,
    boolean[] streamResetFlags) {
  TrackSelectionArray trackSelections = trackSelectorResult.selections;
  for (int i = 0; i < trackSelections.length; i++) {
    mayRetainStreamFlags[i] = !forceRecreateStreams
        && trackSelectorResult.isEquivalent(periodTrackSelectorResult, i);
  }

  // Disable streams on the period and get new streams for updated/newly-enabled tracks.
  positionUs = mediaPeriod.selectTracks(trackSelections.getAll(), mayRetainStreamFlags,
      sampleStreams, streamResetFlags, positionUs);
  periodTrackSelectorResult = trackSelectorResult;

  // Update whether we have enabled tracks and sanity check the expected streams are non-null.
  hasEnabledTracks = false;
  for (int i = 0; i < sampleStreams.length; i++) {
    if (sampleStreams[i] != null) {
      Assertions.checkState(trackSelections.get(i) != null);
      hasEnabledTracks = true;
    } else {
      Assertions.checkState(trackSelections.get(i) == null);
    }
  }

  // The track selection has changed.
  loadControl.onTracksSelected(renderers, trackSelectorResult.groups, trackSelections);
  return positionUs;
}
项目:Exoplayer2Radio    文件:DefaultLoadControl.java   
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups,
    TrackSelectionArray 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);
}
项目:Exoplayer2Radio    文件:ExoPlayerImpl.java   
/**
 * Constructs an instance. Must be called from a thread that has an associated {@link Looper}.
 *
 * @param renderers The {@link Renderer}s that will be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 */
@SuppressLint("HandlerLeak")
public ExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector, LoadControl loadControl) {
  Log.i(TAG, "Init " + ExoPlayerLibraryInfo.VERSION_SLASHY + " [" + Util.DEVICE_DEBUG_INFO + "]");
  Assertions.checkState(renderers.length > 0);
  this.renderers = Assertions.checkNotNull(renderers);
  this.trackSelector = Assertions.checkNotNull(trackSelector);
  this.playWhenReady = false;
  this.playbackState = STATE_IDLE;
  this.listeners = new CopyOnWriteArraySet<>();
  emptyTrackSelections = new TrackSelectionArray(new TrackSelection[renderers.length]);
  timeline = Timeline.EMPTY;
  window = new Timeline.Window();
  period = new Timeline.Period();
  trackGroups = TrackGroupArray.EMPTY;
  trackSelections = emptyTrackSelections;
  playbackParameters = PlaybackParameters.DEFAULT;
  Looper eventLooper = Looper.myLooper() != null ? Looper.myLooper() : Looper.getMainLooper();
  eventHandler = new Handler(eventLooper) {
    @Override
    public void handleMessage(Message msg) {
      ExoPlayerImpl.this.handleEvent(msg);
    }
  };
  playbackInfo = new ExoPlayerImplInternal.PlaybackInfo(0, 0);
  internalPlayer = new ExoPlayerImplInternal(renderers, trackSelector, loadControl, playWhenReady,
      eventHandler, playbackInfo, this);
}
项目:no-player    文件:EventInfoForwarder.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put("trackGroups", String.valueOf(trackGroups));
    callingMethodParameters.put("trackSelections", String.valueOf(trackSelections));

    infoListener.onNewInfo("onTracksChanged", callingMethodParameters);
}
项目:K-Sonic    文件:ExoPlayerImplInternal.java   
public long updatePeriodTrackSelection(long positionUs, boolean forceRecreateStreams,
    boolean[] streamResetFlags) {
  TrackSelectionArray trackSelections = trackSelectorResult.selections;
  for (int i = 0; i < trackSelections.length; i++) {
    mayRetainStreamFlags[i] = !forceRecreateStreams
        && trackSelectorResult.isEquivalent(periodTrackSelectorResult, i);
  }

  // Disable streams on the period and get new streams for updated/newly-enabled tracks.
  positionUs = mediaPeriod.selectTracks(trackSelections.getAll(), mayRetainStreamFlags,
      sampleStreams, streamResetFlags, positionUs);
  periodTrackSelectorResult = trackSelectorResult;

  // Update whether we have enabled tracks and sanity check the expected streams are non-null.
  hasEnabledTracks = false;
  for (int i = 0; i < sampleStreams.length; i++) {
    if (sampleStreams[i] != null) {
      Assertions.checkState(trackSelections.get(i) != null);
      hasEnabledTracks = true;
    } else {
      Assertions.checkState(trackSelections.get(i) == null);
    }
  }

  // The track selection has changed.
  loadControl.onTracksSelected(renderers, trackSelectorResult.groups, trackSelections);
  return positionUs;
}
项目:K-Sonic    文件:SimpleExoPlayerView.java   
private void updateForCurrentTrackSelections() {
  if (player == null) {
    return;
  }
  TrackSelectionArray selections = player.getCurrentTrackSelections();
  for (int i = 0; i < selections.length; i++) {
    if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
      // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
      // onRenderedFirstFrame().
      hideArtwork();
      return;
    }
  }
  // Video disabled so the shutter must be closed.
  if (shutterView != null) {
    shutterView.setVisibility(VISIBLE);
  }
  // Display artwork if enabled and available, else hide it.
  if (useArtwork) {
    for (int i = 0; i < selections.length; i++) {
      TrackSelection selection = selections.get(i);
      if (selection != null) {
        for (int j = 0; j < selection.length(); j++) {
          Metadata metadata = selection.getFormat(j).metadata;
          if (metadata != null && setArtworkFromMetadata(metadata)) {
            return;
          }
        }
      }
    }
    if (setArtworkFromBitmap(defaultArtwork)) {
      return;
    }
  }
  // Artwork disabled or unavailable.
  hideArtwork();
}
项目:K-Sonic    文件:DefaultLoadControl.java   
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups,
    TrackSelectionArray 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);
}
项目:PainlessMusicPlayer    文件:ExoMediaPlayer.java   
@Override
public void onTracksChanged(final TrackGroupArray trackGroups,
        final TrackSelectionArray trackSelections) {
    if (Log.logDEnabled()) {
        Log.d(TAG, "onTracksChanged()");
    }
}
项目:Komica    文件:PlayerActivity.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
  updateButtonVisibilities();
  MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
  if (mappedTrackInfo != null) {
    if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
        == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
      showToast(R.string.error_unsupported_video);
    }
    if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
        == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
      showToast(R.string.error_unsupported_audio);
    }
  }
}
项目:stepik-android    文件:SimpleExoPlayerView.java   
private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            hideArtwork();
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    // Display artwork if enabled and available, else hide it.
    if (useArtwork) {
        for (int i = 0; i < selections.length; i++) {
            TrackSelection selection = selections.get(i);
            if (selection != null) {
                for (int j = 0; j < selection.length(); j++) {
                    Metadata metadata = selection.getFormat(j).metadata;
                    if (metadata != null && setArtworkFromMetadata(metadata)) {
                        return;
                    }
                }
            }
        }
        if (setArtworkFromBitmap(defaultArtwork)) {
            return;
        }
    }
    // Artwork disabled or unavailable.
    hideArtwork();
}
项目:transistor    文件:SimpleExoPlayerView.java   
private void updateForCurrentTrackSelections() {
  if (player == null) {
    return;
  }
  TrackSelectionArray selections = player.getCurrentTrackSelections();
  for (int i = 0; i < selections.length; i++) {
    if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
      // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
      // onRenderedFirstFrame().
      hideArtwork();
      return;
    }
  }
  // Video disabled so the shutter must be closed.
  if (shutterView != null) {
    shutterView.setVisibility(VISIBLE);
  }
  // Display artwork if enabled and available, else hide it.
  if (useArtwork) {
    for (int i = 0; i < selections.length; i++) {
      TrackSelection selection = selections.get(i);
      if (selection != null) {
        for (int j = 0; j < selection.length(); j++) {
          Metadata metadata = selection.getFormat(j).metadata;
          if (metadata != null && setArtworkFromMetadata(metadata)) {
            return;
          }
        }
      }
    }
    if (setArtworkFromBitmap(defaultArtwork)) {
      return;
    }
  }
  // Artwork disabled or unavailable.
  hideArtwork();
}
项目:transistor    文件:ExoPlayerImplInternal.java   
public long updatePeriodTrackSelection(long positionUs, boolean forceRecreateStreams,
    boolean[] streamResetFlags) {
  TrackSelectionArray trackSelections = trackSelectorResult.selections;
  for (int i = 0; i < trackSelections.length; i++) {
    mayRetainStreamFlags[i] = !forceRecreateStreams
        && trackSelectorResult.isEquivalent(periodTrackSelectorResult, i);
  }

  // Undo the effect of previous call to associate no-sample renderers with empty tracks
  // so the mediaPeriod receives back whatever it sent us before.
  disassociateNoSampleRenderersWithEmptySampleStream(sampleStreams);
  updatePeriodTrackSelectorResult(trackSelectorResult);
  // Disable streams on the period and get new streams for updated/newly-enabled tracks.
  positionUs = mediaPeriod.selectTracks(trackSelections.getAll(), mayRetainStreamFlags,
      sampleStreams, streamResetFlags, positionUs);
  associateNoSampleRenderersWithEmptySampleStream(sampleStreams);

  // Update whether we have enabled tracks and sanity check the expected streams are non-null.
  hasEnabledTracks = false;
  for (int i = 0; i < sampleStreams.length; i++) {
    if (sampleStreams[i] != null) {
      Assertions.checkState(trackSelectorResult.renderersEnabled[i]);
      // hasEnabledTracks should be true only when non-empty streams exists.
      if (rendererCapabilities[i].getTrackType() != C.TRACK_TYPE_NONE) {
        hasEnabledTracks = true;
      }
    } else {
      Assertions.checkState(trackSelections.get(i) == null);
    }
  }

  // The track selection has changed.
  loadControl.onTracksSelected(renderers, trackSelectorResult.groups, trackSelections);
  return positionUs;
}
项目:transistor    文件:DefaultLoadControl.java   
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups,
    TrackSelectionArray trackSelections) {
  targetBufferSize =
      targetBufferBytesOverwrite == C.LENGTH_UNSET
          ? calculateTargetBufferSize(renderers, trackSelections)
          : targetBufferBytesOverwrite;
  allocator.setTargetBufferSize(targetBufferSize);
}
项目:transistor    文件:DefaultLoadControl.java   
/**
 * Calculate target buffer size in bytes based on the selected tracks. The player will try not to
 * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}.
 *
 * @param renderers The renderers for which the track were selected.
 * @param trackSelectionArray The selected tracks.
 * @return The target buffer size in bytes.
 */
protected int calculateTargetBufferSize(
    Renderer[] renderers, TrackSelectionArray trackSelectionArray) {
  int targetBufferSize = 0;
  for (int i = 0; i < renderers.length; i++) {
    if (trackSelectionArray.get(i) != null) {
      targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType());
    }
  }
  return targetBufferSize;
}
项目:transistor    文件:ExoPlayerImpl.java   
/**
 * Constructs an instance. Must be called from a thread that has an associated {@link Looper}.
 *
 * @param renderers The {@link Renderer}s that will be used by the instance.
 * @param trackSelector The {@link TrackSelector} that will be used by the instance.
 * @param loadControl The {@link LoadControl} that will be used by the instance.
 */
@SuppressLint("HandlerLeak")
public ExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector, LoadControl loadControl) {
  Log.i(TAG, "Init " + Integer.toHexString(System.identityHashCode(this)) + " ["
      + ExoPlayerLibraryInfo.VERSION_SLASHY + "] [" + Util.DEVICE_DEBUG_INFO + "]");
  Assertions.checkState(renderers.length > 0);
  this.renderers = Assertions.checkNotNull(renderers);
  this.trackSelector = Assertions.checkNotNull(trackSelector);
  this.playWhenReady = false;
  this.repeatMode = Player.REPEAT_MODE_OFF;
  this.shuffleModeEnabled = false;
  this.playbackState = Player.STATE_IDLE;
  this.listeners = new CopyOnWriteArraySet<>();
  emptyTrackSelections = new TrackSelectionArray(new TrackSelection[renderers.length]);
  window = new Timeline.Window();
  period = new Timeline.Period();
  trackGroups = TrackGroupArray.EMPTY;
  trackSelections = emptyTrackSelections;
  playbackParameters = PlaybackParameters.DEFAULT;
  Looper eventLooper = Looper.myLooper() != null ? Looper.myLooper() : Looper.getMainLooper();
  eventHandler = new Handler(eventLooper) {
    @Override
    public void handleMessage(Message msg) {
      ExoPlayerImpl.this.handleEvent(msg);
    }
  };
  playbackInfo = new PlaybackInfo(Timeline.EMPTY, null, 0, 0);
  internalPlayer = new ExoPlayerImplInternal(renderers, trackSelector, loadControl, playWhenReady,
      repeatMode, shuffleModeEnabled, eventHandler, this);
}
项目:transistor    文件:PlayerService.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    if (trackGroups.length > 0) {
        // update format metadata of station
        Format format = trackGroups.get(0).getFormat(0);
        mStation.setMimeType(format.sampleMimeType);
        mStation.setChannelCount(format.channelCount);
        mStation.setSampleRate(format.sampleRate);
        mStation.setBitrate(format.bitrate);
    }
}
项目:react-native-videoplayer    文件:ExoPlayerView.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    updateForCurrentTrackSelections();
}
项目:react-native-videoplayer    文件:ReactExoplayerView.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    // Do Nothing.
}
项目:yjPlay    文件:SimpleExoPlayerView.java   
@Override
public void onTracksChanged(TrackGroupArray tracks, TrackSelectionArray selections) {
    updateForCurrentTrackSelections();
}
项目:AesExoPlayer    文件:TestPlayerActivity.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    Timber.e("播放: TrackGroupArray  ");
}
项目:UdacityBakingAndroid    文件:StepFragment.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {}
项目:TubiPlayer    文件:TubiExoPlayerView.java   
@Override
public void onTracksChanged(TrackGroupArray tracks, TrackSelectionArray selections) {
    updateForCurrentTrackSelections();
}
项目:ExoPlayer-Offline    文件:ExoHostedTest.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
  // Do nothing.
}
项目:B4A_ExoPlayer    文件:SimpleExoPlayerWrapper.java   
/**
 * Initializes the player.
 */
public void Initialize(final BA ba, String EventName) {
    eventName = EventName.toLowerCase(BA.cul);
    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory =
        new AdaptiveTrackSelection.Factory(bandwidthMeter);
    trackSelector =
        new DefaultTrackSelector(videoTrackSelectionFactory);

    player = ExoPlayerFactory.newSimpleInstance(BA.applicationContext, trackSelector);
    player.addListener(new Player.EventListener() {

        @Override
        public void onLoadingChanged(boolean isLoading) {
        }

        @Override
        public void onPlayerError(ExoPlaybackException error) {
            ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_error", String.valueOf(error.getCause()));
        }

        @Override
        public void onPlayerStateChanged(boolean playWhenReady,
                int playbackState) {
            if (playbackState != currentState) {
                currentState = playbackState;
                if (currentState == Player.STATE_ENDED)
                    ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_complete");
                else if (currentState == Player.STATE_READY)
                    ba.raiseEvent(SimpleExoPlayerWrapper.this, eventName + "_ready");
            }
        }

        @Override
        public void onPositionDiscontinuity() {

        }

        @Override
        public void onTimelineChanged(Timeline timeline, Object manifest) {
        }

        @Override
        public void onPlaybackParametersChanged(
                PlaybackParameters playbackParameters) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onRepeatModeChanged(int repeatMode) {

        }

        @Override
        public void onTracksChanged(TrackGroupArray trackGroups,
                TrackSelectionArray trackSelections) {
            ba.raiseEventFromUI(SimpleExoPlayerWrapper.this, eventName + "_trackchanged");
        }

    });
}
项目:AndroidAudioExample    文件:PlayerService.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
}
项目:react-native-exoplayer-intent-video    文件:PlayerController.java   
public void EventListener(){
    this.player.addListener(new ExoPlayer.EventListener() {
        @Override
        public void onTimelineChanged(Timeline timeline, Object manifest) {

        }

        @Override
        public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {

        }

        @Override
        public void onLoadingChanged(boolean isLoading) {

        }

        @Override
        public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
            switch (playbackState){
                case 2:{
                    playerView.getProgressBar().setVisibility(View.VISIBLE);
                }break;
                case 3:{
                    playerView.getProgressBar().setVisibility(View.GONE);
                }break;
                case 4:{
                    playerView.getProgressBar().setVisibility(View.GONE);
                }break;
            }
        }

        @Override
        public void onPlayerError(ExoPlaybackException error) {

        }

        @Override
        public void onPositionDiscontinuity() {

        }
    });
    this.player.setPlayWhenReady(true);
}
项目:Exoplayer2Radio    文件:SimpleExoPlayer.java   
@Override
public TrackSelectionArray getCurrentTrackSelections() {
  return player.getCurrentTrackSelections();
}
项目:Exoplayer2Radio    文件:ExoPlayerImpl.java   
@Override
public TrackSelectionArray getCurrentTrackSelections() {
  return trackSelections;
}
项目:zapp    文件:VideoBufferingHandler.java   
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
}
项目:GSYVideoPlayer    文件:SimpleExoPlayer2.java   
@Override
public TrackSelectionArray getCurrentTrackSelections() {
  return player.getCurrentTrackSelections();
}