频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

ASP根据提交的视频格式进行正确的播放的函数

来源: 作者: 出处:巧巧读书 2007-10-06 进入讨论组

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

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

  现发布源代码如下:

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

  调用方式:

更多文章 更多内容请看流媒体解码译码技巧专题,或进入讨论组讨论。
更多专题 【深 度 阅 读】 相 关 文 章
    收藏此文】【 】【打印】【关闭
    相关图文阅读
    频道图文推荐
    健 康 咨 询
    时 尚 咨 询
    巧巧读书宗旨
    相关专题
    讨论组问题推荐
    站内各频道最新更新文档
    站内最新制作专题
    热门关键字导读
    Photoshop教 程照片处理 照片制作 PS快捷键 抠图
    计 算 机 故 障XP系统修复
    艺 术 与 设 计设计 流媒体 设计欣赏 边框
    计 算 机 安 全ARP
    站内频道文章精选
    巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章