• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConcatenatingMediaSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initializePlayer

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
private void initializePlayer() {
    simpleExoPlayerView.requestFocus();
    TrackSelection.Factory videoTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(bandwidthMeter);
    trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    player = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
    simpleExoPlayerView.setPlayer(player);

    MediaSource[] mediaSources = new MediaSource[videos.size()];
    for (int i = 0; i < videos.size(); i++) {
        mediaSources[i] = buildMediaSource(Uri.parse(videos.get(i).videoUrl));
    }
    MediaSource mediaSource = mediaSources.length == 1 ? mediaSources[0]
            : new ConcatenatingMediaSource(mediaSources);
    player.prepare(mediaSource);
}
 
开发者ID:yusufcakmak,项目名称:ExoPlayerSample,代码行数:17,代码来源:PlayListActivity.java


示例2: testShuffleModeEnabledChanges

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
public void testShuffleModeEnabledChanges() throws Exception {
  Timeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
  MediaSource[] fakeMediaSources = {
      new FakeMediaSource(fakeTimeline, null, Builder.VIDEO_FORMAT),
      new FakeMediaSource(fakeTimeline, null, Builder.VIDEO_FORMAT),
      new FakeMediaSource(fakeTimeline, null, Builder.VIDEO_FORMAT)
  };
  ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(false,
      new FakeShuffleOrder(3), fakeMediaSources);
  FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
  ActionSchedule actionSchedule = new ActionSchedule.Builder("testShuffleModeEnabled")
      .setRepeatMode(Player.REPEAT_MODE_ALL).waitForPositionDiscontinuity() // 0 -> 1
      .setShuffleModeEnabled(true).waitForPositionDiscontinuity()           // 1 -> 0
      .waitForPositionDiscontinuity().waitForPositionDiscontinuity()        // 0 -> 2 -> 1
      .setShuffleModeEnabled(false).setRepeatMode(Player.REPEAT_MODE_OFF)   // 1 -> 2 -> end
      .build();
  ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder()
      .setMediaSource(mediaSource).setRenderers(renderer).setActionSchedule(actionSchedule)
      .build().start().blockUntilEnded(TIMEOUT_MS);
  testRunner.assertPlayedPeriodIndices(0, 1, 0, 2, 1, 2);
  assertTrue(renderer.isEnded);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:23,代码来源:ExoPlayerTest.java


示例3: setMediaUri

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
/****
 * 初始化
 *
 * @param uris 视频的地址列表
 */
public void setMediaUri(@NonNull Uri... uris) {
    MediaSource[] firstSources = new MediaSource[uris.length];
    int i = 0;
    for (Uri item : uris) {
        firstSources[i] = initMediaSource(item);
        i++;
    }
    mediaSource = new ConcatenatingMediaSource(firstSources);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:15,代码来源:MediaSourceBuilder.java


示例4: CreateListSource

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
/**
 * Concatenates multiple sources.
 */
public Object CreateListSource (List Sources) {
	MediaSource[] sources = new MediaSource[Sources.getSize()];
	for (int i = 0;i < Sources.getSize();i++)
		sources[i] = (MediaSource)Sources.Get(i);
	return new ConcatenatingMediaSource(sources);
}
 
开发者ID:AnywhereSoftware,项目名称:B4A_ExoPlayer,代码行数:10,代码来源:SimpleExoPlayerWrapper.java


示例5: buildRepeatOneMediaSource

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
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);
}
 
开发者ID:marverenic,项目名称:Jockey,代码行数:14,代码来源:QueuedExoPlayer.java


示例6: buildNoRepeatMediaSource

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
private MediaSource buildNoRepeatMediaSource(DataSource.Factory srcFactory,
                                             ExtractorsFactory extFactory) {

    MediaSource[] queue = new MediaSource[mQueue.size()];

    for (int i = 0; i < queue.length; i++) {
        Uri uri = mQueue.get(i).getLocation();
        queue[i] = new ExtractorMediaSource(uri, srcFactory, extFactory, null, null);
    }

    return new ConcatenatingMediaSource(queue);
}
 
开发者ID:marverenic,项目名称:Jockey,代码行数:13,代码来源:QueuedExoPlayer.java


示例7: initPlayer

import com.google.android.exoplayer2.source.ConcatenatingMediaSource; //导入依赖的package包/类
private void initPlayer(String url) {
        // 1.创建一个默认TrackSelector,测量播放过程中的带宽。 如果不需要,可以为null。
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        //从MediaSource中选出media提供给可用的Render S来渲染,在创建播放器时被注入
        TrackSelection.Factory videoTrackSelectionFactory =
                new AdaptiveTrackSelection.Factory(bandwidthMeter);
        TrackSelector trackSelector =
                new DefaultTrackSelector(videoTrackSelectionFactory);
        // 2.创建一个默认的LoadControl
        //Create a default LoadControl 控制MediaSource缓存media
        DefaultLoadControl loadControl = new DefaultLoadControl();
//        BufferingLoadControl bufferingLoadControl = new BufferingLoadControl();
        //生成加载媒体数据的DataSource实例。
//        dataSourceFactory = new DefaultDataSourceFactory(this,
//                Util.getUserAgent(this, "aitrip"), bandwidthMeter);
        //自定义解密工厂
        aitripFactory = new AitripDataSourceFactory(this,
                Util.getUserAgent(this, "aitrip"), bandwidthMeter);
        extractorsFactory = new DefaultExtractorsFactory();
//        factory = new DiyExtractorsFactory();
        FileDataSource fileDataSource = new FileDataSource();
        //test mp3
//        url = "https://storage.googleapis.com/exoplayer-test-media-0/play.mp3";
        // MediaSource代表要播放的媒体。
        videoSource = new ExtractorMediaSource(Uri.parse(url),
                aitripFactory, extractorsFactory, null, null);
        // 3.创建播放器
        player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);

        //SimpleExoPlayerView simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.exo_player);
        //设置监听器
        player.addListener(eventListener);
        //装载多个资源
        MediaSource[] mediaSources = new MediaSource[1];
//        mediaSources[0] = buildMediaSource(Uri.parse(huai), "");
//        mediaSources[1] = buildMediaSource(Uri.parse(deng), "");
        mediaSources[0] = buildMediaSource(Uri.parse(deng), "");
//        mediaSources[2] = buildMediaSource(playerUri, "");
//        mediaSources[3] = buildMediaSource(Uri.parse(deng), "");
        ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(mediaSources);

        //设置资源
        player.prepare(mediaSource);
        window = new Timeline.Window();
    }
 
开发者ID:ChangWeiBa,项目名称:AesExoPlayer,代码行数:46,代码来源:TestPlayerActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimplexOptimizer类代码示例发布时间:2022-05-22
下一篇:
Java TransformXSLT类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap