本文整理汇总了Java中com.google.android.exoplayer2.C.TYPE_OTHER属性的典型用法代码示例。如果您正苦于以下问题:Java C.TYPE_OTHER属性的具体用法?Java C.TYPE_OTHER怎么用?Java C.TYPE_OTHER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.exoplayer2.C
的用法示例。
在下文中一共展示了C.TYPE_OTHER属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMediaSource
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);
}
}
}
示例2: buildMediaSource
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);
}
}
}
示例3: buildMediaSource
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);
}
}
}
示例4: buildMediaSource
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);
}
}
}
示例5: getMediaSource
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);
}
}
}
示例6: inferContentType
/**
* Infer content type int.
*
* @param fileName the file name
* @return the int
*/
@C.ContentType
public static int inferContentType(String fileName) {
fileName = Util.toLowerInvariant(fileName);
if (fileName.matches(".*m3u8.*")) {
return C.TYPE_HLS;
} else if (fileName.matches(".*mpd.*")) {
return C.TYPE_DASH;
} else if (fileName.matches(".*\\.ism(l)?(/manifest(\\(.+\\))?)?")) {
return C.TYPE_SS;
} else {
return C.TYPE_OTHER;
}
}
示例7: initMediaSource
/****
* 初始化视频源,无缝衔接
*
* @param uri 视频的地址
* @return MediaSource media source
*/
public MediaSource initMediaSource(Uri uri) {
int streamType = VideoPlayUtils.inferContentType(uri);
switch (streamType) {
case C.TYPE_OTHER:
Log.d(TAG, "TYPE_OTHER");
return new ExtractorMediaSource.Factory(getDataSource())
.setExtractorsFactory(new DefaultExtractorsFactory())
.setMinLoadableRetryCount(5)
.setCustomCacheKey(uri.getPath())
.createMediaSource(uri, mainHandler, null);
default:
throw new IllegalStateException(context.getString(R.string.media_error));
}
}
示例8: initMediaSource
@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);
}
}
示例9: getUrlType
private static int getUrlType(String url) {
if (url.contains(".mpd")) {
return C.TYPE_DASH;
} else if (url.contains(".ism") || url.contains(".isml")) {
return C.TYPE_SS;
} else if (url.contains(".m3u8")) {
return C.TYPE_HLS;
} else {
return C.TYPE_OTHER;
}
}
示例10: inferContentType
/**
* Makes a best guess to infer the type from a file name.
*
* @param fileName Name of the file. It can include the path of the file.
* @return The content type.
*/
@C.ContentType
public static int inferContentType(String fileName) {
fileName = fileName.toLowerCase();
if (fileName.endsWith(".mpd")) {
return C.TYPE_DASH;
} else if (fileName.endsWith(".m3u8")) {
return C.TYPE_HLS;
} else if (fileName.endsWith(".ism") || fileName.endsWith(".isml")
|| fileName.endsWith(".ism/manifest") || fileName.endsWith(".isml/manifest")) {
return C.TYPE_SS;
} else {
return C.TYPE_OTHER;
}
}