与ASP程序结合的目的,在于实现通过 CuPlayerSetFile.asp?id=888 这样的调用数据库id形式设置文件,来实现动态调用视频地址进行播放,实例演示:[测试id=1] [测试id=2] [测试id=3] [测试id=4]

 

示例3-6-1:网页部分代码写法参考:

<%
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>