苹果CMSv10视频播放页模板制作教程
模板文件目录html/vod/play.html页面aid值15当前影片数组$obj必带参id播放页和详情页一样数有当前影片的{$obj}数组,如下查询全部字段 可以参考视频字段或者在模板用{:print_r($obj)}打印当前影片全部数据,其他如播放地址或剧情等等需要用函数处理并且遍历处相列表。播放页标签1
2
3
4
5
6
7
8
9
10
11
12
{$param.sid} 当前播放组序号
{$param.nid} 当前集数序号
{$obj.player_info.link_next} 下一页地址,最后一页时此链接将当前页链接
{$obj.player_info.link_pre} 上一页地址,第一页时此链接将当前页链接
{$obj['vod_play_list'][$param['sid']]} 获取当前播放组数据
{$obj['vod_play_list'][$param['sid']]['player_info']}播放器信息
{$obj['vod_play_list'][$param['sid']]['server_info']}服务器组信息
{$obj['vod_play_list'][$param['sid']]['url_count']} 总集数
{$obj['vod_play_list'][$param['sid']]['urls']} 集数信息
{$obj['vod_play_list'][$param['sid']]['urls'][$param['nid']]} 当前集数信息
{$obj['vod_play_list'][$param['sid']]['urls'][$param['nid']]['name']} 当前集数名称
{$obj['vod_play_list'][$param['sid']]['urls'][$param['nid']]['url']} 当前集数url
下载页获取以上信息,请把vod_play_list改为vod_down_list,其他参数不变播放器调用方法需要下面两个标签缺一不可
1
2
{$player_data} 播放数据
{$player_js} 加载播放器
获取与当前视频相关联视频和关联文章数据
1
2
3
4
5
6
7
8
9
10
11
12
<h2>与<strong>“{$obj.vod_name}”</strong>关联的视频</h2>
<ul class="img-list dis">
{maccms:vod num="6" ids="'.$obj['vod_rel_vod'].'" order="desc" by="time"}
<li><a href="{:mac_url_vod_detail($vo)}" title="{$vo.vod_name}"><img src="{:mac_url_img($vo.vod_pic)}" alt="{$vo.vod_name}"/><h2>{$vo.vod_name}</h2><p></p><i>{$vo.vod_version}</i><em></em></a></li>
{/maccms:vod}
</ul>
<h2>与<strong>“{$obj.vod_name}”</strong>关联的文章</h2>
<ul class="img-list dis">
{maccms:art num="6" ids="'.$obj['vod_rel_art'].'" order="desc" by="time"}
<li><a href="{:mac_url_art_detail($vo)}" title="{$vo.art_name}"><img src="{:mac_url_img($vo.art_pic)}" alt="{$vo.art_name}"/><h2>{$vo.art_name}</h2><p></p><i>{$vo.vod_from}</i><em></em></a></li>
{/maccms:art}
</ul>
版权跳转配合后台提供的跳转url字段,在内容页播放页通用。
1
2
3
4
5
<script>
{if condition="$obj.vod_jumpurl neq ''"}
location.href='{$obj.vod_jumpurl}';
{/if}
</script>
如果想判断每集是否跳转,可把要跳转的集数地址写成固定的格式,方便读取和操作。比如火影忍者有10集,第2集版权跳转,地址写为jump://baidu.com,在播放页加入代码 只跳转这一集
1
2
3
4
5
<script>
{if condition="strpos($obj['vod_play_list'][$param['sid']]['urls'][$param['nid']]['url'],'jump:')!==false "}
location.href='{$obj['vod_play_list'][$param['sid']]['urls'][$param['nid']]['url']|str_replace="jump:","http:",###}';
{/if}
</script>
iframe播放器这个嵌入iframe播放器页面只会在后台开启收费或试看模式才会启用.文件目录html/vod/player.html页面aid值无支持当前影片数组参数基本上和播放页一致,同样需要{$player_data}和{$player_js}两个标签来输出播放器。代码实例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<title>iframe播放器</title>
<style>*{word-wrap:break-word;outline:none} html,body{width:100%;height:100%;background:#000;color:#fff;}
.player_popeom{ width:500px;height:150px; position:absolute;text-align:center; top:50%;left:50%;margin:-75px 0 0 -250px; }
.player_popeom a{padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px; color: #fff;background-color: #5cb85c;border-color: #4cae4c;}
</style>
<script src="{$maccms.path}static/js/jquery.js"></script>
<script>var maccms={"path":"__ROOT__","mid":"{$maccms['mid']}","url":"{$maccms['site_url']}","wapurl":"{$maccms['site_wapurl']}","mob_status":"{$maccms['mob_status']}"};</script>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
{$player_data}
{$player_js}
{if condition="$popedom.code gt 1"/}
<div class="player_showtry" style="display:none;">
<div class="player_box">
<div class="player_popeom">
{if condition="$obj.vod_points_play eq 0"}
<p>试看{$popedom.trysee}分钟结束,完整观看本影片需要升级会员组,请升级后观看。</p>
<small>提示:购买VIP会员组,享受超级权限,谢谢支持。</small>
<p><a href="{:url('user/index')}" target="_blank">会员中心</a> <a href="{:url('user/upgrade')}" target="_blank">马上升级</a></p>
{else/}
<p>试看{$popedom.trysee}分钟结束,完整观看本影片需要花费{$obj.vod_points_play}积分,请支付后观看。</p>
<small>提示:一次支付,永久观看,不重复扣费,谢谢支持。</small>
{if condition="$user.group.group_id eq 1"}
<p><a href="{:url('user/login')}" target="_blank">马上登录</a></p>
{else/}
<p><a href="{:url('user/buy')}" target="_blank">马上充值</a> <a href="javascript:;" onclick="window.parent.MAC.User.BuyPopedom(this)" data-id="{$obj.vod_id}" data-sid="{$param.sid}" data-nid="{$param.nid}" data-type="4" data-mid="1">确认购买</a></p>
{/if}
{/if}
</div>
</div>
</div>
<script>
//方式一本页面计算
window.setTimeout(function(){
$('.MacPlayer').html( $('.player_showtry').html() );
},1000*60*{$popedom.trysee});
//方式二调用父页面公共函数库
//window.parent.MAC.User.PopedomCallBack({$popedom.trysee},$('.player_showtry').html() );
</script>
{/if}
</body>
</html>
页:
[1]