當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。