本页内容是《通用播放器程序代码》同时我们还提供济宁地区的网站建设,百度,雅虎,google的推广,点金,商友,等营销软件
请输入关键字:

标题搜索 内容搜索  

你现在所在的位置->首页->vbscript->通用播放器程序代码

通用播放器程序代码

时间:[2006-12-25 14:16:00]     作者:作者不详

给客户做个程序时,突然遇到个问题,就是产品页用户提交视频播放文件时,如何根据提交的网址内的视频格式进行正确的播放呢....郁闷了一会,想好了思路,说动手就动手...

思路是先取得文件的类型,并根据类型选择不同的网页播放器代码..三下五去二.....同时为了代码在以后的复用性,写成了通用的调用函数.方便以后在别的系统中调用..

现发布源代码如下:

Sub SelPlay(strUrl,strWidth,StrHeight)
Dim Exts,isExt
If strUrl <> "" Then
   isExt = LCase(Mid(strUrl,InStrRev(strUrl, ".")+1))
Else
   isExt = ""
End If
Exts = "avi,wmv,asf,mov,rm,ra,ram"
If Instr(Exts,isExt)=0 Then
 Response.write "非法视频文件"
Else
 Select Case isExt
  Case "avi","wmv","asf","mov"
   Response.write "<EMBED id=MediaPlayer src="&strUrl&" width="&strWidth&" height="&strHeight&" loop=""false"" autostart=""true""></EMBED>"
  Case "mov","rm","ra","ram"
   Response.Write "<OBJECT height="&strHeight&" width="&strWidth&" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
   Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
   Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""9525"">"
   Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""-1"">"
   Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""SRC"" VALUE="""&strUrl&""">"
   Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ImageWindow"">"
   Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
   Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
   Response.Write "</OBJECT>"
   Response.Write "<BR>"
   Response.Write "<OBJECT height=32 width="&strWidth&" classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"
   Response.Write "<PARAM NAME=""_ExtentX"" VALUE=""12700"">"
   Response.Write "<PARAM NAME=""_ExtentY"" VALUE=""847"">"
   Response.Write "<PARAM NAME=""AUTOSTART"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""SHUFFLE"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""PREFETCH"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""NOLABELS"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""CONTROLS"" VALUE=""ControlPanel,StatusBar"">"
   Response.Write "<PARAM NAME=""CONSOLE"" VALUE=""Clip"">"
   Response.Write "<PARAM NAME=""LOOP"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""NUMLOOP"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""CENTER"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""MAINTAINASPECT"" VALUE=""0"">"
   Response.Write "<PARAM NAME=""BACKGROUNDCOLOR"" VALUE=""#000000"">"
   Response.Write "</OBJECT>"
 End Select
End If
End Sub

调用方式:

Call SelPlay(DvUrl,280,220)

【声明】本站刊载的《通用播放器程序代码》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios

友情链接

本页内容是《通用播放器程序代码》 返回顶部
© 2001-2024 Lining studios 济宁速创科技有限公司, All Rights Reserved
 Processed Time:62.500ms
中华人民共和国信息产业部网站备案号: 鲁ICP备09103015号-1