欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-18 15:44:25
思路是先取得文件的类型,并根据类型选择不同的网页播放器代码..三下五去二.....同时为了代码在以后的复用性,写成了通用的调用函数.方便以后在别的系统中调用.. 现发布源代...
思路是先取得文件的类型,并根据类型选择不同的网页播放器代码..三下五去二.....同时为了代码在以后的复用性,写成了通用的调用函数.方便以后在别的系统中调用..
现发布源代码如下:
复制代码 代码如下:

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)

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