Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w无法播放优酷m3u8地址 #42

Closed
Greathfs opened this issue Dec 13, 2017 · 7 comments
Closed

w无法播放优酷m3u8地址 #42

Greathfs opened this issue Dec 13, 2017 · 7 comments

Comments

@Greathfs
Copy link

测试地址作者可以去优酷网址上抓下地址,机型换成ipad即可获取视频的m3u8地址,作者可以测试下

ps:

@Override
    public MediaSource initMediaSource(Uri uri) {
        int streamType = Util.inferContentType(uri);
        switch (streamType) {
            case C.TYPE_SS:
                return new SsMediaSource(uri, new DefaultDataSourceFactory(context, null,
                        getDataSource()),
                        new DefaultSsChunkSource.Factory(getDataSource()),
                        mainHandler, sourceEventListener);
            case C.TYPE_DASH:
                return new DashMediaSource(uri, new DefaultDataSourceFactory(context, null, getDataSource()),
                        new DefaultDashChunkSource.Factory(getDataSource()), mainHandler, sourceEventListener);
            case C.TYPE_HLS:
                return new HlsMediaSource(uri, getDataSource(), 5, mainHandler, sourceEventListener);
            case C.TYPE_OTHER:
                return new ExtractorMediaSource(uri, getDataSource(), new DefaultExtractorsFactory(), mainHandler, null,uri.getPath());
            default:
                throw new IllegalStateException("Unsupported type: " + streamType);
        }

我断点看了下,没有走Hls那个case,走的是的Other,所以播放不了,不知道作者这个问题作者怎么解决呢

@yangchaojiang
Copy link
Owner

请查看你链接是否符合标准链接 判断方式是处理符合标准的。一般m3u8 都有.m3u8后缀名的

@Greathfs
Copy link
Author

作者可以借鉴下这个库:
https://github.com/brianwernick/ExoMedia
这个库是可以播放优酷m3u8的

@yangchaojiang
Copy link
Owner

都是也可以的 exoplayer 判断链接 链接结尾处@ ,我只知道默认标着判断判断,我也是提供 自定义的方式,你可以自己实例化HlsMediaSource(). 调用该类setMediaSource() 播放器使用你的

@yangchaojiang
Copy link
Owner

image

下个版本 我会优化链接方法判断,不采用exoplayer提供链接类型。毕竟我们国内,视频链接都有验证信息什么

@yangchaojiang
Copy link
Owner

谢谢你的建议

@yangchaojiang
Copy link
Owner

版本1.9.81 完善 @Greathfs 谢谢支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants