本文整理汇总了Java中com.google.android.exoplayer2.trackselection.FixedTrackSelection类的典型用法代码示例。如果您正苦于以下问题:Java FixedTrackSelection类的具体用法?Java FixedTrackSelection怎么用?Java FixedTrackSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FixedTrackSelection类属于com.google.android.exoplayer2.trackselection包,在下文中一共展示了FixedTrackSelection类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: selectTracks
import com.google.android.exoplayer2.trackselection.FixedTrackSelection; //导入依赖的package包/类
@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;
}
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:25,代码来源:DashTest.java
示例2: setSelectedTrack
import com.google.android.exoplayer2.trackselection.FixedTrackSelection; //导入依赖的package包/类
public void setSelectedTrack(@NonNull RendererType type, int index) {
// Retrieves the available tracks
int exoPlayerTrackIndex = getExoPlayerTrackType(type);
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
TrackGroupArray trackGroupArray = mappedTrackInfo == null ? null : mappedTrackInfo.getTrackGroups(exoPlayerTrackIndex);
if (trackGroupArray == null || trackGroupArray.length == 0) {
return;
}
// Creates the track selection override
int[] tracks = new int[] {index};
TrackSelection.Factory factory = tracks.length == 1 ? new FixedTrackSelection.Factory() : adaptiveTrackSelectionFactory;
MappingTrackSelector.SelectionOverride selectionOverride = new MappingTrackSelector.SelectionOverride(factory, exoPlayerTrackIndex, tracks);
// Specifies the correct track to use
trackSelector.setSelectionOverride(exoPlayerTrackIndex, trackGroupArray, selectionOverride);
}
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:18,代码来源:ExoMediaPlayer.java
示例3: create
import com.google.android.exoplayer2.trackselection.FixedTrackSelection; //导入依赖的package包/类
ExoPlayerTwoImpl create(Context context, DrmSessionCreator drmSessionCreator, boolean downgradeSecureDecoder) {
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(context, "user-agent", bandwidthMeter);
MediaSourceFactory mediaSourceFactory = new MediaSourceFactory(defaultDataSourceFactory, handler);
TrackSelection.Factory adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
DefaultTrackSelector trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);
MediaCodecSelector mediaCodecSelector = downgradeSecureDecoder
? SecurityDowngradingCodecSelector.newInstance()
: MediaCodecSelector.DEFAULT;
ExoPlayerTrackSelector exoPlayerTrackSelector = ExoPlayerTrackSelector.newInstance(trackSelector);
FixedTrackSelection.Factory trackSelectionFactory = new FixedTrackSelection.Factory();
ExoPlayerAudioTrackSelector exoPlayerAudioTrackSelector = new ExoPlayerAudioTrackSelector(exoPlayerTrackSelector, trackSelectionFactory);
ExoPlayerVideoTrackSelector exoPlayerVideoTrackSelector = new ExoPlayerVideoTrackSelector(exoPlayerTrackSelector, trackSelectionFactory);
ExoPlayerSubtitleTrackSelector exoPlayerSubtitleTrackSelector = new ExoPlayerSubtitleTrackSelector(
exoPlayerTrackSelector,
trackSelectionFactory
);
ExoPlayerCreator exoPlayerCreator = new ExoPlayerCreator(context, trackSelector);
RendererTypeRequesterCreator rendererTypeRequesterCreator = new RendererTypeRequesterCreator();
ExoPlayerFacade exoPlayerFacade = new ExoPlayerFacade(
mediaSourceFactory,
exoPlayerAudioTrackSelector,
exoPlayerSubtitleTrackSelector,
exoPlayerVideoTrackSelector,
exoPlayerCreator,
rendererTypeRequesterCreator);
PlayerListenersHolder listenersHolder = new PlayerListenersHolder();
ExoPlayerForwarder exoPlayerForwarder = new ExoPlayerForwarder();
LoadTimeout loadTimeout = new LoadTimeout(new SystemClock(), handler);
Heart heart = Heart.newInstance(handler);
return new ExoPlayerTwoImpl(
exoPlayerFacade,
listenersHolder,
exoPlayerForwarder,
loadTimeout,
heart,
drmSessionCreator,
mediaCodecSelector
);
}
开发者ID:novoda,项目名称:no-player,代码行数:47,代码来源:NoPlayerExoPlayerCreator.java
示例4: provideTrackSelectionFactory
import com.google.android.exoplayer2.trackselection.FixedTrackSelection; //导入依赖的package包/类
@Provides
static TrackSelection.Factory provideTrackSelectionFactory() {
return new FixedTrackSelection.Factory();
}
开发者ID:futurice,项目名称:freesound-android,代码行数:5,代码来源:AudioModule.java
示例5: QueuedExoPlayer
import com.google.android.exoplayer2.trackselection.FixedTrackSelection; //导入依赖的package包/类
public QueuedExoPlayer(Context context) {
mContext = context;
mState = ExoPlayerState.IDLE;
mQueue = Collections.emptyList();
TrackSelector trackSelector = new DefaultTrackSelector(new FixedTrackSelection.Factory());
LoadControl loadControl = new DefaultLoadControl();
SimpleExoPlayer baseInstance = ExoPlayerFactory.newSimpleInstance(mContext,
trackSelector, loadControl);
mExoPlayer = new EqualizedExoPlayer(context, baseInstance);
mExoPlayer.addListener(new ExoPlayer.EventListener() {
@Override
public void onLoadingChanged(boolean isLoading) {
Timber.i("onLoadingChanged (%b)", isLoading);
}
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
Timber.i("onPlayerStateChanged");
QueuedExoPlayer.this.onPlayerStateChanged(playbackState);
}
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
Timber.i("onTimelineChanged");
QueuedExoPlayer.this.onTimelineChanged();
}
@Override
public void onTracksChanged(TrackGroupArray trackGroups,
TrackSelectionArray trackSelections) {
Timber.i("onTracksChanged");
}
@Override
public void onPlayerError(ExoPlaybackException error) {
Timber.i("onPlayerError");
QueuedExoPlayer.this.onPlayerError(error);
}
@Override
public void onPositionDiscontinuity() {
Timber.i("onPositionDiscontinuity");
QueuedExoPlayer.this.onPositionDiscontinuity();
}
});
}
开发者ID:marverenic,项目名称:Jockey,代码行数:50,代码来源:QueuedExoPlayer.java
注:本文中的com.google.android.exoplayer2.trackselection.FixedTrackSelection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论