How to play a video on an ASP.net webpage-supports rmvb, rm, avi, flv, swf, and 3gp

Source: Internet
Author: User
Tags first string prefetch

The code snippet is as follows:
<Object id = "video" border = "0" classid = "clsid: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<Param name = "ShowDisplay" value = "0">
<Param name = "ShowControls" value = "1">
<Param name = "AutoStart" value = "1">
<Param name = "AutoRewind" value = "0">
<Param name = "PlayCount" value = "0">
<Param name = "Appearance value =" 0 value = ">
<Param name = "BorderStyle value =" 0 value = ">
<Param name = "MovieWindowHeight" value = "240">
<Param name = "movie1_wwidth" value = "320">
<Param name = "FileName" value = "/Mbar. avi">
<Embed border = "0" showdisplay = "0" showcontrols = "1" autostart = "1" autorewind = "0" playcount = "0" moviewindowmoviewindowfilename = "/Mbar. avi "src =" Mbar. avi ">
</Embed>
</Object>
2. mpg format
The code snippet is as follows:
<Object classid = "clsid: 05589FA1-C356-11CE-BF01-00AA0055595A" id = "ActiveMovie1" height = "250">
<Param name = "Appearance" value = "0">
<Param name = "AutoStart" value = "-1">
<Param name = "AllowChangeDisplayMode" value = "-1">
<Param name = "AllowHideDisplay" value = "0">
<Param name = "AllowHideControls" value = "-1">
<Param name = "AutoRewind" value = "-1">
<Param name = "Balance" value = "0">
<Param name = "CurrentPosition" value = "0">
<Param name = "DisplayBackColor" value = "0">
<Param name = "DisplayForeColor" value = "16777215">
<Param name = "DisplayMode" value = "0">
<Param name = "Enabled" value = "-1">
<Param name = "EnableContextMenu" value = "-1">
<Param name = "EnablePositionControls" value = "-1">
<Param name = "EnableSelectionControls" value = "0">
<Param name = "EnableTracker" value = "-1">
<Param name = "Filename" value = "/mpeg/halali. mpg" valuetype = "ref">
<Param name = "FullScreenMode" value = "0">
<Param name = "MovieWindowSize" value = "0">
<Param name = "PlayCount" value = "1">
<Param name = "Rate" value = "1">
<Param name = "SelectionStart" value = "-1">
<Param name = "SelectionEnd" value = "-1">
<Param name = "ShowControls" value = "-1">
<Param name = "ShowDisplay" value = "-1">
<Param name = "ShowPositionControls" value = "0">
<Param name = "ShowTracker" value = "-1">
<Param name = "Volume" value = "-480">
</Object>
3. smi format
The code snippet is as follows:
<OBJECT id = RVOCX classid = clsid: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width = 240 height = 180>
<Param name = "_ ExtentX" value = "6350">
<Param name = "_ ExtentY" value = "4763">
<Param name = "AUTOSTART" value = "-1">
<Param name = "SHUFFLE" value = "0">
<Param name = "PREFETCH" value = "0">
<Param name = "NOLABELS" value = "-1">
<Param name = "SRC" value = "rm. rm">
<Param name = "CONTROLS" value = "ImageWindow">
<Param name = "CONSOLE" value = "console1">
<Param name = "LOOP" value = "0">
<Param name = "NUMLOOP" value = "0">
<Param name = "CENTER" value = "0">
<Param name = "MAINTAINASPECT" value = "0">
<Param name = "backgroundcolor" value = "#000000"> <embed src = "real. SMI "type =" audio/X-PN-RealAudio-plugin "console =" lele1 "controls =" imagewindow "autostart =" true "> </Object>
4. rm format
The code snippet is as follows:
<Object ID = video1 classid = "CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" Height = 288 width = 352>
<Param name = "_ extentx" value = "9313">
<Param name = "_ extenty" value = "7620">
<Param name = "autostart" value = "0">
<Param name = "Shuffle" value = "0">
<Param name = "prefetch" value = "0">
<Param name = "nolabels" value = "0">
<Param name = "src" value = "rtsp: // 203. *. *. 35/VOD/dawan-a.rm">
<Param name = "controls" value = "imagewindow">
<Param name = "console" value = "clip1">
<Param name = "loop" value = "0">
<Param name = "numloop" value = "0">
<Param name = "center" value = "0">
<Param name = "maintainaspect" value = "0">
<Param name = "backgroundcolor" value = "#000000"> <embed SRC type = "audio/X-PN-RealAudio-plugin" console = "clip1" controls = "imagewindow" autostart = "false">
</Object>
5. WMV Format
The code snippet is as follows:
<Object ID = "nsplay" width = 200 Height = 180 classid = "CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase = "http://activex.microsoft.com/activex/controls/mplayer/en
/Nsmp2inf. cab # version = 6,4, 5,715 "standby =" loading Microsoft Windows Media Player components... "type =" application/X-oleobject "align =" right "hspace =" 5 ">
<Param name = "autorewind" value = 1>
<Param name = "FILENAME" value = "/blog/******. wmv">
<Param name = "showcontrols" value = "1">
<Param name = "showpositioncontrols" value = "0">
<Param name = "showaudiocontrols" value = "1">
<Param name = "showtracker" value = "0">
<Param name = "showdisplay" value = "0">
<Param name = "showstatusbar" value = "0">
<Param name = "showgotobar" value = "0">
<Param name = "showcaptioning" value = "0">
<Param name = "autostart" value = 1>
<Param name = "volume" value = "-2500">
<Param name = "animationatstart" value = "0">
<Param name = "transparentatstart" value = "0">
<Param name = "allowchangedisplaysize" value = "0">
<Param name = "allowscan" value = "0">
<Param name = "enablecontextmenu" value = "0">
<Param name = "clicktoplay" value = "0">
</Object>
Reply
6.wma format
In <body>. Some explanations are as follows:
<Object classid = "clsid: 22D6F312-B0F6-11D0-94AB-0080C74C7E95" id = "MediaPlayer1"> <param name = "Filename" value = "/blog/1.Wma"> <! -- Location of your file -->
<Param name = "PlayCount" value = "1"> <! -- Control repeated times: "x" indicates the number of repeated playback times. x = 0 indicates an infinite loop. -->
<Param name = "AutoStart" value = "0"> <! -- Control the playback mode: x = 1. Enable automatic playback on the webpage; x = 0. Press the seek key to play the video. -->
<Param name = "ClickToPlay" value = "1"> <! -- Control the playback switch: x = 1. You can click to control the playback or pause status. x = 0 to disable this function. -->
<Param name = "DisplaySize" value = "0"> <! -- Control the playback screen size: x = 0, original size; x = 1, half size; x = 2, 2 times size. -->
<Param name = "EnableFullScreen Controls" value = "1"> <! -- Control switching full screen: x = 1, allow switching to full screen; x = 0, disable this function. -->
<Param name = "ShowAudio Controls" value = "1"> <! -- Volume Control: x = 1. Allow volume adjustment; x = 0. Disable volume adjustment. -->
<Param name = "enablecontext menu" value = "1"> <! -- Shortcut menu: x = 1. Right-click menu is allowed; X = 0. Right-click menu is disabled. -->
<Param name = "showdisplay" value = "1"> <! -- Control copyright information: x = 1. The information about the movie and the author is displayed. x = 0. No relevant information is displayed. -->
</Object>
7. Windows Media Player series (different panel styles)
Comprehensive:
<Object classid = CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95 codebase = "http://activex.microsoft.com/activex/controls/mplayer
/En/nsmp2inf. Cab # version = 6, 1, 5,217"
Id = mediaplayer type = application/X-oleobject width = 210 Height = 340 standby = "loading Microsoft Windows Media Player components..." viewastext align = middle>
<Param name = audiostream value =-1>
<Param name = autosize value = 0>
<Param name = autostart value = 1>
<Param name = animationatstart value = 0>
<Param name = allowscan value =-1>
<Param name = AllowChangeDisplaySize value = 0>
<Param name = AutoRewind value = 0>
<Param name = Balance value = 0>
<Param name = BaseURL value = "">
<Param name = BufferingTime value = 5>
<Param name = CaptioningID value = "">
<Param name = ClickToPlay value = 0>
& Lt; param name = CursorType value = 32512 & gt;
<Param name = CurrentPosition value =-1>
<Param name = CurrentMarker value = 0>
<Param name = DefaultFrame value = 1>
<Param name = DisplayBackColor value = 0>
<Param name = DisplayForeColor value = 16777215>
<Param name = DisplayMode value = 0>
<Param name = DisplaySize value = 0>
<Param name = Enabled value =-1>
<Param name = EnableContextMenu value =-1>
<Param name = EnablePositionControls value = 0>
<Param name = EnableFullScreenControls value = 0>
<Param name = EnableTracker value = 1>
<Param name = Filename value = "http: // 202. 102. *. */flash/2/fff.swf">
<Param name = InvokeURLs value =-1>
<Param name = Language value =-1>
<Param name = Mute value = 0>
<Param name = PlayCount value = 1>
<Param name = PreviewMode value = 0>
<Param name = Rate value = 1>
<Param name = SAMILang value = "">
<Param name = SAMIStyle value = "">
<Param name = SAMIFileName value = "">
<Param name = SelectionStart value = 0>
<Param name = SelectionEnd value = true>
<Param name = SendOpenStateChangeEvents value =-1>
<Param name = SendWarningEvents value =-1>
<Param name = SendErrorEvents value =-1>
<Param name = SendKeyboardEvents value = 0>
<Param name = SendMouseClickEvents value = 0>
<Param name = SendMouseMoveEvents value = 0>
<Param name = SendPlayStateChangeEvents value =-1>
<Param name = ShowCaptioning value = 0>
<Param name = ShowControls value = 1>
<Param name = ShowAudioControls value = 1>
<Param name = ShowDisplay value = 1>
<Param name = ShowGotoBar value = 1>
<Param name = ShowPositionControls value = 1>
<Param name = ShowStatusBar value = 1>
<Param name = ShowTracker value = 1>
<Param name = TransparentAtStart value = 0>
<Param name = VideoBorderWidth value = 0>
<Param name = VideoBorderColor value = 0>
<Param name = VideoBorder3D value = 0>
<Param name = Volume value =-1070>
<Param name = WindowlessVideo value = 1>
</Object>
Simple:
<EMBED src = http: // www. *. com/mediadate/lxlhbcn. asf style = "HEIGHT: 45px; WIDTH: pixel PX" type = audio/mpeg AUTOSTART = "1" loop = "0">
</EMBED>
Tag type:
<Embed width = 240 height = 140 transparentatstart = true animationatstart = false autostart = true autosize = false volume = 100 displaysize = 0 showdisplay = true showstatusbar = true showcontrols = true showaudiocontrols = true showtracker = true showpositioncontrols = true balance = true src = "http: // www. *. com/mediadate/lxlhbcn. asf ">
</Embed>
Reference content
Media Player appearance Interface
On the webpage, you can use relevant attributes to control which parts of the Media Player appear and which parts do not appear.
Media players include the following elements:
Video Display Panel: the Video Display Panel;
Video Border: Video Border;
Closed Captioning Display Panel; subtitle Display Panel;
Track Bar; search Bar;
Control Bar with Audio and Position Controls: Control Bar with sound and Position Control;
Go To Bar: Go To the Bar;
Display Panel: Display Panel;
Status Bar: Status Bar;
The following attributes are used to determine which element to display:
ShowControls attribute: whether to display the control bar (including the playback control and optional sound and position control );
ShowAudioControls properties: whether to display the sound control (mute button and volume slider) in the control bar );
ShowPositionControls attribute: whether to display the Position Control in the control bar (including Backward Jump, fast back, fast forward, forward jump, preview each clip in the playback list );
ShowTracker property: whether to display the search bar;
ShowDisplay attribute: whether to display the display panel (used to provide program and clip information );
ShowCaptioning attribute: whether to display the subtitle display panel;
ShowGotoBar attribute: whether to show and go to the bar;
ShowStatusBar attribute: whether to display the status bar;
Playlist
The Media Player provides the following methods to access the clips in the playlist:
Next method, jump to the Next clip in the Program (playlist;
The Previous method jumps back to the Previous clip in the program;
One feature of a Media Player is to preview every clip in a program using the following attributes:
The PreviewMode attribute determines whether the media player is in preview mode;
The CanPreview attribute determines whether the media player is in preview mode;
In the windows Media element file, you can specify the preview time-PREVIEWDURATION for each clip. If not, the default preview time is 10 seconds.
You can also use the Windows Media meta file to add watermarks and banners. The Meta File also supports non-gap stream switching when inserting advertisements.
Program Information
You can use the GetMediaInfoString method to return the following information about related clips or programs:
File name: File name
Title: Title
Description: Description
Author: Author
Copyright: Copyright
Level: Rating
URLs: logo icon, watermark, banner address
Editing information can be stored in a media file, a Windows Media meta file, or both. If the clip information is specified in the Metafile, the information in the Metafile is returned using the GetMediaInfoString method, instead of the information contained in the clip.
In the Metafile, additional information can be placed in the PARAM tag of each clip or program. You can add any number of PARAM tags for each clip to store custom information or link to related sites. The information in the PARAM tag can be accessed using the GetMediaParameter method.
The following attributes return information about the size and time:
ImageSourceHeight and ImageSourceWidth: return the display size of the image window;
Duration Attribute. The length of the clip (in seconds) is returned. to check whether this attribute contains valid values, check the isdurationvalid attribute. (The length of a broadcast video is unpredictable ).
Subtitle
You can use the. SMI file to add subtitles for your program. Media players support the following attributes to process Subtitles:
Samifilename attribute, specifying the name of the. SMI file;
Samilang attribute, specify the subtitle language (if not specified, use the first language );
Specifies the subtitle text size and style;
The showcaptioning attribute determines whether to display the subtitle display panel;
Script command
With audio and video streams, you can add script commands to streaming media files. The script command is a multi-to-Unicode string that Synchronizes time with a specific time in a multimedia stream. The first string identifies the type of the command to be issued, and the second string specifies the command to be executed.
When streaming is placed at a script-related time, the control will send a scriptcommand event to the webpage, and then the event processing process will respond to the event. The script command string is passed to the event processor as a parameter of the script command event.
The Media Player automatically processes the following types of embedded script commands:
1) URL-based command: when the media player control receives a URL-based Command, the specified URL will be loaded to your default browser. If the media player is embedded in an HTML file with frame separation, the URL page can be loaded into the frame specified by the script command. If the script command does not specify a frame, the defaultframe attribute determines which frame the URL page is loaded.
You can set the invokeurls attribute to determine whether to automatically process URL-type script commands. If the value of this attribute is false, the Media Player control ignores URL commands. However, the script command event will still be triggered, which allows you to selectively process URL-type commands.
The URL Command specifies the relative address of the URL. The base address is specified by the BaseURL attribute. The command parameter of the script command event sent by the Media Player control is the link address.
2) FILENAME command: when the media player control receives a FILENAME command, it sets the FileName attribute to the file provided by the script command, and then the Media Player starts playing the file. Media Player controls always process FILENAME commands automatically. Unlike URL commands, they cannot be disabled.
3) TEXT command: when the media player control receives a TEXT command, it displays the command content in the control's subtitle window. The content can be plain text or HTML.
4) EVENT-Type COMMAND: when the media player control receives an EVENT-type command, it searches for the NAME attribute of the EVENT element in the media element file. If the NAME attribute matches the second string in the script command, the Media Player control executes the entries contained in the EVENT element.
5) OPENEVENT-Type COMMAND: when the media player control receives an OPENEVENT-type command, it checks the EVENT element in the media element file and opens the matched title, but does not play the video, wait until you receive the real EVENT with the same name from the EVENT command.
Capture keyboard and mouse events
The EnableContextMenu and ClickToPlay attributes provide users with a method to perform cao in the image window.
If the EnableContextMenu attribute is true, right-click the image window to open the association menu. If the ClickToPlay attribute is set to true, you can click the image window to switch between playing and pausing.
To receive mouse movement and click events, set the SendMouseMoveEvents and SendMouseClickEvents attributes to true. Mouse events include:
MouseDown, which is generated when you press the mouse;
MouseUp, generated when the user releases the mouse;
MouseMove, generated when the user moves the mouse;
Click, which is generated when you Click the mouse button on the media player;
DbClick, which is generated when you double-click the mouse button on the media player;
To receive Keyboard Events, set the SendKeyboardEvents attribute to true. Keyboard Events include:
KeyDown, generated when the user presses the next key;
KeyUp, generated when the user releases a key;
KeyPress, generated when the user presses and releases a key;
Monitoring stream status and network connection
Flow status attributes include:
PlayState: playback status;
OpenState: open;
Bandwidth: Bandwidth;
Supported events include:
OpenStateChange: changes the open status (triggered only when the SendOpenStateChangeEvents attribute is true)
PlayStateChange: changes the playback status (triggered only when the SendPlayStateChangeEvents attribute is true)
EndOfStream: triggered when the stream ends;
NewStream: triggered when a new stream is opened;
Network receiving attributes include:
Predictionquality: receiving quality;
ReceivedPackets: received packages;
LostPackets: The Lost package;
Monitoring buffer attributes include:
BufferingTime: buffer time;
BufferingCount: Buffer count;
Bufferingprogress: Buffer process;
Buffering: buffering events;
Error Handling
Media Player provides the built-in error handling function-displaying error messages in the dialog box or status bar. In addition, you can add an error handler by yourself. If the senderrorevents attribute is set to true, the error box is not displayed, but an error event is sent. If the senderrorevents attribute is set to false, the error box is displayed, but an error event is sent.
Media Player supports the following error handling events:
An error occurs when a dangerous error occurs;
A warning event indicates a non-dangerous error;
When your application receives an error event, you can check the following attributes to determine the specific error message:
Haserror: checks whether the current media player has an error;
Errorcode: Provides the code value related to this type of error;
Errordescription: Provide the error description;
Errorcorrection: Specifies the media player to correct errors of this type;
Play CD
Media players regard CD as a single audio stream (marked at the beginning of each audio track. To use CD in a webpage, you must set the filename attribute to cdaudi with a colon as follows:
<HTML>
<Head> <title> Cd audio playback example </title> <Body>
<Object ID = "mediaplayer"
CLASSID = "CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95"
WIDTH = "320"
HEIGHT = "508"
STYLE = "position: absolute; left: 0px; top: 70px;">
<Param name = "FileName" VALUE = "cdaudi">
<Param name = "AutoStart" VALUE = "0">
<Param name = "ShowControls" VALUE = "1">
<Param name = "ShowStatusBar" VALUE = "1">
<Param name = "ShowDisplay" VALUE = "1">
</OBJECT>
</BODY>
</HTML>
Then you can use the Play method to Play the CD.
You can specify the playing sequence and information of each audio track in the windows Media element file. Example:
<Asx version = "3.0">
<TITLE> CD Audio with the Media Player </TITLE>
<AUTHOR> Windows Media Technologies </AUTHOR>
<COPYRIGHT> (c) 1999, Microsoft, Inc. </COPYRIGHT>
<ENTRY>
<TITLE> Track 1: Title 1 </TITLE>
<REF href = "/blog/cdaudi"/>
<Startmarker number = "1"/>
<Endmarker number = "2"/>
</ENTRY>
<ENTRY>
<TITLE> Track 2: Title 2 </TITLE>
<REF href = "/blog/cdaudi"/>
<Startmarker number = "2"/>
<Endmarker number = "3"/>
</ENTRY>
<ENTRY>
<TITLE> Track 3: Title 3 </TITLE>
<REF href = "/blog/cdaudi"/>
<Startmarker number = "3"/>
<Endmarker number = "4"/>
</ENTRY>
<ENTRY>
<TITLE> Track 4: Title 4 </TITLE>
<REF href = "/blog/cdaudi"/>
<Startmarker number = "4"/>
</ENTRY>
</ASX>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.