我需要在Exo-player中逐个自动播放ConcatenatingMediaSources。
我的ConcatenatingMediaSource代码:
MediaSource movieMediaSource = MyExoPlayer.getMediaSourceFromUrl(StreamPlayerActivity.this, mLiveURL);
long oneMinute = 1000 * 1000 * 60 ;
ClippingMediaSource videoSource1 = new ClippingMediaSource(movieMediaSource, 0, oneMinute,false);
ClippingMediaSource videoSource2 = new ClippingMediaSource(movieMediaSource, oneMinute, 2 * oneMinute,false);
ClippingMediaSource videoSource3 = new ClippingMediaSource(movieMediaSource, 2 * oneMinute, 10 * oneMinute,false);
MediaSource adVideoSource1 = MyExoPlayer.getMediaSourceFromUrl(StreamPlayerActivity.this, mPromoVideoURL1);
MediaSource adVideoSource2 = MyExoPlayer.getMediaSourceFromUrl(StreamPlayerActivity.this, mPromoVideoURL2);
ConcatenatingMediaSource concatenatingMediaSource = new ConcatenatingMediaSource(videoSource1, adVideoSource1, videoSource2, adVideoSource2, videoSource3);
我的播放器准备好了:
mExoPlayer.prepare(mediaSource, false, false);
我目前使用的是onPlayerStateChanged()中的代码:
if (playWhenReady && (playbackState == PlaybackStateCompat.STATE_PAUSED))
{
mExoPlayer.seekToDefaultPosition(mTrack);
mTrack++;
}
我只是寻找赛道位置。
这是手动寻找。但我想一个接一个地自动播放。
我不可能自动播放选项Exoplayer。任何人帮助我
答案 0 :(得分:1)
使用,player.prepare(concatenatingMediaSource)。这应该有用。