|
楼主 |
发表于 2022-4-5 18:52:58
|
显示全部楼层
本帖最后由 拎壶冲 于 2022-4-5 19:09 编辑
替换内容代码:
- <iframe src="http://localhost/ckplayerx3.php?url={1}" width="100%" height="470" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
复制代码
播放器图标文件放到static\image\common下即可。
播放器代码
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>CKplayerX3播放器</title>
- <link type="text/css" rel="stylesheet" href="./ckx3/css/ckplayer.css" />
- <script type="text/javascript" charset="utf-8" src="./ckx3/language/zh.cn.js"></script>
- <script type="text/javascript" charset="UTF-8" src="./ckx3/js/ckplayer.js"></script>
- <style type="text/css">
- body,html{height:100%;background-color:#000;margin:0px;padding:0px;overflow:hidden;}
- #rongyao{height:100%;}
- </style>
- </head>
- <body>
- <div id="rongyao"></div>
- <script type="text/javascript">
- function getQueryVariable(variable) {
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- return (false);
- };
- var videoObject = {
- container: '#rongyao',
- autoplay: true,
- loaded: 'loadedHandler',
- screenshot:false,//截图功能是否开启
- plug:'hls.js',//使用插件
- rightBar:true,//是否开启右边控制栏
- smallWindows:true,//是否启用小窗口模式
- playbackrateOpen:true,//是否开启控制栏倍速选项
- webFull:true,//是否启用页面全屏按钮,默认不启用
- theatre:true,//是否启用剧场模式按钮,默认不启用
- video: getQueryVariable("url")
- };
- var player=new ckplayer(videoObject);
- </script>
- </body>
- </html>
复制代码 代码里的文件路径自行修改!保存为php或html 。在浏览器输入本机测试:http://localhost/ckx3.php?url=http://localhost/mp4/123.mp4或者http://localhost/ckx3.php?url=http://localhost/mp4/123.m3u8看看能否正常播放放!
添加广告
- {
- "autoplay": false,
- "ad":{//定义广告
- front:{//定义贴片广告
- closeTime:5,//播放贴片广告时3秒后显示可关闭广告
- closeButtonClick:'closeFront',//点击关闭按钮触发事件
- list:[//贴片广告列表
- {
- file: 'http://localhost/ckplayerx3/ad/front02.mp4',//视频地址
- type: 'video/mp4',//视频格式
- link:'https://www.ckplayer.com',//链接地址
- time: 5//视频时长
- },
- {
- file: 'http://localhost/ckplayerx3/ad/6.jpg',//图片地址
- type: 'picture',//广告类别定义成picture
- link: 'https://www.ckplayer.com',//链接地址
- time: 5//广告时长
- }
- ]
- },
- pause:{//配置暂停广告
- close:true,//暂停广告是否显示关闭按钮
- list:[//暂停广告列表
- {
- file: 'http://localhost/ckplayerx3/ad/banner1.JPG',//图片
- link: 'https://www.ckplayer.com',
- time: 3//显示时长
- },
- {
- file: 'http://localhost/ckplayerx3/ad/banner2.JPG',//图片
- link: 'https://www.ckplayer.com',
- time: 3//显示时长
- },
- {
- file: 'http://localhost/ckplayerx3/ad/banner3.JPG',//图片
- link: 'https://www.ckplayer.com',
- time: 3//显示时长
- },
- {
- file: 'http://localhost/ckplayerx3/ad/banner4.JPG',//图片
- link: 'https://www.ckplayer.com',
- time: 3//显示时长
- }
-
- ]
- }
- },
- "poster": "http://localhost/ckplayerx3/video/poster.png",
- "preview": {
- "file": ["http://localhost/ckplayerx3/video/1.png", "http://localhost/ckplayerx3/video/2.png", "http://localhost/ckplayerx3/video/3.png", "http://localhost/ckplayerx3/video/4.png"],
- "scale": 2,
- "thumbnail":[10,10],
- "type":0
- },
- "video": [
- ["https://gcalic.v.myalicdn.com/gly01_1/index.m3u8", "video/m3u8", "高清"],
- ["https://gcalic.v.myalicdn.com/gly01_1/index.m3u8", "video/m3u8", "标清"],
- ["https://gcalic.v.myalicdn.com/gly01_1/index.m3u8", "video/m3u8", "流畅"]
- ]
- }
复制代码 上面代码保存为xx.json文件,视频调用时前面加上website:或url即:website:http://localhost/mp4/123.m3u8或url:http://localhost/mp4/123.m3u8)这样每个视频都可以设置不同的广告和视频背景图片!
注:用广告时,要在播放器代码里添加广告代码,参照ckplayer手册。这样已经不能再详细了!有问题再说!
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|