效果图
完整版下载.主要是css样式表.其它核心内容.下面都讲到了
https://download.csdn.net/download/viqecel/10287298
功能介绍
默认逻辑为:需要积分才可点播的视频,才开启试看功能.
如果是vip会员组,则不受限制,本播放会员组2为vip会员组.1为普通会员组.
如果是普通会员,则只能试看vip资源,并提示升级vip或充值积分,积分如果有,则自动扣除
游客一样试看.并提示注册
如果有的视频没有使用ckplayer播放器,则不受试看功能的限制.如果该视频也有积分点播功能.则直接跳转到注册页面.不提供试看.
使用说明,
后台点击视频菜单,播放器, 添加mp4与m3u8播放器.增加vip会员组.注意会员组的编号.
插件中.包含ckplayer,player两个文件夹,需要上传到你网站的根目录,如果你根目录中原来就有,则先修改一下旧的文件夹名,并上传新的.
里面还包含inc\module\vod.php 播放面的逻辑文件,里对应修改或替换,注意原来的备份.
播放页的模板则直接用官方默认的即可.即里面需要包含[vod:playerinfo][vod:player] 即可正常播放
一,后台视频发布时,需要选择 点播每集所需积分 功能 默认情况下,无积分限制的.所有人都可完整观看
二,后台视频,只可选择mp4与m3u8两种播放器才有试看功能,因为试看功能是基于ckplayer播放器的.
三, 需要上传ckplayer文件夹到根目录.根目录中的player文件夹中有两个播放器js.需要放进去.
四.配置信息在ckplayer中的play_config.php中.
五,inc\module\vod.php 中的
elseif($method==‘play’)
{
//这里的内容为播放器逻辑判断.需要对应修改
}
部分代码.完整代码.主要是css样式代码.请去下载
一, player/mp4.js 中的内容为
MacPlayer.Html = '<iframe width="100%" height="'+MacPlayer.Height+'" src="/ckplayer/mp4.php?url='+MacPlayer.PlayUrl+'" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
MacPlayer.Show();
二,vod.php 中的播放页逻辑代码内容为
elseif($method=='play')
{$tpl->C["siteaid"] = 17;$tpl->P['cp'] = 'vodplay';$_SESSION["vod_id"] = $tpl->P['id'];$tpl->P['cn'] = $tpl->P['id'].'-'.$tpl->P['src'].'-'.$tpl->P['num'];echoPageCache($tpl->P['cp'],$tpl->P['cn']);getDbConnect();$sql = "SELECT * FROM {pre}vod WHERE d_hide=0 AND d_id=" . $tpl->P['id'];$row = $db->getRow($sql);$playfrom = $row["d_playfrom"]; if(!$row){ showMsg("获取数据失败,请勿非法传递参数",MAC_PATH); }if(!getUserPopedom($row["d_type"],"play")){ showMsg ("您没有权限浏览播放页",MAC_PATH."index.php?m=user-index.html"); }$uid = intval($_SESSION['userid']); $rowu = $db->getRow("SELECT * FROM {pre}user where u_id=".$uid);$_SESSION["usergroup"] = $rowu['u_group'];if($row["d_stint"]>0){//如果是收费视频$_SESSION["free"] = 0;//收费if ($playfrom=='mp4'||$playfrom=='m3u8'){ if($uid==0){//如果是游客$_SESSION["user_no_score"] = -1;//游客}else{//会员if ($MAC['user']['status']==1){if ($rowu){//如果登录会员$stat =false;$upoint = $rowu["u_points"];$playf = ",".$tpl->P['id']."-".$tpl->P['src']."-".$tpl->P['num'].",";if($rowu["u_flag"]==1){if(time() >= $rowu["u_end"]){ $msg = "对不起,您的会员时间已经到期,请联系管理员续费!";alertUrl ($msg,MAC_PATH."index.php?m=user-index.html");exit; }}elseif ($rowu["u_flag"] == 2){if(($rowu["u_start"]>= $rowu["u_ip"]) && ($rowu["u_ip"] <= $rowu["u_end"])){$stat=true; }if(!$stat){ $msg = "对不起,您登录IP段不在受理范围,请联系管理员续费!";alertUrl ($msg,MAC_PATH."index.php?m=user-index.html");exit;}}else{if(strpos(",".$rowu["u_plays"],$playf)){ //看过,跳过}else{if ( $rowu["u_points"] < $row["d_stint"]){//$msg = "对不起,您的积分不够";$_SESSION["user_no_score"] =$row["d_stint"];//用户积分不足,ck单独提醒}else{//有积分,直接扣分//vip不扣分$upoint = $rowu['u_group']==2?$rowu["u_points"] :$rowu["u_points"] - $row["d_stint"];$uplays = ",".$rowu["u_plays"].$playf;$uplays = str_replace(",,",",",$uplays);$db->Update ("{pre}user" ,array("u_points","u_plays"),array($upoint,$uplays),"u_id=".$uid);$_SESSION["user_no_score"] = 0;//积分足}}}}}unset($rowu);}}else{showMsg ("此为收费数据请先登录再观看",MAC_PATH."index.php?m=user-index.html"); }}else{$_SESSION["free"] = 1;//免费//免费视频不作判断}$tpl->T = $MAC_CACHE['vodtype'][$row['d_type']];$tpl->D = $row;unset($row);$tpl->loadvod('play');$tpl->replaceVod();$tpl->playdownlist('play');$tpl->H = str_replace('[vod:playnum]',$tpl->P['num'],$tpl->H);$tpl->H = str_replace('[vod:playsrc]',$tpl->P['src'],$tpl->H);$tpl->getUrlName('play');$tpl->H = str_replace('[vod:playerinfo]', '<script>' .$tpl->getUrlInfo('play'). ' </script>'. "\n" ,$tpl->H);$tpl->H = str_replace('[vod:player]', '<script src="'.$MAC['site']['installdir'].'js/playerconfig.js"></script><script src="'.$MAC['site']['installdir'].'js/player.js"></script>'. "\n" ,$tpl->H);$tpl->playdownlist ("down");}
三,ckplayer中的mp4.php 中的内容为
<?php
header("Content-type: text/html; charset=utf-8");
// if (@$_SERVER['HTTP_REFERER'] == "") {// header('HTTP/1.1 403 Forbidden');// echo '<title>403 Forbidden</title>';// exit('403');
// }
@($url = $_GET['url']);
require 'play_config.php';if ($no_ban == 1) {echo '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MP4播放器</title>
<style type="text/css">body,html,#a1{padding:0px;margin:0px;width:100%;height:100%;background-color:#000;color:#999;}</style>
</head>
<body>
<div id="a1"></div>
<script type="text/javascript" src="/ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript">var url = "' . $url . '";var flashvars={f:url,c:0,b:1,p:1,};var params={bgcolor:"#FFF",allowFullScreen:true,allowScriptAccess:"always",wmode:"transparent"};var isiPad = navigator.userAgent.match(/iPad|iPhone|Linux|Android|iPod/i) != null;if (isiPad) {document.getElementById("a1").innerHTML = "<video src=\\"' . $url . '\\" width=\\"100%\\" height=\\"100%\\" poster=\\"http:\\/\\/i3.letvimg.com\\/lc04_live\\/201705\\/05\\/23\\/01\\/1493996499035new.gif\\" preload=\\"meta\\" controls=\\"controls\\" webkit-playsinline=\\"true\\" style=\\"width: 100%; height: 100%; background-color: rgb(0, 0, 0);\\"></video>"}else{CKobject.embedSWF("/ckplayer/ckplayer.swf","a1","ckplayer_a1","100%","100%",flashvars,params);}
</script>
</body>
</html>';
} else {function isMobile(){$useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';$useragent_commentsblock = preg_match('|\\(.*?\\)|', $useragent, $matches) > 0 ? $matches[0] : '';function CheckSubstrs($substrs, $text){foreach ($substrs as $substr) {if (false !== strpos($text, $substr)) {return true;}}return false;}$mobile_os_list = array('Google Wireless Transcoder', 'Windows CE', 'WindowsCE', 'Symbian', 'Android', 'armv6l', 'armv5', 'Mobile', 'CentOS', 'mowser', 'AvantGo', 'Opera Mobi', 'J2ME/MIDP', 'Smartphone', 'Go.Web', 'Palm', 'iPAQ');$mobile_token_list = array('Profile/MIDP', 'Configuration/CLDC-', '160×160', '176×220', '240×240', '240×320', '320×240', 'UP.Browser', 'UP.Link', 'SymbianOS', 'PalmOS', 'PocketPC', 'SonyEricsson', 'Nokia', 'BlackBerry', 'Vodafone', 'BenQ', 'Novarra-Vision', 'Iris', 'NetFront', 'HTC_', 'Xda_', 'SAMSUNG-SGH', 'Wapaka', 'DoCoMo', 'iPhone', 'iPod');$found_mobile = CheckSubstrs($mobile_os_list, $useragent_commentsblock) || CheckSubstrs($mobile_token_list, $useragent);if ($found_mobile) {return true;} else {return false;}}if (isMobile()) {echo '
<html>
<head>
<meta charset="utf8">
<title>mp4播放器</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="/ckplayer/css/wapstyle.css" rel="stylesheet">
<link href="/ckplayer/css/ionic.min.css" rel="stylesheet">
<script type="text/javascript" src="/ckplayer/jquery.min.js"></script>
</head>
<body>
<div class="video-area" id="ms_player">
<video src="' . $url . '" controls="controls" autoplay="autoplay" poster="http://i3.letvimg.com/lc04_live/201705/05/23/01/1493996499035new.gif" clas="ms_player" id="msplayer" width="100%" height="100%" style="background-color:#000;"></video>
</div>
<script type="text/javascript">
var video = document.getElementById("msplayer");
video.ontimeupdate = function() {myFunction()};
function myFunction()
{
var vTime = video.currentTime;
if (vTime>' . $time . '){
video.pause();
$("#ms_player").html("' . $wapts . '");
}
}
</script><script type="text/javascript">function ts(){alert("' . $ts . '");}setTimeout("ts()","1000"); </script>
</body>
</html>';} else {echo "\r\n<html>\r\n<head>\r\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\r\n<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'>\r\n<title>MP4播放器</title>\r\n<link href='/ckplayer/js/h5.css?v=1.0.8' rel='stylesheet'>\r\n<script src='/ckplayer/js/jquery.min.js' type='text/javascript'></script>\r\n<script src='/ckplayer/js/h5.js?v=1.0.8' type='text/javascript'></script>\r\n<style type='text/css'>body,html,#a1{padding:0px;margin:0px;width:100%;height:100%;background-color:#000;color:#999;}</style>\r\n</head>\r\n<body style='overflow-y:hidden;'>\r\n<p class='slide'>\r\n <a href='/index.php?m=user-index.html' target='_blank' class='WANG-WANG'>". $ts ."</a></p>\r\n <div style='margin:-36px auto;width:100%;height:100%;'>\r\n<div id='a1'></div>\r\n<div class='video-area' id='ms_player'></div>\r\n<script type='text/javascript' src='/ckplayer/ckplayer.js' charset='utf-8'></script>\r\n<script type='text/javascript'>\r\nvar watchTime=0;\r\nvar setT=null;\r\nfunction loadedHandler(){\r\nif(CKobject.getObjectById('ckplayer_a1').getType()){\r\nCKobject.getObjectById('ckplayer_a1').addListener('paused',pausedHandler);\r\n}\r\nelse{\r\nCKobject.getObjectById('ckplayer_a1').addListener('paused','pausedHandler');\r\n}\r\n}\r\nfunction pausedHandler(b){\r\nif(setT){\r\nwindow.clearInterval(setT);\r\n}\r\nif(!b){\r\nsetT=window.setInterval(setFunction,1000);\r\n}\r\n}\r\nfunction setFunction(){\r\nwatchTime+=1\r\nif(watchTime>=1*" . $time . "){\r\nCKobject.getObjectById('ckplayer_a1').videoClear();\r\ndocument.getElementById('a1').innerHTML = '" . $pcts . "';\r\n}\r\n}\r\nvar flashvars={f:'" . $url . "',\r\nc:0, b:1,p:1,v:100,e:1,h:1,v:100,lv:1,\r\nmy_url:encodeURIComponent(window.location.href),my_title:encodeURIComponent(document.title),loaded:'loadedHandler',b:0};\r\nvar params={bgcolor:'#000',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};\r\nCKobject.embedSWF('/ckplayer/ckplayer.swf','a1','ckplayer_a1','100%','100%',flashvars,params);\r\n</script>\r\n</div>\r\n <script type='text/javascript'>\r\n function ts(){\r\n\t alert('" . $ts . "');\r\n\t}\r\n\tsetTimeout('ts()','1000'); \r\n\t</script>\r\n\t</body>\r\n\t</html>\r\n";}
}
?>
四,ckplayer/play_config.php 文件内容为
<?php
/** 技术支持联系QQ:11338646 * 试看时间请在苹果cms网站后台设置;*/// 以下信息小白勿修改,懂代码的可以尝试修改,修改错误无法使用后果自负!
// 以下信息小白勿修改,懂代码的可以尝试修改,修改错误无法使用后果自负!
// 以下信息小白勿修改,懂代码的可以尝试修改,修改错误无法使用后果自负! // if(@$_SERVER['HTTP_REFERER'] != "" )// {// header('HTTP/1.1 403 Forbidden');// echo '<title>403 Forbidden</title>';// exit('403');// }session_start();//开启session功能.
include "../inc/conn.php";
require '../inc/config/config.php';
@($uid = intval($_SESSION['userid']));
@($usergroup = intval($_SESSION['usergroup']));//登录会员的会员组
@($vod_id = intval($_SESSION['vod_id']));//视频内容页编号
@($user_no_score = intval($_SESSION['user_no_score']));//0表示注册会员,但积分不足,1表示有积分
@($free = intval($_SESSION['free']));//1为免费 0为收费//u_plays 查是否看过 有值,说明扣分成功或vip //print_r($_SESSION);exit;
//如果是vip会员组,则跳过判断
$no_ban=0;
$time = 5;//试看几秒
$skkg = 1;//试看开关,1为开,0为禁用
if ($skkg == 0) {$no_ban = 1;//不禁止
}else{if($free==0){//收费if($uid>0){//登录会员if($usergroup==2){//vip不做判断,跳出$no_ban=1;}else{//普通会员if($user_no_score>0){//没看过.且会员积分不足,$no_ban = 0;$ts = '积分不足,收费视频需扣除'.$user_no_score.'积分,但可试看视频'.$time.'秒,VIP会员无限观看全部视频~!'; //试看弹窗提示信息 }else{//没看过.但有积分$ts = '本收费视频已级成功扣除'.$user_no_score.'积分,VIP会员无限观看全部视频哟~!'; //试看弹窗提示信息$no_ban = 1;}}}else{//游客$no_ban = 0;$ts = '游客可试看视频'.$time.'秒,VIP会员无限观看全部视频~!'; //试看弹窗提示信息}}else{$no_ban = 1;}}//PC端试看结束后提示
$pcts = '<html><head><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf8\"><meta http-equiv=\"Cache-Control\" content=\"no-transform \"><title>请加入会员后看后续视频!<\/title><meta name=\"Keywords\" content=\"\"><meta name=\"Description\" content=\"\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE8\"><link rel=\"stylesheet\" href=\"\/ckplayer\/css\/danchu.css\"><\/html><\/head><body id=\"top\" style=\"background-color:#202020\"><p style=\"height:8em\"><\/p><div class=\"cd-popup-container\"><p style=\"line-height:60px;font-size:15px\">您只能试看'.$time.'秒,加入VIP无限制哦~!!!<\/p><ul class=\"cd-buttons\"><li><a target=\"_blank\" href=\"\/index.php?m=user-reg.html\" style=\"font-size:16px\">我要注册<\/a><\/li><li><a target=\"_blank\" href=\"\/index.php?m=user-login.html\" style=\"font-size:16px\">我要登录<\/a><\/li><\/ul><\/div><\/body><\/html>'; //移动端试看结束后提示
$wapts = '<div align=\"center\" class=\"video-area\" style=\"height:100%;line-height:30px;background-color:#000;color:#fff;\"><li style=\"height:50px;\"><\/li><img src=\"\/ckplayer\/css\/sk.png\" width=\"80\"><\/li><li style=\"color:red\">试看('.$time.')秒结束啦~!<\/li><li><a href=\"\/index.php?m=user-index.html\" style=\"color:#fff;\">升级VIP无限观看【充值】<\/a><\/li><li style=\"height:15px;\"><\/li><\/div><script language=\"javascript\">setTimeout(\"top.location.href=\'/index.php?m=user-index.html\';\", 3000);<\/script>'; ?>
[中红外QCL激光器] [中红外QCL激光器]