当前位置: 首页>>代码示例>>Java>>正文


Java TrackSelectionArray类代码示例

本文整理汇总了Java中com.google.android.exoplayer2.trackselection.TrackSelectionArray的典型用法代码示例。如果您正苦于以下问题:Java TrackSelectionArray类的具体用法?Java TrackSelectionArray怎么用?Java TrackSelectionArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TrackSelectionArray类属于com.google.android.exoplayer2.trackselection包,在下文中一共展示了TrackSelectionArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExoPlayerImpl

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:33,代码来源:ExoPlayerImpl.java

示例2: onTracksChanged

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:20,代码来源:PlayerActivity.java

示例3: updateForCurrentTrackSelections

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
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);
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:16,代码来源:ExoPlayerView.java

示例4: onTracksSelected

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:11,代码来源:BufferingLoadControl.java

示例5: onTracksChanged

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:28,代码来源:ExoUserPlayer.java

示例6: updateForCurrentTrackSelections

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
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();
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:38,代码来源:SimpleExoPlayerView.java

示例7: updateForCurrentTrackSelections

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
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();
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:38,代码来源:TubiExoPlayerView.java

示例8: onTracksChanged

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:16,代码来源:PlayerActivity.java

示例9: onTracksSelected

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
}
 
开发者ID:hongcwamazing,项目名称:PreviewSeekBar-master,代码行数:12,代码来源:PreviewLoadControl.java

示例10: onTracksChanged

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:PlayerService.java

示例11: updatePeriodTrackSelection

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
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;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:29,代码来源:ExoPlayerImplInternal.java

示例12: onTracksSelected

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:12,代码来源:DefaultLoadControl.java

示例13: ExoPlayerImpl

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:35,代码来源:ExoPlayerImpl.java

示例14: onTracksChanged

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
@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);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:10,代码来源:EventInfoForwarder.java

示例15: updateForCurrentTrackSelections

import com.google.android.exoplayer2.trackselection.TrackSelectionArray; //导入依赖的package包/类
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();
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:38,代码来源:SimpleExoPlayerView.java


注:本文中的com.google.android.exoplayer2.trackselection.TrackSelectionArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。