示例3-1-1:参数使用示例说明:读取HTML参数 (完整的写法示例)

<!-- 酷播你迷(CuPlayer.com)/代码开始 -->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<strong>酷播你迷(CuPlayer.com) 提示:您的Flash Player版本过低,请<a href="http://www.CuPlayer.com/">点此进行网页播放器升级</a>!</strong></div>
<script type="text/javascript">
var so = new SWFObject("CuPlayerMiniV4.swf","CuPlayerV4","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("CuPlayerSetFile","CuPlayerSetFile.xml"); //播放器配置文件地址,例SetFile.xml、SetFile.asp、SetFile.php、SetFile.aspx
so.addVariable("CuPlayerFile","test.mp4"); //视频文件地址
so.addVariable("CuPlayerImage","images/start.jpg");//视频略缩图,本图片文件必须正确
so.addVariable("CuPlayerWidth","600"); //视频宽度
so.addVariable("CuPlayerHeight","410"); //视频高度
so.addVariable("CuPlayerAutoPlay","yes"); //是否自动播放
so.addVariable("CuPlayerLogo","logo.png"); //Logo文件地址
so.addVariable("CuPlayerPosition","bottom-right"); //Logo显示的位置
so.write("CuPlayer");
</script>
<!-- 酷播你迷(CuPlayer.com)/代码结束 -->

 

示例3-1-2:直接读取配置文件中的参数

<!-- 我爱播放器(52player.com)/代码开始 -->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<strong>我爱播放器(52player.com) 提示:您的Flash Player版本过低,请<a href="http://www.52player.com/">点此进行网页播放器升级</a>!</strong></div>
<script type="text/javascript">
var so = new SWFObject("CuPlayerMiniV4.swf","CuPlayerV4","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("CuPlayerSetFile","CuPlayerSetFile.xml"); //播放器配置文件地址,例SetFile.xml、SetFile.asp、SetFile.php、SetFile.aspx
so.write("CuPlayer");
</script>
<!-- 我爱播放器(52player.com)/代码结束 -->

 

示例3-1-3:读取HTML参数 + 读取配置文件中的参数

<!-- 我爱播放器(52player.com)/代码开始 -->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<strong>我爱播放器(52player.com) 提示:您的Flash Player版本过低,请<a href="http://www.52player.com/">点此进行网页播放器升级</a>!</strong></div>
<script type="text/javascript">
var so = new SWFObject("CuPlayerMiniV4.swf","CuPlayerV4","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("CuPlayerSetFile","CuPlayerSetFile.xml"); //播放器配置文件地址,例SetFile.xml、SetFile.asp、SetFile.php、SetFile.aspx
so.addVariable("CuPlayerFile","test.mp4"); //视频文件地址
so.addVariable("CuPlayerImage","images/start.jpg");//视频略缩图,本图片文件必须正确
so.addVariable("CuPlayerAutoPlay","yes"); //是否自动播放
so.write("CuPlayer");
</script>
<!-- 我爱播放器(52player.com)/代码结束 -->

 

示例3-1-4:处理视频结束getNext函数(实现列表连播)

<script type="text/javascript">
//例子1,视频播放结束后,跳转到指定页面,getNext函数内容,用户可以自已写
function getNext (pars){
location.href="http://www.89525.net/player/CuSunPlayerV2/" ;
}
</script>
<!-- 我爱播放器(52player.com)/代码开始 -->
<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer">
<strong>我爱播放器(52player.com) 提示:您的Flash Player版本过低,请<a href="http://www.52player.com/">点此进行网页播放器升级</a>!</strong></div>
<script type="text/javascript">
var so = new SWFObject("CuPlayerMiniV4.swf","CuPlayerV4","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("CuPlayerSetFile","CuPlayerSetFile.xml"); //播放器配置文件地址,例SetFile.xml、SetFile.asp、SetFile.php、SetFile.aspx
so.addVariable("CuPlayerFile","test.mp4"); //视频文件地址
so.addVariable("CuPlayerImage","images/start.jpg");//视频略缩图,本图片文件必须正确
so.addVariable("CuPlayerAutoPlay","yes"); //是否自动播放
so.write("CuPlayer");
</script>
<!-- 我爱播放器(52player.com)/代码结束 -->


示例3-1-5:与ASP程序结合

[本示例演示测试id=1] [测试id=2] [测试id=3] [测试id=4] 

网页部分代码写法参考:

<%
FlvID=request("id")
if FlvID="" then
FlvID=1
end if
if not isnumeric(FlvID) then
response.write("<script>alert('参数错误2!');window.close();</script>")
response.end
end if
%>
<script type="text/javascript" src="images/swfobject.js"></script>
<script type="text/javascript">
var so = new SWFObject("CuPlayerMiniV4.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("CuPlayerSetFile","CuPlayerSetFile.asp?id=<%=FlvID%>"); //播放器配置文件地址,可以接参数
so.write("CuPlayer");
</script>

程序文件CuPlayerSetFile.asp写法参考:

<%
FlvID=request("id")
if FlvID="" then
response.write("<script>alert('参数错误1!');window.close();</script>")
response.end
end if
if not isnumeric(FlvID) then
response.write("<script>alert('参数错误2!');window.close();</script>")
response.end
end if
sql="select * from JcPlayer where JcPlayer_ID="&FlvID
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "<script>window.alert('系统未找到此视频!');javascript:location='/';</script>"
response.end
else
flvurl=rs("VideoPath")
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
<content>
<CuPlayerWidth>600</CuPlayerWidth>
<CuPlayerHeight>410</CuPlayerHeight>
<CuPlayerAutoPlay>yes</CuPlayerAutoPlay>
<CuPlayerImage>images/start.jpg</CuPlayerImage>
<CuPlayerLogo>images/Logo.png</CuPlayerLogo>
<CuPlayerPosition>top-right</CuPlayerPosition>
<CuPlayerFile><%=flvurl%></CuPlayerFile>
</content>