Excellent software and practical tutorials
Apple CMS sets Dplayer to automatically play the next episode
In the configuration of Apple cms, the default player will not automatically play, nor will it automatically play the next episode of the video. You need to manually modify the Dplayer code. Currently, the Dplayer player is quite popular on the Internet, and its performance and functions are outstanding. Let's take a look at how to configure the Dplayer player.
Who is Dplayer?
DPlayer is a lovely HTML5 bullet comment video player that helps people easily build videos and bullet comments.
DPlayer website address:https://dplayer.js.org/
Github project address:https://github.com/DIYgod/DPlayer
Integrate dplayer player to increase memory, P2P playback and automatically play the next episode of the Dplayer player code
Replace the following dplayer player code, replace the directory apple cms system static/player/dplayer.html and replace all the contents.
<!DOCTYPE html>
<html>
<head>
<title>dplayer 1.27.0 Player p2p acceleration + memory playback</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta http-equiv="content-language" content="zh-CN"/>
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta name="referrer" content="never"/>
<meta name="renderer" content="webkit"/>
<meta name="msapplication-tap-highlight" content="no"/>
<meta name="HandheldFriendly" content="true"/>
<meta name="x5-page-mode" content="app"/>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<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:8px;font-size:12px;color:#fdfdfd;text-shadow:1px 1px 1px #000, 1px 1px 1px #000}
#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 style="background:#000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu="window.event.returnValue=false">
<div id="playerCnt"></div>
<div id="stats"></div>
<script language="Javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
</script>
<script src="https://cdn.jsdelivr.net/npm/cdnbye@latest"></script>
<script>
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 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 _peerId = '', _peerNum = 0, _totalP2PDownloaded = 0, _totalP2PUploaded = 0;
var dp = new DPlayer({
container: document.getElementById('playerCnt'),
autoplay: true, //自动播放视频,不支持移动浏览器
volume: 1.0, //声音
preload: 'auto',//预加载的方式可以是'none''metadata''auto',默认值:'auto'
hotkey: true, //绑定热键,包括左右键和空格,默认值:true
screenshot: true, //截屏
theme: '#28FF28',//主题颜色
video: {
url: parent.MacPlayer.PlayUrl,//播放地址
type: 'customHls', //播放协议
pic: 'https://yingyinjia.top/HB/loading.png', // 视频封面
customType: {
'customHls': function (video, player) {
const hls = new Hls({
debug: false,
// Other hlsjsConfig options provided by hls.js
p2pConfig: {
logLevel: false,
live: false, // 如果是直播设为true
// Other p2pConfig options provided by CDNBye
getStats: function (totalP2PDownloaded, totalP2PUploaded, totalHTTPDownloaded) {
console.warn(totalP2PDownloaded ${totalP2PDownloaded} totalHTTPDownloaded ${totalHTTPDownloaded}
; hls.loadSource(video.src); hls.attachMedia(video); } } }, contextmenu: [ //Barrage settings] }); dp.seek(webdata.get('pay'+parent.MacPlayer.PlayUrl)); setInterval(function(){ webdata.set('pay'+parent.MacPlayer.PlayUrl,dp.video.currentTime); },1000); dp.on('stats', function (stats) { _totalP2PDownloaded = stats.totalP2PDownloaded; _totalP2PUploaded = stats.totalP2PUploaded; updateStats(); }); dp.on('peerId', function (peerId) { _peerId = peerId; }); dp.on('peers', function (peers) { _peerNum = peers.length; updateStats(); }); dp.on('ended', function (){ if(parent.MacPlayer.PlayLinkNext!=''){ top.location.href = parent.MacPlayer.PlayLinkNext; } }); function updateStats() { var text = 'P2P sharing is turned on' + (_totalP2PUploaded/1024).toFixed(2) + 'MB' + 'Accelerated' + (_totalP2PDownloaded/1024).toFixed(2) + 'MB' + 'This movie has ' + _peerNum + ' fans watching it'; //document.getElementById('stats').innerText = text }
</script>
</body>
</html>