网页视频播放器程序代码通用代码_ASP教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:趣味访客计数器设计两则
访客计数器作为网站不可缺少的部分,不仅可以记录网站被访问的次数,而且可以通过生动有趣的设计来加强网页的趣味性和可观赏性,使访客计数器成为网页上 的一个风景。下面介绍两种轻松设计趣

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

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

现发布源代码如下:

以下为引用的内容:
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)

本文收集整理自互联网,若您是原文作者,请来信更改作者及出处Post#vip.qq.com(把#改为@)

分享:推荐:ASP初学者常用源代码总结篇
1.获得系统时间:   <%=now()%> 2.取得来访用的IP:   <%=request.serverVariables("remote_host")%> 3.获得系统,浏览器版本:   <script>

来源:模板无忧//所属分类:ASP教程/更新时间:2008-08-22
相关ASP教程