In the client to do a program, suddenly encountered a problem, that is, product page users submit video playback files, how to submit the site in accordance with the video format of the correct playback it .... Depressed for a while, think good idea, say hands on the hands ...
The idea is to get the type of file first and choose a different Web player code based on the type. Three, five, two. At the same time, for the reuse of the code in the future, write a universal call function. Convenient to call in other systems later.
Now publish the source code as follows:
The following are the referenced contents: 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 "Illegal video files" 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 Mode:
The following are the referenced contents: Call Selplay (dvurl,280,220) |
This paper collects and collates from the Internet, if you are the original author, please write a letter to change the author and the source post#chinaz.com (change # to @)