https://github.com/jiqing9006/hLive
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>fz-live</title>
<link href="./css/video.css" rel="stylesheet">
<script src="./js/video.js"></script>
<script src="./js/videojs-live.js"></script>
</head>
<body>
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="1000" height="500" data-setup='{}'>
<source src="./src/z.m3u8" type="application/x-mpegURL">
</video>
<script>
var liveUrl = 'http://pili-live-hls.qiniu.yunlutong.com/yunlutong/598daedea95be73db168e955.m3u8';
var player = videojs('my_video_1');
player.ready(function() {
this.src({
src: liveUrl,
type: 'application/x-mpegURL',
});
});
</script>
</body>
</html>
注意的地方,必须是通过服务器访问,才有效。
直接右击打开,看不到效果。
可以更改地址,很灵活,很方便。
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/7574603.html,如需转载请自行联系原作者