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

Java DashMediaSource类代码示例

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

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



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

示例1: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
    int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
            : uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
                    mainHandler, null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:21,代码来源:ReactExoplayerView.java


示例2: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
    int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
            : uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
                    mainHandler, eventLogger);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:21,代码来源:PlayerActivity.java


示例3: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Context context, Uri uri) {
    int type = getUrlType(uri.toString());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, new DefaultDataSourceFactory(context, null,
                    new DefaultHttpDataSourceFactory(USER_AGENT, null)),
                    new DefaultSsChunkSource.Factory(new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                            new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER))), mainThreadHandler, null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, new DefaultDataSourceFactory(context, null,
                    new DefaultHttpDataSourceFactory(USER_AGENT, null)),
                    new DefaultDashChunkSource.Factory(new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                            new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER))), mainThreadHandler, null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                    new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER)), mainThreadHandler, null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                    new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER)), new DefaultExtractorsFactory(),
                    mainThreadHandler, null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:tohodog,项目名称:QSVideoPlayer,代码行数:26,代码来源:ExoMedia.java


示例4: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
	DataSource.Factory mediaDataSourceFactory = buildDataSourceFactory(true);
	int type = TextUtils.isEmpty(overrideExtension) ? Util.inferContentType(uri)
			: Util.inferContentType("." + overrideExtension);
	switch (type) {
		case C.TYPE_SS:
			return new SsMediaSource(uri, buildDataSourceFactory(false),
					new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);
		case C.TYPE_DASH:
			return new DashMediaSource(uri, buildDataSourceFactory(false),
					new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);
		case C.TYPE_HLS:
			return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, null);
		case C.TYPE_OTHER:
			return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
					mainHandler, null);
		default: {
			throw new IllegalStateException("Unsupported type: " + type);
		}
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:22,代码来源:PlayerActivity.java


示例5: getMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
public MediaSource getMediaSource(boolean preview) {
    switch (streamType) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, new DefaultDataSourceFactory(context, null,
                    getHttpDataSourceFactory(preview)),
                    new DefaultSsChunkSource.Factory(getDataSourceFactory(preview)),
                    mainHandler, null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri,
                    new DefaultDataSourceFactory(context, null,
                            getHttpDataSourceFactory(preview)),
                    new DefaultDashChunkSource.Factory(getDataSourceFactory(preview)),
                    mainHandler, null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, getDataSourceFactory(preview), mainHandler, null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, getDataSourceFactory(preview),
                    new DefaultExtractorsFactory(), mainHandler, null);
        default: {
            throw new IllegalStateException("Unsupported type: " + streamType);
        }
    }
}
 
开发者ID:rubensousa,项目名称:PreviewSeekBar,代码行数:24,代码来源:ExoPlayerMediaSourceBuilder.java


示例6: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {

        int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
                : uri.getLastPathSegment());
        switch (type) {
            case C.TYPE_SS:
                return new SsMediaSource(uri, buildDataSourceFactory(false),
                        new DefaultSsChunkSource.Factory(mMediaDataSourceFactory), mMainHandler, mEventLogger);
            case C.TYPE_DASH:
                return new DashMediaSource(uri, buildDataSourceFactory(false),
                        new DefaultDashChunkSource.Factory(mMediaDataSourceFactory), mMainHandler, mEventLogger);
            case C.TYPE_HLS:
                return new HlsMediaSource(uri, mMediaDataSourceFactory, mMainHandler, mEventLogger);
            case C.TYPE_OTHER:
                return new ExtractorMediaSource(uri, mMediaDataSourceFactory, new DefaultExtractorsFactory(),
                        mMainHandler, mEventLogger);
            default: {
                throw new IllegalStateException("Unsupported type: " + type);
            }
        }
    }
 
开发者ID:huyongli,项目名称:TigerVideo,代码行数:22,代码来源:VideoExoPlayer.java


示例7: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
    int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
            : uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, new DefaultDataSourceFactory(context, userAgent),
                    new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, new DefaultDataSourceFactory(context, userAgent),
                    new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
                    mainHandler, eventLogger);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:21,代码来源:KExoMediaPlayer.java


示例8: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri) {
    int type = Util.inferContentType(uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultSsChunkSource.Factory(mediaDataSourceFactory), new Handler(), null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultDashChunkSource.Factory(mediaDataSourceFactory), new Handler(), null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, mediaDataSourceFactory, new Handler(), null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
                    new Handler(), null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:warnerbros,项目名称:cpe-manifest-android-experience,代码行数:20,代码来源:ECVideoViewFragment.java


示例9: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
  int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
      : uri.getLastPathSegment());
  switch (type) {
    case C.TYPE_SS:
      return new SsMediaSource(uri, buildDataSourceFactory(false),
          new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
    case C.TYPE_DASH:
      return new DashMediaSource(uri, buildDataSourceFactory(false),
          new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
    case C.TYPE_HLS:
      return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger);
    case C.TYPE_OTHER:
      return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
          mainHandler, eventLogger);
    default: {
      throw new IllegalStateException("Unsupported type: " + type);
    }
  }
}
 
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:21,代码来源:PlayerActivity.java


示例10: createMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
@Override
public MediaSource createMediaSource(
    Uri uri, @Nullable Handler handler, @Nullable MediaSourceEventListener listener) {
  @ContentType int type = Util.inferContentType(uri);
  switch (type) {
    case C.TYPE_DASH:
      return new DashMediaSource.Factory(
              new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
              manifestDataSourceFactory)
          .createMediaSource(uri, handler, listener);
    case C.TYPE_HLS:
      return new HlsMediaSource.Factory(mediaDataSourceFactory)
          .createMediaSource(uri, handler, listener);
    case C.TYPE_OTHER:
      return new ExtractorMediaSource.Factory(mediaDataSourceFactory)
          .createMediaSource(uri, handler, listener);
    case C.TYPE_SS:
    default:
      throw new IllegalStateException("Unsupported type: " + type);
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:22,代码来源:PlayerManager.java


示例11: buildSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
@Override
protected MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener) {
  DataSource.Factory manifestDataSourceFactory = dataSourceFactory != null
      ? dataSourceFactory : new DefaultDataSourceFactory(host, userAgent);
  DataSource.Factory mediaDataSourceFactory = dataSourceFactory != null
      ? dataSourceFactory
      : new DefaultDataSourceFactory(host, userAgent, mediaTransferListener);
  Uri manifestUri = Uri.parse(manifestUrl);
  DefaultDashChunkSource.Factory chunkSourceFactory = new DefaultDashChunkSource.Factory(
      mediaDataSourceFactory);
  return new DashMediaSource.Factory(chunkSourceFactory, manifestDataSourceFactory)
      .setMinLoadableRetryCount(MIN_LOADABLE_RETRY_COUNT)
      .setLivePresentationDelayMs(0)
      .createMediaSource(manifestUri);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:17,代码来源:DashTestRunner.java


示例12: initMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
@Override
public MediaSource initMediaSource(Uri uri) {
    int streamType = VideoPlayUtils.inferContentType(uri);
    switch (streamType) {
        case C.TYPE_SS:
            return new  SsMediaSource.Factory(new DefaultSsChunkSource.Factory(getDataSource()), new DefaultDataSourceFactory(context, null,
                    getDataSource()))
                    .setMinLoadableRetryCount(5)
                    .createMediaSource(uri,mainHandler,sourceEventListener);
        case C.TYPE_DASH:
            return new DashMediaSource.Factory(new DefaultDashChunkSource.Factory(getDataSource())
                     ,new DefaultDataSourceFactory(context, null, getDataSource()))
                     .setMinLoadableRetryCount(5)
                     .createMediaSource(uri, mainHandler, sourceEventListener);
        case C.TYPE_OTHER:
            return new  ExtractorMediaSource.Factory( getDataSource())
                     .setExtractorsFactory( new DefaultExtractorsFactory())
                    .setMinLoadableRetryCount(5)
                    .setCustomCacheKey(uri.getPath())
                    .createMediaSource(uri,mainHandler,null);
        case C.TYPE_HLS:
            return new HlsMediaSource.Factory(new DefaultHlsDataSourceFactory( getDataSource()))
                    .setMinLoadableRetryCount(5)
                    .createMediaSource(uri, mainHandler, sourceEventListener);

        default:
            throw new IllegalStateException(":Unsupported type: " + streamType);
    }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:30,代码来源:WholeMediaSource.java


示例13: buildSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
@Override
protected MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener) {
  DataSource.Factory manifestDataSourceFactory = new DefaultDataSourceFactory(host, userAgent);
  DataSource.Factory mediaDataSourceFactory = new DefaultDataSourceFactory(host, userAgent,
      mediaTransferListener);
  Uri manifestUri = Uri.parse(parameters.manifestUrl);
  DefaultDashChunkSource.Factory chunkSourceFactory = new DefaultDashChunkSource.Factory(
      mediaDataSourceFactory);
  return new DashMediaSource(manifestUri, manifestDataSourceFactory, chunkSourceFactory,
      MIN_LOADABLE_RETRY_COUNT, 0 /* livePresentationDelayMs */, null, null);
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:13,代码来源:DashTest.java


示例14: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri) {
  DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory("ua");
  DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(
      new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
  return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)
      .createMediaSource(uri);
}
 
开发者ID:googlecodelabs,项目名称:exoplayer-intro,代码行数:8,代码来源:PlayerActivity.java


示例15: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri) {
  DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(
      new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
  DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory("ua");
  return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory).
      createMediaSource(uri);
}
 
开发者ID:googlecodelabs,项目名称:exoplayer-intro,代码行数:8,代码来源:PlayerActivity.java


示例16: getMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource getMediaSource(boolean preview) {
    Uri contentUri = Uri.parse(mDataSource);
    int contentType = inferContentType(mDataSource);
    switch (contentType) {
        case C.TYPE_SS:
            return new SsMediaSource(contentUri, new DefaultDataSourceFactory(mAppContext, null,
                    getHttpDataSourceFactory(preview)),
                    new DefaultSsChunkSource.Factory(getDataSourceFactory(preview)),
                    mainHandler, null);
        case C.TYPE_DASH:
            return new DashMediaSource(contentUri,
                    new DefaultDataSourceFactory(mAppContext, null,
                            getHttpDataSourceFactory(preview)),
                    new DefaultDashChunkSource.Factory(getDataSourceFactory(preview)),
                    mainHandler, null);
        case C.TYPE_HLS:
            return new HlsMediaSource(contentUri, getDataSourceFactory(preview), mainHandler, null);
        case TYPE_RTMP:
            RtmpDataSourceFactory rtmpDataSourceFactory = new RtmpDataSourceFactory(null);
            return new ExtractorMediaSource(contentUri, rtmpDataSourceFactory,
                    new DefaultExtractorsFactory(), mainHandler, null);
        case C.TYPE_OTHER:
        default:
            return new ExtractorMediaSource(contentUri, getDataSourceFactory(preview),
                    new DefaultExtractorsFactory(), mainHandler, null);
    }
}
 
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:28,代码来源:IjkExo2MediaPlayer.java


示例17: create

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
public MediaSource create(ContentType contentType,
                          Uri uri,
                          ExtractorMediaSource.EventListener eventListener,
                          AdaptiveMediaSourceEventListener mediaSourceEventListener) {
    switch (contentType) {
        case HLS:
            return new HlsMediaSource(
                    uri,
                    mediaDataSourceFactory,
                    handler,
                    mediaSourceEventListener
            );
        case H264:
            DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
            return new ExtractorMediaSource(
                    uri,
                    mediaDataSourceFactory,
                    extractorsFactory,
                    handler,
                    eventListener
            );
        case DASH:
            DefaultDashChunkSource.Factory chunkSourceFactory = new DefaultDashChunkSource.Factory(mediaDataSourceFactory);
            return new DashMediaSource(
                    uri,
                    mediaDataSourceFactory,
                    chunkSourceFactory,
                    handler,
                    mediaSourceEventListener
            );
        default:
            throw new UnsupportedOperationException("Content type: " + contentType + " is not supported.");
    }
}
 
开发者ID:novoda,项目名称:no-player,代码行数:35,代码来源:MediaSourceFactory.java


示例18: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
    int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
            : uri.getLastPathSegment());
    switch (type) {
        case TYPE_SS:
            return new SsMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, buildDataSourceFactory(false),
                    new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger);
        case C.TYPE_OTHER:
            MediaSource mediaSource = new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
                    mainHandler, eventLogger);

            if (mSubtitleUri != null) {
                Log.d(TAG, "====加载字幕====buildMediaSource: ");
                return TextSubtitle(mSubtitleUri, mediaSource);
            } else {
                return mediaSource;
            }
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
 
开发者ID:AndroidTips,项目名称:MDVideo,代码行数:28,代码来源:PlayerActivityV2.java


示例19: build

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
@NonNull
@Override
public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener) {
    DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, null);
    DataSource.Factory meteredDataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener);

    return new DashMediaSource(uri, dataSourceFactory, new DefaultDashChunkSource.Factory(meteredDataSourceFactory), handler, null);
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:9,代码来源:DashMediaSourceBuilder.java


示例20: buildMediaSource

import com.google.android.exoplayer2.source.dash.DashMediaSource; //导入依赖的package包/类
private MediaSource buildMediaSource(
    Uri uri,
    String overrideExtension,
    @Nullable Handler handler,
    @Nullable MediaSourceEventListener listener) {
  @ContentType int type = TextUtils.isEmpty(overrideExtension) ? Util.inferContentType(uri)
      : Util.inferContentType("." + overrideExtension);
  switch (type) {
    case C.TYPE_DASH:
      return new DashMediaSource.Factory(
              new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
              buildDataSourceFactory(false))
          .createMediaSource(uri, handler, listener);
    case C.TYPE_SS:
      return new SsMediaSource.Factory(
              new DefaultSsChunkSource.Factory(mediaDataSourceFactory),
              buildDataSourceFactory(false))
          .createMediaSource(uri, handler, listener);
    case C.TYPE_HLS:
      return new HlsMediaSource.Factory(mediaDataSourceFactory)
          .createMediaSource(uri, handler, listener);
    case C.TYPE_OTHER:
      return new ExtractorMediaSource.Factory(mediaDataSourceFactory)
          .createMediaSource(uri, handler, listener);
    default: {
      throw new IllegalStateException("Unsupported type: " + type);
    }
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:30,代码来源:PlayerActivity.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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