如何检测播放M3U8时在Safari iOS上加载在视频元素上的块错误(404)
播放
- 在那之后播放M3U8
- 列表,我停止通过剪切信号进行流式传输。 =>播放器停止但不要发射错误事件。 我无法捕获该错误要处理。
非常感谢您的评论,大家!
这是我的代码
<!DOCTYPE html>
<html>
<body>
<h1>The video autoplay attribute</h1>
<video id="VIDEO" width="320" height="240" controls autoplay playsInline/>
<script>
const linkPlay = "https://sgn-fpt-001-livecdn-vt.vieon.vn/7ed4de9c6e5740688d95878c8bd5a766/1654246367317/dvr_event/60b822a4-ef69-4886-b942-351ab352779a/playlist.m3u8"
function init() {
const video = document.getElementById("VIDEO")
console.log(video)
console.log(video.canPlayType('application/vnd.apple.mpegurl'))
video.src = linkPlay
video.load()
video.addEventListener('error', (e)=> {
console.log('error', e)
})
}
init();
</script>
</body>
</html>
Reproduce
- Playing m3u8 playlist
- After that, I stop streaming by cut the signal.
=> Player stop but don't fire error event.
I can't catch that error to handle.
Many thanks for the comments, everyone!
Here is my code
<!DOCTYPE html>
<html>
<body>
<h1>The video autoplay attribute</h1>
<video id="VIDEO" width="320" height="240" controls autoplay playsInline/>
<script>
const linkPlay = "https://sgn-fpt-001-livecdn-vt.vieon.vn/7ed4de9c6e5740688d95878c8bd5a766/1654246367317/dvr_event/60b822a4-ef69-4886-b942-351ab352779a/playlist.m3u8"
function init() {
const video = document.getElementById("VIDEO")
console.log(video)
console.log(video.canPlayType('application/vnd.apple.mpegurl'))
video.src = linkPlay
video.load()
video.addEventListener('error', (e)=> {
console.log('error', e)
})
}
init();
</script>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
P/S:如果您需要调试,可以PM我,我将播放播放列表。
看待
P/s: If you need to debug, you can pm me and I will play the playlist.
Regard