本文整理汇总了Java中com.google.android.exoplayer.util.Util.inferContentType方法的典型用法代码示例。如果您正苦于以下问题:Java Util.inferContentType方法的具体用法?Java Util.inferContentType怎么用?Java Util.inferContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer.util.Util
的用法示例。
在下文中一共展示了Util.inferContentType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRendererBuilder
import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private VideoPlayer.RendererBuilder getRendererBuilder() {
String userAgent = Util.getUserAgent(getActivity(), "ExoVideoPlayer");
Uri contentUri = Uri.parse(mSelectedVideo.videoUrl);
int contentType = Util.inferContentType(contentUri.getLastPathSegment());
switch (contentType) {
case Util.TYPE_OTHER: {
return new ExtractorRendererBuilder(getActivity(), userAgent, contentUri);
}
case Util.TYPE_DASH: {
// Implement your own DRM callback here.
MediaDrmCallback drmCallback = new WidevineTestMediaDrmCallback(null, null);
return new DashRendererBuilder(getActivity(), userAgent, contentUri.toString(),
drmCallback);
}
case Util.TYPE_HLS: {
return new HlsRendererBuilder(getActivity(), userAgent, contentUri.toString());
}
default: {
throw new IllegalStateException("Unsupported type: " + contentType);
}
}
}
示例2: getRendererBuilder
import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private VideoPlayer.RendererBuilder getRendererBuilder() {
String userAgent = Util.getUserAgent(getActivity(), "ExoVideoPlayer");
Uri contentUri = Uri.parse(mSelectedVideo.videoUrl);
int contentType = Util.inferContentType(contentUri.getLastPathSegment());
switch (contentType) {
case Util.TYPE_OTHER: {
return new ExtractorRendererBuilder(getActivity(), userAgent, contentUri);
}
default: {
throw new IllegalStateException("Unsupported type: " + contentType);
}
}
}
示例3: inferContentType
import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
/**
* Makes a best guess to infer the type from a media {@link Uri}
*
* @param uri The {@link Uri} of the media.
* @return The inferred type.
*/
private static int inferContentType(Uri uri) {
String lastPathSegment = uri.getLastPathSegment();
return Util.inferContentType(lastPathSegment);
}
示例4: inferContentType
import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
/**
* Makes a best guess to infer the type from a media {@link Uri} and an optional overriding file
* extension.
*
* @param uri The {@link Uri} of the media.
* @param fileExtension An overriding file extension.
* @return The inferred type.
*/
private static int inferContentType(Uri uri, String fileExtension) {
String lastPathSegment = !TextUtils.isEmpty(fileExtension) ? "." + fileExtension
: uri.getLastPathSegment();
return Util.inferContentType(lastPathSegment);
}