国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

asp 網頁視頻播放器程序代碼(通用代碼),支持avi,wmv,asf,mov,rm,ra,ram等

2024-08-26 00:15:56
字體:
來源:轉載
供稿:網友
在給客戶做個程序時,突然遇到個問題,就是產品頁用戶提交視頻播放文件時,如何根據提交的網址內的視頻格式進行正確的播放呢....郁悶了一會,想好了思路,說動手就動手...
 
 
 
思路是先取得文件的類型,并根據類型選擇不同的網頁播放器代碼..三下五去二.....同時為了代碼在以后的復用性,寫成了通用的調用函數.方便以后在別的系統中調用.. 
現發布源代碼如下:
復制代碼代碼如下:

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) 

其實更好的代碼,在一些比較不錯的在線播放器源碼等,可以參考下,如:馬克斯等視頻播放系統。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 布拖县| 凭祥市| 阜南县| 兴安盟| 连州市| 德格县| 托克逊县| 桑日县| 兴业县| 观塘区| 丹东市| 新昌县| 丽水市| 邳州市| 邯郸市| 仁怀市| 江川县| 九寨沟县| 永修县| 宁强县| 莱芜市| 泰宁县| 璧山县| 峨边| 密山市| 琼中| 辽宁省| 长汀县| 乐业县| 营山县| 韶关市| 仪陇县| 勃利县| 格尔木市| 中西区| 建德市| 茌平县| 子长县| 依安县| 容城县| 南安市|