Java 类com.google.android.exoplayer2.source.LoopingMediaSource 实例源码

项目:Android-O-Feature    文件:PictureInPictureActivity.java   
private void setupExoPlayer() {
    TrackSelection.Factory adaptiveTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());

    exoPlayer = ExoPlayerFactory.newSimpleInstance(
            new DefaultRenderersFactory(this),
            new DefaultTrackSelector(adaptiveTrackSelectionFactory),
            new DefaultLoadControl());
    pvVideoPreview.setPlayer(exoPlayer);
    exoPlayer.setPlayWhenReady(true);

    Uri uri = Uri.parse("asset:///sample_video.mp4");
    MediaSource mediaSource = createMediaSource(this, uri);
    LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource);
    exoPlayer.prepare(loopingMediaSource, true, false);
}
项目:react-native-videoplayer    文件:ReactExoplayerView.java   
private void initializePlayer() {
    if (player == null) {
        TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveVideoTrackSelection.Factory(BANDWIDTH_METER);
        trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
        player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, new DefaultLoadControl());
        player.addListener(this);
        exoPlayerView.setPlayer(player);
        if (isTimelineStatic) {
            if (playerPosition == C.TIME_UNSET) {
                player.seekToDefaultPosition(playerWindow);
            } else {
                player.seekTo(playerWindow, playerPosition);
            }
        }
        audioBecomingNoisyReceiver.setListener(this);
        setPlayWhenReady(!isPaused);
        playerNeedsSource = true;
    }
    if (playerNeedsSource && srcUri != null) {
        MediaSource mediaSource = buildMediaSource(srcUri, extension);
        mediaSource = repeat ? new LoopingMediaSource(mediaSource) : mediaSource;
        player.prepare(mediaSource, !shouldRestorePosition, true);
        playerNeedsSource = false;

        eventEmitter.loadStart();
        loadVideoStarted = true;
    }
}
项目:yjPlay    文件:MediaSourceBuilder.java   
/***
 * 获取视频数据源
 * @return the media source
 */
MediaSource getMediaSource() {
    if (loopingCount > 0) {
        return new LoopingMediaSource(mediaSource, loopingCount);
    }
    return mediaSource;
}
项目:Jockey    文件:QueuedExoPlayer.java   
private MediaSource buildRepeatOneMediaSource(DataSource.Factory srcFactory,
                                              ExtractorsFactory extFactory) {

    if (mQueue.isEmpty()) {
        // We need to return an empty MediaSource (can't be null), so return a
        // ConcatenatingMediaSource with nothing to concatenate
        return new ConcatenatingMediaSource();
    }

    Uri uri = mQueue.get(mQueueIndex).getLocation();
    MediaSource source = new ExtractorMediaSource(uri, srcFactory, extFactory, null, null);
    return new LoopingMediaSource(source);
}
项目:Jockey    文件:QueuedExoPlayer.java   
private MediaSource buildRepeatAllMediaSource(DataSource.Factory sourceFactory,
                                              ExtractorsFactory extractorsFactory) {

    MediaSource queue = buildNoRepeatMediaSource(sourceFactory, extractorsFactory);
    return new LoopingMediaSource(queue);
}
项目:B4A_ExoPlayer    文件:SimpleExoPlayerWrapper.java   
/**
 * Creates a loop source. The child source will be played multiple times.
 *Pass -1 to play it indefinitely.
 */
public Object CreateLoopSource (Object Source, int Count) {
    return new LoopingMediaSource((MediaSource) Source, Count > 0 ? Count : Integer.MAX_VALUE);
}