当前位置: 首页>>代码示例>>Java>>正文


Java Util.inferContentType方法代码示例

本文整理汇总了Java中com.google.android.exoplayer2.util.Util.inferContentType方法的典型用法代码示例。如果您正苦于以下问题:Java Util.inferContentType方法的具体用法?Java Util.inferContentType怎么用?Java Util.inferContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer2.util.Util的用法示例。


在下文中一共展示了Util.inferContentType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildMediaSource

import com.google.android.exoplayer2.util.Util; //导入方法依赖的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.util.Util; //导入方法依赖的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.util.Util; //导入方法依赖的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

示例4: setUri

import com.google.android.exoplayer2.util.Util; //导入方法依赖的package包/类
public void setUri(Uri uri) {
    this.uri = uri;
    this.streamType = Util.inferContentType(uri.getLastPathSegment());
}
 
开发者ID:rubensousa,项目名称:PreviewSeekBar,代码行数:5,代码来源:ExoPlayerMediaSourceBuilder.java


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