这篇整合教程加了阿里播放器的记忆功能,去除了弹幕,资源预加载等功能。
有人会说,我用ck 、dp不好吗?为啥要用aliplayer,阿里播放器的记忆功能很给力,比如手机播放页面在后台放了很久,隔了几天又打开刷下又接着播放了,ckplayer没测试过
第一步:
进入后台,点击顶部导航栏-视频-播放器-再点击添加
基本设置
状态:启用
编码:aliplayer,
名称:阿里播放器,
备注:aliplayer,
目标窗口,当前,
析状态:禁用,
解析接口:空,
排序:例如10,
提示:无需安装任何插件
播放器代码:
MacPlayer.Html = '<iframe src="'+maccms.path+'/static/player/aliplayer.html" width="100%" height="'+MacPlayer.Height+'" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
MacPlayer.Show();
保存后第二步:
进入网站根目录下/static/player/目录中,新建一个名为aliplayer.html文件 复制以下代码到这个文件中
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<title>Aliplay记忆播放器</title>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.7/skins/default/aliplayer-min.css" />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.8.7/aliplayer-min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js"></script>
<style type="text/css">
body,html{background-color:#000;padding: 0;margin: 0;width:100%;height:100%;}
#liryCN{width:100%;height:100%;padding:0;margin:0;display:block;}
</style>
</head>
<body>
<div id="liryCN" class="prism-player"></div>
<script type="text/javascript">
var player = new Aliplayer({
id: "liryCN",
"source": parent.MacPlayer.PlayUrl,
width: "100%",
height: "100%",
autoplay: true,
preload: true,
rePlay: false,
playsinline: false,
useH5Prism: false,
isLive: false,
components: [{
name: 'MemoryPlayComponent',
type: AliPlayerComponent.MemoryPlayComponent,
args: [true]
}],
},
function (player) {
console.log("The player is created");
}
);
try{
//document.getElementById('liryCN').style.height = parent.MacPlayer.Height + 'px';
}
catch(e){}
</script>
</body>
</html>
打赏