我找到了解决方案!
所以我要说的第一件事是我很困惑,而且我没有使用HTTPS,但我的解决方案也适用于https.
首先,您可能需要像我一样使用Vitamio,因为Gingerbread不支持直播(再次阅读this).现在的问题是,如果您的M3u8文件是.ts文件列表,它应该可以正常工作.但如果它指向其他m3u8文件..
那么你必须自己解析它.你可以这样做,例如:
url = new URL(livetvchannel.getUrl());
InputStream M3U8 = (InputStream) url.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(M3U8));
for(int i = 0; i < 2; ++i)
br.readLine();
String target = br.readLine(); //this parses the third line of the playlist
br.close();
url = new URL(baseURL.concat(target));
//if the m3u8 url is relative,you have to concat it with the path
//Note: You have to do all this in a thread,you can't do network on UiThread
mVideoView.setVideoURI(Uri.parse(url.toString())); //Run this on UiThread
url将指向视频流.你去吧!最后不是那么难.
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
小编个人微信号 jb51ccc
喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!