网页视频播放器程序代码(通用代码)
程序员文章站
2022-06-26 08:37:39
'*********************************************** '函数名:selplay '作 用:在网页中播放视频...
'***********************************************
'函数名:selplay
'作 用:在网页中播放视频
'参 数:strurl ---- 视频地址
strwidth ---显示视频宽
strheight ---显示视频高
'***********************************************
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)
'函数名:selplay
'作 用:在网页中播放视频
'参 数:strurl ---- 视频地址
strwidth ---显示视频宽
strheight ---显示视频高
'***********************************************
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)
上一篇: 利用伪元素来做鼠标经过有遮罩层的效果
下一篇: 网络建设的流程分享 保证合理性和最优性