吉吉影音在马克斯程序(MaxCMS)调用方法

吉吉影音在马克斯程序(MaxCMS)调用方法

郑重提醒:您在修改网站相关文件时,请先备份好相关文件。点击这里下载吉吉影音MAXCMS版   点击这里下载吉吉影音安装页面素材包
 

1、配置

找到文件/inc/playerKinds.xml,将以下一行代码加入文件中并保存

<player open="1" sort="100" flag="吉吉影音" des="jjvod-P2P"><intro><![CDATA<[a href="http://www.jjvod.com" target="_blank">
需要下载吉吉影音JJVOD播放器</a>]]></intro></player>

2、修改模板\template\default\html\play.html

在head部分<script src="/{maxcms:sitepath}js/play.js"></script>的下面加上一行:

<script src="/{maxcms:sitepath}js/jjplay.js"></script>

注意这里jjplay.js是吉吉影音专有的js文件,必须在play.js的后面加载,如果你站改过play.js文件名称,请找对文件位置。

3、jjplay.js代码分析

var jjvod_w = 650;//播放器宽度
var jjvod_h = 500;//播放器高度
var jjvod_ad = 'http://player.jjvod.com/ad.html';//缓冲和暂停广告
var jjvod_soft = '/js/jjvod_install.html'; //下载地址,渠道可直接在下载页面设置
var jjvod_notice = '/js/notice.html'; //非IE内核提示页面


if(typeof(VideoListJson) == 'undefined'){
    VideoListJson = [];
    VideoInfoList = VideoInfoList.split('$$$');
    for(var i = 0; i < VideoInfoList.length; i++){
        var vod = VideoInfoList[i].split('$$');
        VideoListJson[i] = [vod[0], vod[1].split('#')];
    }
}


viewplay2 = viewplay;
viewplay = function(param1,param2){
	getplay = function(param1, param2) {
        var x = VideoListJson,mov,Arr;
        if (x.length > 0) {
			 mov = new String(VideoListJson[param1][1][param2]);
			 Arr = mov.split('$');
            return [VideoListJson[param1][0], Arr[0], Arr[1]];
        } else {
            return ['', '', ''];
        }
    };
    var a = VideoListJson[param1][1][param2];
    playdata = getplay(param1, param2); // 0 -> 集 1 -> 地址

	var playername= playdata[0];//播放器名称
	var vodname = playdata[1];//影片名称
	var url = playdata[2];//播放地址
    if(playername=="吉吉影音" || playername=="jjvod"){
        addjjvod(url);
    }else{
        return viewplay2(param1,param2);
    }
}

//播放状态控制
function jjvodstatus(offest){
    if(document.getElementById('jjvodPlayer').PlayState==3){
        document.getElementById('jjad').style.display='none';
    }else if(document.getElementById('jjvodPlayer').PlayState==2 || document.getElementById('jjvodPlayer').PlayState==4){
        document.getElementById('jjad').style.display='block';
    }
}
 //JJVOD代码
function addjjvod(url){
if(!!window.ActiveXObject || "ActiveXObject" in window){
	adh=jjvod_h-63;
	document.write("<div style='position:relative'>");
	document.write('<div id="jjad" style="position:absolute; z-index:1001"><iframe marginWidth="0" marginHeight="0" src="'+jjvod_ad+'" frameBorder="0" width="'+jjvod_w+'" scrolling="no" height="'+adh+'" id="wdqad" name="wdqad"></iframe></div>');
	document.write("<object classid='clsid:C56A576C-CC4F-4414-8CB1-9AAC2F535837' width='"+jjvod_w+"' height='"+jjvod_h+"' id='jjvodPlayer' name='jjvodPlayer' onerror=\"document.getElementById('jjvodPlayer').style.display='none';document.getElementById('wdqad').src='"+jjvod_soft+"';\"><PARAM NAME='URL' VALUE='"+url+"'><param name='Autoplay' value='1'></object>");
	document.write("</div>");
	setInterval('jjvodstatus()','1000');
}else{
	document.write('<iframe src="'+jjvod_notice+'" frameborder="0" width="640" height="468" scrolling="no"></iframe>');
}
}

说明:MAXCMS调用播放器部分用到了viewplay()函数,我们重写了该函数,如果是获取到播放器名称是吉吉影音的则调用该播放器。

3、在后台资源中添加jjvod资源,如:

BD$jjhd://10014|342bcf5156458e8828f9d56b7882c226a65adf2a|KARA-STEP.

来源: www.3gmfw.cn 作者: 网络 时间: 2014-05-01 13:04:00