共计 684 个字符,预计需要花费 2 分钟才能阅读完成。
注意:m3u8 地址要为网络地址,直接把代码复制为 html 直接在本地打开,可能不行,需要放在 nginx 或者 apache 或者其他的 web 服务器上运行。
DOCTYPE html>
html>
head>
meta charset=utf-8 />
title> 测试播放 m3u8title>
link href="https://cdn.bootcdn.net/ajax/libs/video.js/5.18.4/video-js.css" rel="stylesheet">
script src="https://cdn.bootcdn.net/ajax/libs/video.js/5.18.4/video.min.js">script>
script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"
type="text/javascript">script>
head>
body>
video id="videoPlayer" class="video-js" controls style="width:300px;height:300px;">
source src="http://192.168.0.101:8178/kbkbk/index.m3u8" type="application/x-mpegURL">
video>
script>
videojs('videoPlayer', {});
script>
body>
html>
原文地址: html5 播放 m3u8
正文完