分享:苹果CMSV10播放器增加记忆+P2P播放+自动下一集功能

分享:苹果CMSV10播放器增加记忆+P2P播放+自动下一集功能,在网站根目录上传或创建dplayer.php,代码如下,

<html>
<head>
    <title>dplayer增加记忆+P2P播放+自动下一集功能</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">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer@latest/dist/DPlayer.min.css" /> 
<style type="text/css">
    body,html{width:100%;height:100%;background:#000;padding:0;margin:0;overflow-x:hidden;overflow-y:hidden}
    *{margin:0;border:0;padding:0;text-decoration:none}
    #stats{position:fixed;top:5px;left:10px;font-size:10px;color:#fdfdfd;z-index:20719029;text-shadow:1px 1px 1px #000, 1px 1px 1px #000}
    #dplayer{position:inherit}
</style>
 </head>
<body style="background:#000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu=window.event.returnValue=false>
<div id="dplayer"></div>
<div id="stats"></div>
<script src="https://cdn.jsdelivr.net/npm/cdnbye@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/dplayer@latest"></script>
<script>
	var url = '<?php echo($_REQUEST['url']);?>';
    var isWap = navigator.userAgent.match(/iPad|iPhone|iPod|Baidu|UCBrowser/i) != null; //百度浏览器和苹果移动端不使用P2P功能
    if(!isWap){
    var _peerId = '', _peerNum = 0, _totalP2PDownloaded = 0, _totalP2PUploaded = 0;
    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 dp = new DPlayer({
        container: document.getElementById('dplayer'),
        autoplay: true,
		hotkey: true,  // 移动端全屏时向右划动快进,向左划动快退。
        video: {
            url:url,
			pic: '', // 可自定义播放前图片。
            type: 'customHls',
            customType: {
                'customHls': function (video, player) {
                    const hls = new Hls({
                        debug: false,
                        p2pConfig: {
                            logLevel: true,
                            live: false,        // 如果是直播设为true
                        }
                    });
                    hls.loadSource(video.src);
                    hls.attachMedia(video);
                    hls.p2pEngine.on('stats', function (stats) {
                        _totalP2PDownloaded = stats.totalP2PDownloaded;
                        _totalP2PUploaded = stats.totalP2PUploaded;
                        updateStats();
                    }).on('peerId', function (peerId) {
                        _peerId = peerId;
                    }).on('peers', function (peers) {
                        _peerNum = peers.length;
                        updateStats();
                    });

                }
            }
        }
    });
	dp.seek(webdata.get('vod'+url));
    setInterval(function(){
        webdata.set('vod'+url,dp.video.currentTime);
    },1000);
	dp.on('ended',function(){
  if(parent.MacPlayer.PlayLinkNext!=''){
         top.location.href = parent.MacPlayer.PlayLinkNext;
        }
  });
	}
    else{
    	document.getElementById('dplayer').innerHTML='<video src="'+url+'" controls="controls" preload="preload" poster="" width="100%" height="100%" autoplay="autoplay"></video>';
    }
    function updateStats() {
        var text = '七星P2P正在为您加速' + (_totalP2PDownloaded/1024).toFixed(2)
            + 'MB 已分享' + (_totalP2PUploaded/1024).toFixed(2) + 'MB' + ' 连接节点' + _peerNum + '个';
        document.getElementById('stats').innerText = text
    }
</script>
</body>
</html>

二、进苹果CMSV10后台--视频--播放器--添加(界面)
    基本设置-状态:启用,编码:bjm3u8,名称:bjm3u8,备注: ,目标窗口:当前,解析状态:启用,解析:/dplayer.php?url=,排序:909,提示:无需安装任何插件,如下图


444.png

三、清理后台缓存和浏览器缓存即可

本文标签: 分享 源码 解析 技术
转载声明:本文为七星博客的原创文章,转载请注明原文地址,谢谢合作

发表评论:

评论:

匿名
2019-11-25 09:25
这么久没人回复  [url=https://www.008yingshi.com/]008影视[/url]