4.1 swfObject1.5调用

 

swfObject调用,是指通过第三方flash加载模块( swfobject.js ),调用本款flash播放器。虽然swfobject.js并不是adobe官方提供的,但由于其使用方便,并且swfobject参数的写法,简洁明了,所以本站比较推荐使用这种调用方式:

 

 

例(4.1)-1:swfObject模式调用示例1

<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"><b>网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("/Player/player.swf","ply","520","325","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/CuSunV4Set.xml");
so.addVariable("JcScpVideoPath","http://demo.cuplayer.com/file/test.mp4");
so.addVariable("JcScpImg","/player/Images/startpic.jpg");
so.write("CuPlayer");
</script>

当您使用swfobject方式来调用播放器时,请务必确保swfobject.js文件的地址是正确的,否则,将不能正常显示播放器,将显示“网页视频播放器加载中,请稍后...

 

例(4.1)-2:swfObject模式调用示例2

<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"><b>网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("/player/player.swf?FlvID=745","ply","520","325","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/CuSunV4Set.asp");
so.write("CuPlayer");
</script>

与php,asp程序交互的范例 ( 实现调用数据库中视频地址 ),更详细介绍,请参考:
PHP : http://www.cuplayer.com/cuplayer/help/Help62.html

ASP:http://www.cuplayer.com/cuplayer/help/Help61.html

 

例(4.1)-3:swfObject模式调用示例3

<!--极酷播放器/代码开始-->
<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"><b><img src="/player/images/loading.gif" /> 网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("/player/player.swf","ply","600","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","/player/CuSunV4set.xml"); //配置文件地址
//视频文件及略缩图--------------------------
//so.addVariable("JcScpServer","rtmp://www.yoursite.com/vod"); //流媒体服务器地址
so.addVariable("JcScpVideoPath","http://demo.cuplayer.com/file/test.mp4"); //视频地址
so.addVariable("JcScpVideoPathHD","http://demo.cuplayer.com/file/test.mp4"); //高清视频地址
so.addVariable("JcScpImg","/player/images/startpic.jpg"); //视频图片
so.addVariable("JcScpAutoPlay","yes"); //是否自动播放
so.addVariable("JcScpStarTime","0"); //起始时间点(暂未启用)
so.addVariable("JcScpEndTime","0"); //结束时间点
so.addVariable("JcScpCuePointInfo","开始点|考题开始|结束点"); //提示点信息
so.addVariable("JcScpCuePointTime","50|110|150"); //提示点秒数值
//-前置Flash广告-----------------------------
so.addVariable("ShowJcScpAFront","yes"); //是否显示前置广告
so.addVariable("JcScpCountDownsPosition","top-left"); //倒计时位置
so.addVariable("JcScpCountDowns","5"); //广告倒计时位置
so.addVariable("JcScpAFrontW","600"); //前置广告宽度
so.addVariable("JcScpAFrontH","410"); //前置广告宽度
so.addVariable("JcScpAFrontPath","/player/images/a650x418.swf"); //前置广告地址
so.addVariable("JcScpAFrontLink","http://demo.cuplayer.com/CuSunPlayer/demo1.html"); //前置广告链接
//-视频广告参数-----------------------------
so.addVariable("ShowJcScpAVideo","no"); //是否显示前置视频广告
//so.addVariable("JcScpAVideoServer","rtmp://www.yoursite.com/vod"); //前置视频广告服务器
so.addVariable("JcScpAVideoPath","http://demo.cuplayer.com/file/ad1.mp4"); //前置视频广告地址
so.addVariable("JcScpAVideoLink","http://demo.cuplayer.com/CuSunPlayer/demo2.html"); //前置视频广告链接
//-暂停广告参数-----------------------------
so.addVariable("ShowJcScpAPause","yes"); //是否显示暂停广告
so.addVariable("JcScpAPauseW","300"); //暂停广告地址
so.addVariable("JcScpAPauseH","250"); //暂停广告高度
so.addVariable("JcScpAPausePath","/player/images/a300x250.swf"); //暂停广告地址
so.addVariable("JcScpAPauseLink","http://demo.cuplayer.com/CuSunPlayer/demo3.html"); //暂停广告链接
//-角标广告参数-----------------------------
so.addVariable("ShowJcScpACorner","yes"); //是否显示角标广告
so.addVariable("JcScpACornerW","85"); //角标广告宽度
so.addVariable("JcScpACornerH","50"); //角标广告高度
so.addVariable("JcScpACornerPath","/player/images/a370x250.swf"); //角标广告地址
so.addVariable("JcScpACornerPosition","bottom-right"); //角标广告位置
so.addVariable("JcScpACornerLink","http://demo.cuplayer.com/CuSunPlayer/demo4.html"); //角标广告链接
//-后置广告参数-----------------------------
so.addVariable("ShowJcScpAEnd","yes"); //是否显示后置广告
so.addVariable("JcScpAEndW","400"); //后置广告宽度
so.addVariable("JcScpAEndH","300"); //后置广告高度
so.addVariable("JcScpAEndPath","/player/images/a400x300.swf"); //后置广告地址
so.addVariable("JcScpAEndLink","http://demo.cuplayer.com/CuSunPlayer/demo5.html"); //后置广告链接
//-滚动文字广告参数-----------------------------
so.addVariable("ShowJcScpAMoveText","yes"); //是否滚动文字广告
//-----------------------------------------
so.addVariable("JcScpSharetitle","标题信息"); //视频标题信息
so.write("CuPlayer");
</script>
<!--极酷播放器/代码结束-->

 

例(4.1)-4:swfObject模式调用示例4 ( 带防盗链地址/带key地址的调用方式/带参数地址的调用方式 )

<!--极酷播放器/代码开始-->
<script type="text/javascript" src="/player/js/swfobject.js"></script>
<div class="video" id="CuPlayer"><b><img src="/player/images/loading.gif" /> 网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
myurl=encodeURIComponent("http://myspcs.oss-cn-shanghai.aliyuncs.com/mytest.mp4?OSSAccessKeyId=9AQVxUGnXUxXWHn3&Expires=1481696979&Signature=I72oei5kGNMEbGpd4wMYFgh5HlM%3D");
var so = new SWFObject("/player/player.swf","ply","600","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","/player/CuSunV4set.xml"); //配置文件地址
//视频文件及略缩图--------------------------
//so.addVariable("JcScpServer","rtmp://www.yoursite.com/vod"); //流媒体服务器地址
so.addVariable("JcScpVideoPath",myurl); //视频地址
so.addVariable("JcScpImg","/player/images/startpic.jpg"); //视频图片
so.addVariable("JcScpAutoPlay","yes"); //是否自动播放
so.write("CuPlayer");
</script>
<!--极酷播放器/代码结束-->

 


我要下载 获取使用帮助