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

来源:omeweb.com 时间:2008-07-16 11:56:00 

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

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

现发布源代码如下:

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)
标签:播放器,代码,视频
0
投稿

猜你喜欢

  • adox 的vbs类,提取表名,列名等

    2008-07-02 12:37:00
  • 让自定义文件下载支持断点续传

    2009-03-11 19:45:00
  • MySQL时间字段究竟使用INT还是DateTime

    2010-03-09 14:46:00
  • phar绕过phar与HALT实现文件上传功能

    2023-05-25 06:47:36
  • Oracle数据库集复制方法浅议

    2010-07-21 12:50:00
  • 使用批处理实现mysql的数据库备份与上传

    2012-01-05 19:30:23
  • 新 API 寻求让 JavaScript 操作本地文件

    2009-11-27 18:28:00
  • 轻松掌握如何从命令行启动mysqld服务器

    2008-12-31 15:47:00
  • Mysql入门系列:MySQL数据目录的位置

    2008-11-24 12:59:00
  • 网页切片算法的若干问题

    2008-04-17 13:10:00
  • ACCESS如何打印窗体中当前显示的记录

    2008-11-20 16:31:00
  • asp生成带日期的随机数

    2008-09-03 13:13:00
  • Oracle 中文字段进行排序的sql语句

    2009-09-26 18:58:00
  • 如何实现SQL Server 2005快速Web分页

    2009-01-21 14:51:00
  • Web页脚设计的版权格式规范

    2009-07-22 20:52:00
  • oracle怎样修改表名、列名、字段类型、添加表列、删除表列

    2010-07-23 11:10:00
  • [多图]新:60个国外创意404页面设计

    2008-12-05 12:00:00
  • MYSQL和ORACLE的一些操作区别

    2008-12-18 14:33:00
  • 访问javascript私有变量

    2010-01-19 13:56:00
  • 对于任意的XML的遍历

    2008-09-05 17:11:00
  • asp之家 网络编程 m.aspxhome.com