在线客服QQ: 176797520 极酷FlvPlayer在线客服 酷播网页视频播放器

与.NET(ASPX)结合的应用

高级应用可以实现通过获取FlvID或ListID这样的参数,传给JcScpFile[配置文件],配置文件接收传过来的FlvID或ListID,再进行查询数据库,最终匹配出对应的配置文件参数,从而播放视频。
简要过程说明(本例以php为例,其过程与ASP实际是类似的):
1. /Player/player.swf?FlvID=745,此处写入视频ID;
2. JcScpFile[配置文件]/Player/CuSunV2Set.aspx会接收以上传过来的FlvID=745,此时,也就是相当于/Player/CuSunV2Set.aspx?FlvID=745
3. 现在很清楚了,就是在/Player/CuSunV2Set.aspx?FlvID=745中,程序获取FlvID=745,再进行查询数据库,匹配得出对应的配置文件中视频地址的参数,从而实现播放了。不理解[ 双重参数机制 ]的用户,可以点击观看这个说明>>

以下为ASPX调用程序文件的范例,如果用户须要以下范例的完整测试文件包,请联系本Q:261532593.

Demo2.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Demo2.aspx.vb" Inherits="aspx_player_Demo2" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>极酷阳光播放器(CuSunPlayerV2.0)</title>
<script type="text/javascript" src="Images/swfobject.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div class="close_light_bg" id="close_light_bg"></div>
<div class="video" id="CuPlayer"><b>网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("player.swf?FlvID=<%= FlvID %>", "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", "CuSunV2set.aspx");
//视频文件及略缩图--------------------------
so.addVariable("JcScpImg", "Images/startpic.jpg");
so.write("CuPlayer");
</script>
<h1> 极酷阳光播放器V2.5版演示2</h1>
</form>
</body>
</html>

Demo2.aspx.vb

Partial Class aspx_player_Demo2
Inherits System.Web.UI.Page
Public FlvID As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
FlvID = Request.QueryString("id")
'如果没有取到id值,就赋一个默认值,这里赋了一个0
If FlvID = "" Then
FlvID = "0"
End If
End If
End Sub
End Class

CuSunV2set.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="CuSunV2set.aspx.vb" Inherits="aspx_player_CuSunV2set" Debug="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>

CuSunV2set.aspx.vb

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="CuSunV2set.aspx.vb" Inherits="aspx_player_CuSunV2set" Debug="true" %>
Imports System.IO
Partial Class aspx_player_CuSunV2set
Inherits System.Web.UI.Page
Function GetVideoPath(ByVal id As String) As String
Dim path As String
Dim sql As String
'用sql语句从数据库中查询到普通视频地址,取值并返回
sql = "select 普通视频地址 from 视频库 where id='" & id & "'"
path = "test.mp4"
Return path
End Function
Function GetVideoPathHD(ByVal id As String) As String
Dim path As String
Dim sql As String
'用sql语句从数据库中查询到高清视频地址,取值并返回
sql = "select 高清视频地址 from 视频库 where id='" & id & "'"
path = "http://demo.cuplayer.com/file/test.mp4"
Return path
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Str As String '用于拼接xml文件
Dim id As String
If Not IsPostBack Then
id = Request.QueryString("FlvID")
'如果没有读取到id值则赋值0,为默认值
If id = "" Then
id = 0
End If
Response.Clear()
Response.ContentType = "text/xml"
Response.Charset = "GB2312"
Str = "<?xml version=""1.0"" encoding=""GB2312""?>"
Str += "<CuPlayer>"
Str += "<Player_Set "
Str += "JcScpBufferTime = ""5"" "
Str += "JcScpVolume = ""75"" "
Str += "JcScpCode = ""utf8"" "
Str += "JcScpImgDisplay = ""no"" "
Str += "JcScpAutoHideControl = ""yes"" "
Str += "JcScpControlHideTime = ""0.5"" "
Str += "JcScpControlHeight = ""40"" "
Str += "JcScpShowList = ""yes"" "
Str += "JcScpAutoRepeat = ""no"" "
Str += "JcScpAutoPlay = ""yes"" "
Str += "JcScpsetMode = ""1"" "
Str += "JcScpAFrontCanClose = ""no"" "
Str += "JcScpShowRightmenu = ""yes"" "
Str += "JcScpShareMode =""JcScpVideoPath"" "
Str += "/>"
Str += "<Logo_Set "
Str += "JcScpLogoDisplay = ""yes"" "
Str += "JcScpLogoPath = ""Images/logo.png"" "
Str += "JcScpLogoPosition = ""top-left"" "
Str += "JcScpLogoWidth =""165"" "
Str += "JcScpLogoHeight =""75"" "
Str += "JcScpLogoAlpha = ""1"" "
Str += "/>"
Str += "<Flashvars_Set "
Str += "JcScpServer="""" "
Str += "JcScpVideoPath=""" & GetVideoPath(id) & """ " '默认画质下需要播放的视频地址.
Str += "JcScpVideoPathHD=""" & GetVideoPathHD(id) & """ " '高清画质下需要播放的视频地址.
Str += "JcScpImg =""Images/flashChangfa2.jpg"" "
Str += "JcScpStarTime = ""0"" "
Str += "JcScpEndTime = ""0"" "
Str += "ShowJcScpAFront = ""yes"" "
Str += "JcScpCountDowns = ""3"" "
Str += "JcScpCountDownsPosition = ""top-right"" "
Str += "JcScpAFrontW = ""645"" "
Str += "JcScpAFrontH = ""300"" "
Str += "JcScpAFrontPath = ""Images/SevenColorPlayer_650x418.swf"" "
Str += "JcScpAFrontLink = ""http://yxp.163.com/act/20120214.html"" "
Str += "ShowJcScpAVideo = ""no"" "
Str += "JcScpAVideoPath = ""http://www.cnsuning.com/snsite/uploadfile/video/20120708/ee6e7ed8.flv"" "
Str += "JcScpAVideoLink = ""http://yxp.163.com/act/20120214.html"" "
Str += "ShowJcScpAPause = ""yes"" "
Str += "JcScpAPausePath = ""Images/SevenColorPlayer_a1.swf"" "
Str += "JcScpAPauseW = ""375"" "
Str += "JcScpAPauseH = ""230"" "
Str += "JcScpAPauseLink = ""http://yxp.163.com/act/20120214.html"" "
Str += "ShowJcScpACorner = ""yes"" "
Str += "JcScpACornerPath = ""Images/SevenColorPlayer_a10.swf"" "
Str += "JcScpACornerW = ""80"" "
Str += "JcScpACornerH = ""50"" "
Str += "JcScpACornerPosition = ""top-right"" "
Str += "JcScpACornerLink = ""http://yxp.163.com/act/20120214.html"" "
Str += "JcScpAEndPath = ""Images/Cover_changfa.jpg"" "
Str += "JcScpAEndW = ""400"" "
Str += "JcScpAEndH = ""200"" "
Str += "JcScpAEndLink = ""http://yxp.163.com/act/ShowJcScpAEnd466.html"" "
Str += "/>"
Str += "<SkinColor_Set "
Str += "JcScpBackcolor = ""0x000000"" "
Str += "JcScpBackcolortop = ""0x353535"" "
Str += "JcScpLightcolor = ""0xcfcfcf"" "
Str += "JcScpFontcolor = ""0xffffff"" "
Str += "JcScptimebg =""0x393939"" "
Str += "JcScpLoadbar = ""0x898989"" "
Str += "JcScpLoaded = ""0x4d4b4b"" "
Str += "JcScpLoadbg = ""0x000000"" "
Str += "JcScpPlayBtn = ""0x2d2d2d"" "
Str += "JcScpBar = ""0xffffff"" "
Str += "/> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_changfa.jpg</filename> "
'Str += "<title>122形象篇《角度篇》</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_parent</target> "
'Str += "</thumbnail> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_everytime.jpg</filename> "
'Str += "<title>233《枪王ewewe告片2010年7月2日全国公映</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_blank</target> "
'Str += "</thumbnail> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_everytime.jpg</filename> "
'Str += "<title>2010EveryTime</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_self</target> "
'Str += "</thumbnail> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_changfa.jpg</filename> "
'Str += "<title>《枪王之王》发布预告片2010年7月2日全国公映</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_blank</target> "
'Str += "</thumbnail> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_qiang.jpg</filename> "
'Str += "<title>《魔发奇缘1111》1600万周末票房称雄</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_self</target> "
'Str += "</thumbnail> "
'Str += "<thumbnail> "
'Str += "<filename>images/P_changfa.jpg</filename> "
'Str += "<title>形象篇《角度篇》</title> "
'Str += "<url>/player/CuSunPlayerV1/cusunplayer238.html</url> "
'Str += "<target>_parent</target> "
'Str += "</thumbnail> "
Str += "</CuPlayer>"
Response.Write(Str)
Response.End()
End If
End Sub

End Class

如果用户须要以上范例的完整测试文件包,请联系本Q:261532593.