JS函数交互

 

酷播V4.0版,对JS与AS的交互,做了全新的设计,将会极大方便开发人员实现js与as的互动。

本播放器既支持HTTP协议,也支持RTMP协议。从整体效果方面来说,配合RTMP协议来使用,效果最佳。 因为http视频时,只有缓冲过的位置,可以拖动观看(也可以点moveTip提示点快进);而RTMP协议下的视频,则可以任意拖动,moveTip提示点,也可以随时点击直接跳到该提示点。

 

网页视频播放器加载中,请稍后...

 

 

Loading...

Loading...

Loading...

输出MoveTip提示点: load...

<script type="text/javascript">
<!--
/**
* JS与AS交互及AS与JS交互酷播官方演示
* @基于酷播V4.0版
* @VERTION {V2.5} 2016/04/22
* @AS与JS交互 ---------------------
* @function {getLight} 开灯关灯
* @function {seekVideo(pars,mode)} 查询视频节点播放
* @function {playPauseVideo} 暂停(暂停播放)
* @function {resumeVideo} 暂停(继续播放)
* @function {rePlayVideo} 视频重播
* @function {stopVideo} 视频停止
* @function {getState(pars)} 获取视频状态
* @function {getTimes(pars)} 获取当前视频时间
* @function {getTotalTime(pars)} 获取视频总时长
* @function {getTotalTime(pars)} 获取视频MoveTip提示点
*/
function getLight(pars){if(pars=="open"){close_light(this);}else{close_light(this);}}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
//查询视频节点播放(与RTMP协议视频地址配合效果最佳)
function seekVideo(pars,mode){
var p = pars;
var m = mode;
thisMovie("myCuPlayer").seekVideo(pars,mode);
}
//暂停(暂停播放)
function playPauseVideo(){
thisMovie("myCuPlayer").playPauseVideo();
}
//暂停(继续播放)
function resumeVideo(){
thisMovie("myCuPlayer").resumeVideo();
}
//视频重播
function rePlayVideo(){
thisMovie("myCuPlayer").rePlayVideo();
}
//视频停止
function stopVideo(){
thisMovie("myCuPlayer").stopVideo();
}
//获取视频状态
function getState(pars){
var state = pars;
document.getElementById("state").innerHTML = "输出当前状态信息:"+state+" ";
}
//获取当前视频时间
function getTimes(pars){
var times = pars;
document.getElementById("times").innerHTML = "输出当前播放时间:"+times+" ";
}
//获取视频总时长
function getTotalTime(pars){
var totalTime = pars;
if(totalTime!=null){
document.getElementById("totalTime").innerHTML = "输出视频总时长:"+totalTime+" ";
}
}
//获取视频MoveTip提示点
function getTip(pars){
var tip = pars;
if (tip==50 || tip==80|| tip== 120){
document.getElementById("tip").innerHTML = "输出当前提示点:"+tip+" | 已执行暂停动作,是否继续播放?";
playPauseVideo();
//alert("提示点:"+tip);
}
}

//-->
</script>

<!--极酷播放器/代码开始-->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer"><b><img src="images/loading.gif" /> 网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("player.swf","myCuPlayer","700","410","9","#000000");
so.addParam("allowfullscreen","true");
so.addParam("allowscriptaccess","always");
so.addParam("wmode","opaque");
so.addParam("quality","high");
so.addParam("salign","lt");
//播放器设置文件-----------------------------
so.addVariable("JcScpFile","CuSunV4set.xml");
//视频文件及略缩图--------------------------
//so.addVariable("JcScpServer","rtmp://www.yoursite.com/vod");
so.addVariable("JcScpVideoPath","http://www.boaoforum.org/u/cms/www/201603/21104056mhqz.mp4");
so.addVariable("JcScpImg","images/startpic.jpg");
//MoveTip提示点--------------------------
so.addVariable("JcScpCuePointInfo","提示点1|提示点2|提示点3|提示点4"); //提示点信息
so.addVariable("JcScpCuePointTime","10|50|110|150"); //提示点秒数值
//-----------------------------------------
so.addVariable("ShowJcScpAVideo","no");//是否开启前置广告
so.write("CuPlayer");
</script>
<script language=javascript src="images/jquery.js" type=text/javascript></script>
<script language=javascript src="images/action.js" type=text/javascript></script>
<!--极酷播放器/代码结束-->