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


Java Util.inferContentType方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:26,代码来源:PlaybackOverlayFragment.java

示例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);
        }
    }
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:15,代码来源:PlaybackOverlayFragment.java

示例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);
}
 
开发者ID:bigjelly,项目名称:ShaddockVideoPlayer,代码行数:11,代码来源:IjkExoMediaPlayer.java

示例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);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:PlayerActivity.java


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