加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hls.html 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
cngco 提交于 2021-11-13 15:40 . feat:HL播放
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>hls</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<h1>test</h1>
<!-- Or if you want a more recent alpha version -->
<!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@alpha"></script> -->
<video muted id="video"></video>
<script>
var video = document.getElementById('video');
var videoSrc1 = 'https://uat-file-hls.trialos.com/resources/test/test.m3u8';
// var videoSrc = 'https://uat-file-hls.trialos.com/resources/hls/8ae780817ac3205d017ac6de80d80002/8ae780817ac3205d017ac6de80d80002_720p.m3u8';
//
// First check for native browser HLS support
//
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = videoSrc1;
//
// If no native HLS support, check if HLS.js is supported
//
} else if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(videoSrc1);//
// hls.loadSource(videoSrc);
hls.attachMedia(video);
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化