示例3-3-1:js写法示例

<!--代码开始-->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<SCRIPT LANGUAGE=JavaScript>
<!--
/**
* 酷播迷你V4.1设置视频播放参数
* @param {Object} width 视频宽度
* @param {Object} height 视频高度
* @param {Object} autoPlay 是否自动播放 "yse"or"no"
* @param {Object} videoUrl 视频文件地址
* @param {Object} divId 显示的divID
*/
function setVideo(width, height, autoPlay, videoUrl, divID){
var so = new SWFObject("CuPlayerMiniV4.swf", "CuPlayerV4", 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("CuPlayerSetFile", "CuPlayerSetFile.xml"); //配置文件地址
so.addVariable("CuPlayerFile", videoUrl);
so.addVariable("CuPlayerImage", "start.jpg");
so.addVariable("CuPlayerWidth", width);
so.addVariable("CuPlayerHeight", height);
so.addVariable("CuPlayerAutoPlay", autoPlay);
//so.addVariable("CuPlayerLogo", "CuPlayer/logo.png"); //Logo文件地址
//so.addVariable("CuPlayerPosition", "bottom-right"); //Logo显示的位置
so.write(divID);
}
setVideo(500,300,"no","test.mp4","CuPlayer");
//-->
</SCRIPT>
</div>
<!--代码结束-->


示例3-3-2:object调用示例

<script type="text/javascript">
<!--
var vWidth = 600;
var vHeight = 410;
var vPlayer = "CuPlayerMiniV4.swf?v=4.1";
var vSet = "CuPlayerSetFile.xml";
var vImg = "images/start.jpg";
var vLogo = "images/Logo.png";
var vUrl = "test.mp4";
var vAutoplay ="no";
var flashvars = "CuPlayerSetFile="+vSet+"&CuPlayerWidth="+vWidth+"&CuPlayerHeight="+vHeight+"&CuPlayerImage="+vImg+"&CuPlayerLogo="+vLogo+"&CuPlayerFile="+vUrl+"&CuPlayerAutoPlay="+vAutoplay+"";
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"600\" height=\"400\">");
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>