- 4.代码使用
- 4.1 [A]swfObject调用
- 4.2 [B]object调用
- 4.3 [C]Ebemb调用
- 4.4 [D]JS形式调用
- 4.5 JS函数交互
- 4.6 广告相关
- [1] 前置广告
- [2] 视频广告
- [3] 暂停广告
- [4] 角标广告
- [5] 后置广告
- [6] 滚动文字广告
- 4.7 开灯关灯
- 4.8 高清模式
- 4.9 分享模式
- 4.10 视频模式
- 4.11 RTMP点播
- 4.12 RTMP直播
- 4.13 视频结束动作
- 4.14 色彩自定义
- 4.15 移动终端适配(New)
- 4.16 HLS直播(m3u8适配)
- 4.17 适配PC/安卓/苹果
- 4.18 收费模式(节目预览)
- 4.19 播放器logo设定
- 4.20 视频文件说明
- 4.21 提示点MoveTip
- 4.22 列表连播功能
4.4 JS形式调用
JS形式调用范例:
例(4.4)-1:js写法示例
<!--代码开始-->
<script type="text/javascript" src="/player/images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<SCRIPT LANGUAGE=JavaScript>
<!--
/**
* 极酷阳光播放器V3.5视频播放参数
* @param {Object} width 视频宽度
* @param {Object} height 视频高度
* @param {Object} imgUrl 图片地址
* @param {Object} videoUrl 视频文件地址
* @param {Object} divID 显示的divID
*/
function setVideo(width, height, imgUrl, videoUrl, divID){
var so = new SWFObject("/player/player.swf","CuSunPlayer",width, height, "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","/player/CuSunV3Set.xml");
so.addVariable("JcScpVideoPath",videoUrl);
so.addVariable("JcScpImg",imgUrl);
so.write(divID);
}
setVideo(600,400,"/player/startpic.jpg","http://demo.cuplayer.com/file/test.mp4","CuPlayer");
//-->
</SCRIPT>
</div>
<!--代码结束-->
例(4.4)-2:Ebemb调用示例2
<script type="text/javascript">
<!--
var vWidth = 600;
var vHeight = 410;
var vPlayer = "/player/player.swf";
var vSet = "/player/CuSunV3Set.xml";
var imgUrl = "/player/images/start.jpg";
var videoUrl = "http://demo.cuplayer.com/file/est.mp4";
var flashvars = "JcScpFile="+vSet+"&JcScpImg=" +imgUrl+"&JcScpVideoPath="+videoUrl+"";
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\""+ vWidth +"\" height=\""+ vHeight +"\" >");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\""+vPlayer+"\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#000000\">");
document.write("<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">");
document.write("<param name=\"FlashVars\" value=\""+flashvars+"\">");
document.write("<embed src=\""+vPlayer+"\" wmode=\"opaque\" FlashVars=\""+flashvars+"\" menu=\"false\" bgcolor=\"#000000\" quality=\"high\" width=\""+ vWidth +"\" height=\""+ vHeight +"\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
document.write("</object>");
//-->
</script>