使用 m3u8 播放列表播放分段 hls 流
mediaelement 播放器可以播放 m3u8 播放列表中定义的分段 mpegts hls 流吗?如果可以,您可以显示执行此操作的代码吗?就我而言,网络服务器上有一个 test.m3u8 播放列表:
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:7291
#EXTINF:12,
test-7291.ts
#EXTINF:12,
test-7292.ts
#EXTINF:12,
test-7293.ts
#EXTINF:12,
test-7294.ts
#EXTINF:12,
test-7295.ts
#EXTINF:12,
test-7296.ts
#EXTINF:12,
test-7297.ts
#EXTINF:12,
test-7298.ts
#EXTINF:12,
test-7299.ts
#EXTINF:12,
test-7300.ts
iOS 设备可以毫无问题地观看直播。
Can mediaelement player play a segmented mpegts hls stream defined in an m3u8 playlist and if so could you show the code to do this. In my case there is a test.m3u8 playlist on a webserver:
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:7291
#EXTINF:12,
test-7291.ts
#EXTINF:12,
test-7292.ts
#EXTINF:12,
test-7293.ts
#EXTINF:12,
test-7294.ts
#EXTINF:12,
test-7295.ts
#EXTINF:12,
test-7296.ts
#EXTINF:12,
test-7297.ts
#EXTINF:12,
test-7298.ts
#EXTINF:12,
test-7299.ts
#EXTINF:12,
test-7300.ts
iOS devices can view the live stream with no problems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,可以。
将 src 放入视频标签中的 .m3u8 中:
和初始化插件:
var video = document.getElementsByTagName('video')[0];
var player = new MediaElement(video);
播放器将从 .m3u8 列表中的第一项开始播放。
此外,播放 m3u8 列表的能力不是 mediaelement.js 的优点,而是平台功能
Yes, it can.
Put src to .m3u8 in your video tag:
<video src="/link/to/your_file.m3u8" />
and init plugin:
var video = document.getElementsByTagName('video')[0];
var player = new MediaElement(video);
Player would start to play from first item in .m3u8 list.
Moreover the ability to play m3u8 lists is not mediaelement.js merit, it's platform feature
您需要在库中进行一些更改。你可以看看我的修改。只需在支持的格式中添加 m3u8,它似乎就可以完美工作。
https://github.com/sourcebits-harshitakasera/mediaelement-and-player-v2
这似乎对我有用。
You need to make some changes in the library. You can check out my changes. By just adding m3u8 in the supported formats it seems to work perfectly.
https://github.com/sourcebits-harshitakasera/mediaelement-and-player-v2
It seems to work for me.