ckpalyer是一款免费且功能强大的网页视频播放器,不仅能播放mp4等格式的视频,还可以播放m3u8、flv、rtmp格式的直播流。
首先下载ckpalyer
将ckplayer文件夹放到项目中,在项目中引入ckplayer.js即可
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ckplayer</title>
</head>
<body>
<div id="video" style="width: 100%; height: 400px;max-width: 600px;">
</div>
<script type="text/javascript" src="./ckplayer/ckplayer.js" charset="UTF-8"></script>
<script type="text/javascript">
var videoObject = {
container:'#video',
variable:'player',
autoplay:true,
video:'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8'
};
var player=new ckplayer(videoObject);
</script>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>ckplayer</title>
</head>
<body>
<div id="video" style="width: 100%; height: 400px;max-width: 600px;">
</div>
<script type="text/javascript" src="./ckplayer/ckplayer.js" charset="UTF-8"></script>
<script type="text/javascript">
var videoObject = {
container:'#video',
variable:'player',
autoplay:true,
video:'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8'
};
var player=new ckplayer(videoObject);
</script>
</body>
</html>
如果要去除右上角的ckplayer的logo、视频加载时的logo,可以打开ckplayer.js,找到logo和loading,把这两块去掉