苹果maccms v10本地化dplayer和ckplayer播放器自动下一集

释放双眼,带上耳机,听听看~!

dplayer自动下一集修改方法

打开static文件夹player目录下的dplayer.html文件
查找try{
在以上代码前插入以下代码

dp.on('ended', function (){
        if(parent.MacPlayer.PlayLinkNext!=''){
            top.location.href = parent.MacPlayer.PlayLinkNext;
        }    });

搞定!
采集各大资源站的m3u8地址的需要本地化的,我们可以这么来!
把资源站提供的JS文件(如:最大资源站的文件是zuidam3u8.js)内容替换为以下代码:

MacPlayer.Html = '<iframe border="0" src="'+maccms.path+'/static/player/dplayer.html" width="100%" height="100%" marginWidth="0" frameSpacing="0" marginHeight="0" frameBorder="0" scrolling="no" vspale="0" allowfullscreen="true" noResize></iframe>';
MacPlayer.Show();

ckplayer自动下一集修改方法

打开static文件夹player目录下的ckplayer.html文件

<!DOCTYPE html>
<html>
<head>
	<title>ckplayer播放器</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=11" />
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
	<style type="text/css">
	html,body{width:100%;height:100%; padding:0; margin:0;}
	#playerCnt{width:100%;height:100%;}
	</style>
	<script type="text/javascript" src="/static/player/ckplayer/ckplayer.js"></script>
</head>
<body marginwidth="0" marginheight="0">
<div id="playerCnt"></div>
<script type="text/javascript">
    var video = [
        [
            parent.MacPlayer.PlayUrl,
            "video/mp4"
        ],
        [
            parent.MacPlayer.PlayUrl,
            "video/m3u8",
        ],
        [
            parent.MacPlayer.PlayUrl,
            "video/ogg",
        ],
        [
            parent.MacPlayer.PlayUrl,
            "video/webm",
        ]
    ];
    var videoObject = {
        container: '#playerCnt', //容器的ID或className
        variable: 'ck',//播放函数名称
        //flashplayer:true,
        autoplay:true,
        loaded: 'loadedHandler',
        video: parent.MacPlayer.PlayUrl
    };
    var ck = new ckplayer(videoObject);
    function loadedHandler(){
        ck.addListener('ended', endedHandler);
    }
    function endedHandler(){
        if(parent.MacPlayer.PlayLinkNext!=''){
            top.location.href = parent.MacPlayer.PlayLinkNext;
        }
    }
	try{
		//document.getElementById('playerCnt').style.height = parent.MacPlayer.Height + 'px';
	}
	catch(e){}
</script>
</body>
</html>

修改播放器代码为:

MacPlayer.Html = '<iframe border="0" src="'+maccms.path+'/static/player/ckplayer.html" width="100%" height="100%" marginWidth="0" frameSpacing="0" marginHeight="0" frameBorder="0" scrolling="no" vspale="0" allowfullscreen="true" noResize></iframe>';
MacPlayer.Show();

下面在分享一段Dplayer播放器记忆播放和IE兼容模式不能播放的提醒的代码!

<html>
<head>
	<title>dplayer播放器</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=11" />
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" 

id="viewport" name="viewport">
	<style type="text/css">
	html,body{width:100%;height:100%; padding:0; margin:0;}
	#playerCnt{width:100%;height:100%;}
	</style>
		<link rel="stylesheet" href="/static/player/dplayer/DPlayer.min.css">
	<script type="text/javascript" src="/static/player/dplayer/flv.min.js"></script>
	<script type="text/javascript" src="/static/player/dplayer/hls.min.js"></script>
	<script type="text/javascript" src="/static/player/dplayer/dash.all.min.js"></script>
	<script type="text/javascript" src="/static/player/dplayer/webtorrent.min.js"></script>
	<script type="text/javascript" src="/static/player/dplayer/DPlayer.min.js"></script>
</head>
<body marginwidth="0" marginheight="0">
<div id="playerCnt"></div>
<script type="text/javascript">
    var webdata = {
		set:function(key,val){
			window.sessionStorage.setItem(key,val);
		},
		get:function(key){
			return window.sessionStorage.getItem(key);
		},
		del:function(key){
			window.sessionStorage.removeItem(key);
		},
		clear:function(key){
			window.sessionStorage.clear();
		}
	};
    var type='normal';
    var live=false;
    if(parent.MacPlayer.PlayUrl.indexOf('.m3u8')>-1){
        type='hls';
        live=true;
    }
    else if(parent.MacPlayer.PlayUrl.indexOf('magnet:')>-1){
        type='webtorrent';
    }
    else if(parent.MacPlayer.PlayUrl.indexOf('.flv')>-1){
        type='flv';
    }
    else if(parent.MacPlayer.PlayUrl.indexOf('.mpd')>-1){
        type='dash';
    }

    var dp = new DPlayer({
        container: document.getElementById('playerCnt'),
        autoplay: true,
        screenshot: false,
        video: {
            url: parent.MacPlayer.PlayUrl,
            live: live,
            type:type,
        },
         volume: 1.0,
         preload: 'auto',
         theme: '#28FF28',
         contextmenu: [

        ]
    });
	dp.seek(webdata.get('pay'+parent.MacPlayer.PlayUrl));
	setInterval(function(){
		webdata.set('pay'+parent.MacPlayer.PlayUrl,dp.video.currentTime);
	},1000);
        dp.on('ended', function (){
        if(parent.MacPlayer.PlayLinkNext!=''){
            top.location.href = parent.MacPlayer.PlayLinkNext;
        }
    });
if ((navigator.userAgent.indexOf('MSIE') >= 0)
			|| (navigator.userAgent.indexOf('Trident') >= 0)) {
		alert("\u517c\u5bb9\u6a21\u5f0f\u0020\u6613\u4ea7\u751f\u64ad\u653e\u95ee\u9898\uff0c

\u8bf7\u5c06\u6d4f\u89c8\u5668\u8bbe\u7f6e\u4e3a\u0020\u6781\u901f\u6a21\u5f0f\uff01");
     }
       try{
		//document.getElementById('playerCnt').style.height = parent.MacPlayer.Height + 'px';
	}
	catch(e){}
</script>
</body>
</html>

给TA打赏
共{{data.count}}人
人已打赏
技术文档

苹果maccms使用免费Cloudflare CDN加速自定义缓存规则的设置方法

2019-11-1 21:18:58

技术文档

绕过腾讯网址检测相关代码,过滤腾讯网址检测IP

2019-11-22 0:46:01

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
有新私信 私信列表
搜索