asp 网页视频播放器程序代码(通用代码),支持avi,wmv,asf,mov,rm,ra,ram等

所属分类: 网络编程 / 网页播放器 阅读数: 511
收藏 0 赞 0 分享
思路是先取得文件的类型,并根据类型选择不同的网页播放器代码..三下五去二.....同时为了代码在以后的复用性,写成了通用的调用函数.方便以后在别的系统中调用..
现发布源代码如下:
复制代码 代码如下:

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)

其实更好的代码,在一些比较不错的在线播放器源码等,可以参考下,如:马克斯等视频播放系统。
更多精彩内容其他人还在看

html中插入rm格式视频文件的代码

在网页中(所有网页都由html组成,所以说下面的代码,可以用于任何网页,部分限制了html的网页除外
收藏 0 赞 0 分享

html中插入avi格式视频文件的代码

在网页中(所有网页都由html组成,所以说下面的代码,可以用于任何网页,部分限制了html的网页除外.
收藏 0 赞 0 分享

html中嵌入flv格式文件的代码

在网页中(所有网页都由html组成,所以说下面的代码,可以用于任何网页,部分限制了html的网页除外
收藏 0 赞 0 分享

flvplayer.swf flv视频播放器使用方法

今天由于网页上要加入一个视频文件,就研究了一下flv视频播放器flvplayer.swf
收藏 0 赞 0 分享

网页在线视频播放代码大全

本文介绍下,一些常用的网页在线视频播放代码,有需要的朋友可以参考下
收藏 0 赞 0 分享

防止SyntaxHighlighter.js的代码高亮时闪一下的解决方法

这篇文章主要介绍了防止SyntaxHighlighter.js的代码高亮时闪一下的解决方法,需要的朋友可以参考下
收藏 0 赞 0 分享

超级REAL视频播放器

超级REAL视频播放器
收藏 0 赞 0 分享

网页视频播放器程序代码(通用代码)

网页视频播放器程序代码(通用代码)
收藏 0 赞 0 分享

通用网页播放器

通用网页播放器
收藏 0 赞 0 分享

通用媒体播放器(5.5更新)

通用媒体播放器(5.5更新)
收藏 0 赞 0 分享
查看更多