内嵌式:
//需要下载ckplayer插件包,可以官网的三方库进行下载
<div class="video" id="video" data-url="<?php echo $show['url'] ?>" style="width: 100%;"></div>
<script type="text/javascript">
layui.config({
base: 'layui/'
}).extend({
ckplayer: 'ckplayer/ckplayer'
}).use(['jquery', 'ckplayer'], function() {
var $ = layui.$,
ckplayer = layui.ckplayer;
var vUrl = $('#video').data('url'),
videoObject = {
container: '#video',
loop: true,
autoplay: true,
video: [
[vUrl, 'video/mp4']
]
};
var player = new ckplayer(videoObject);
});
</script>
//按钮点击弹窗式
$("#mtvshow").click(function(){
var mtv=$(this).attr("title");
//iframe层-多媒体
layer.open({
type: 1,
title: false,
area: ['630px', '360px'],
shade: 0.8,
closeBtn: 0,
shadeClose: true,
content: '<video controls="true" width="630px" height="360px" preload="none" controls=true><source src="'+ mtv +'" type="video/mp4" /></video >'
});
return false;
})