一些浏览器喜欢你直接玩的边缘ts
没有video.js
。参考这个答案
<video width="352" height="198" controls>
<source src="index.m3u8" type="application/x-mpegURL">
</video>
对于其他浏览器,如 firefox 和 chrome,video.js
像这样使用,
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>
</head>
<body>
<h1>Video.js Example Embed</h1>
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268"
data-setup='{}'>
<source src="index.m3u8" type="application/x-mpegURL">
</video>
<script>
</script>
</body>
</html>