Web page inserts a complete collection of video playback code

Source: Internet
Author: User
Tags format error handling first string goto include prefetch shuffle window
Insert | Video Play | Web page

1.avi format

The code snippet is as follows:

<object id= "video" width= "height=" 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= ">"
<param name= "Moviewindowwidth" value= ">"
<param name= "FileName" value= "/mbar.avi" >
<embed width= "height=" border= "0" showdisplay= "0" showcontrols= "1" autostart= "1" autorewind= "0" playcount= "0" moviewindowheight= "moviewindowwidth=" filename= "/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" width= "239" height= ">"
<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= "Console1" controls= "Imagewindow" height= "180" width= "I" 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 "height=" width= "352" 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= 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>

6.WMA format

Put it in <body>. Here is a partial explanation:

<object classid= "Clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id= "MediaPlayer1" > <param name= "Filename" Value= "/blog/1.wma" ><!--the location of your files;
<param name= "Playcount" value= "1" ><!--control the number of repetitions: "X" for several repeated playback several times; X=0, infinite loops. -->
<param name= "AutoStart" value= "0" ><!--control playback mode: x=1, open the Web page autoplay; x=0, play by play key. -->
<param name= "Clicktoplay" value= "1" ><!--control playback switch: x=1, mouse click to control playback or pause status; x=0, disable this feature.
<param name= "displaysize" value= "0" ><!--control Playback screen: x=0, original size; x=1, half size; x=2,2 times size. -->
<param name= "Enablefullscreen Controls" value= "1" ><!--control Toggle Full Screen: X=1, allow switching to full screen; x=0, disable this feature. -->
<param name= "Showaudio Controls" value= "1" ><!--control Volume: X=1, allowing the volume to be adjusted; x=0, the volume adjustment is prohibited.
<param name= "enablecontext Menu" value= "1" ><!--control shortcut menus: x=1, allow right-click menu; x=0, disable right-click menu. -->
<param name= "Showdisplay" value= "1" ><!--Control Copyright information: x=1, display film and author information; x=0, do not display relevant information;
</object "

7.Windows Media Player Series (different panel styles)

Comprehensive type:

<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>
<param Name=cursortype value=32512>
<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 Type:

<embed src=http://www.*.com/mediadate/lxlhbcn.asf style= "height:45px; width:190px "Type=audio/mpeg autostart=" 1 "loop=" 0 ">
</EMBED>

Label Type:

<embed width=240 height=140 transparentatstart=true animationatstart=false autostart=true autosize=false volume= 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

The appearance interface of the media player

In a Web page, you can control which parts of the media Player appear and which parts do not appear by using related properties.
The media Player includes the following elements:
Videos Display panel: Video show panels;
Video Border: frame;
Closed captioning display panel;
Track bar; Search bar;
Control bar with Audio and Position Controls: Controls with sound and position control;
Go to bar: Goto Bar;
Display panel: Show panels;
Status bar: State column;
The following properties determine which element to display:
Showcontrols property: Whether the control bar (including playback controls and optional sound and position controls) is displayed;
Showaudiocontrols property: Whether the sound control (mute button and volume slider) is displayed in the control bar;
Showpositioncontrols property: Whether to display position controls in the control bar (including backward jump, rewind, fast-forward, forward jump, preview each clip in playlist);
Showtracker property: Whether the search bar is displayed;
Showdisplay Property: Whether the display panel (used to provide information on programs and clips) is displayed;
Showcaptioning Property: Whether the caption display panel is displayed;
Showgotobar property: Whether to show the Goto bar;
ShowStatusBar property: Whether the status bar is displayed;

Play List

The media Player provides the following methods to access clips in the playlist:
Next method to jump to the next clip in the show (playlist);
Previous method, jump back to the previous clip in the program;
One feature of the media Player is the ability to preview each clip in a program, using the following properties:
PreviewMode property to determine whether the media player is currently in preview mode;
Canpreview property to determine whether the media Player is in preview mode;
In the Windows Media metafile, you can specify the preview time--previewduration for each clip, and the default preview time is 10 seconds if not specified.
You can also use the Windows Media metafile to add watermarks and banners, and the metafile also supports no gap flow switching when inserting ads.

Program Information

Use the Getmediainfostring method to return the following information about a related clip or program:
File name: File name
Titles: Title
Description: Description
Author: Author
Copyrights: Copyright
Level: Rating
Urls:logo icon, watermark, banner address
Clip information can be placed in a media file, either in a Windows Media metafile, or both. If you specify clip information in a metafile, the Getmediainfostring method returns the information in the metafile and does not return the information contained in the clip.
In a metafile, additional information can be placed in the Param tab of each clip or program. You can add as many PARAM tags as you want for each clip to store custom information or link to related sites. The information in the PARAM tab can be accessed through the GetMediaParameter method.
The following properties return information about size and time:
Imagesourceheight, Imagesourcewidth: Returns the display size of the image window;
Duration property that returns the length of the clip (in seconds), check the Isdurationvalid property to see if the property contains a valid value. (for broadcast video, its length is unpredictable).

Subtitles

You can use the. smi file to add subtitles to your program. The media Player supports the following properties to handle captions:
Samifilename property, specifying the name of the. smi file;
Samilang property that specifies the language of the marquee (using the first language if not specified);
Samistyle property, specifying the text size and style of the caption;
Showcaptioning property to determine whether the caption display panel is displayed;

Script command

With audio and video streaming, you can add script commands to streaming media files. Script commands are multiple pairs of Unicode strings synchronized with a specific time in a multimedia stream. The first string identifies the type of the outgoing command, and the second string specifies the command to be executed.
When spread is placed in a script-related time, the control sends a Scriptcommand event to the Web page, and then the event-handling process responds to the event. The script command string is passed to the event handler as a parameter to the script command event.
The media Player automatically handles the following types of inline script commands:
1)URL-type command: When a media Player control receives a URL-type command, the specified URL is loaded into the user's default browser. If the media player is embedded in a frames-only HTML file, 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 property determines which frame the URL page is loaded into.
You can decide whether to automatically handle URL-type script commands by setting the Invokeurls property. If the value of this property is false, the media Player control ignores the URL-type command. However, script command events are still triggered, which allows you to selectively handle URL-type commands.
The URL-type command specifies the relative address of the URL. The base address is specified by the BaseURL property. The command parameter for the script command event that the media Player control transmits is a well linked address.
2)FileName-type command: When the media Player control receives a filename-type command, it sets the FileName property to the file provided by the script command, and the media Player opens the file to start playing. Media Player controls always automatically handle FILENAME-type commands, unlike URL-type commands, which cannot be blocked.
3)Text command: When a media Player control receives a text-type command, it displays the contents of the command in the caption window of the control. The content can be either plain text or HTML.
4)Event Type command: When a media Player control receives an event-type command, it searches the media metafile for the NAME attribute of the event element. If the NAME property matches the second string in the script command, the Media Player control executes the entry contained in the EVENT element.
5)OpenEvent command: When a media player control receives a openevent command, it checks the EVENT element in the media metafile and opens the matching caption, but does not play until you receive a true event of the same name from the event Type command.

Catching keyboard and mouse events

The Enablecontextmenu and Clicktoplay properties provide a way for users to manipulate the image window.
If the Enablecontextmenu property is true, you can open the associated menu in the Image window by right-clicking the mouse, and if you set the Clicktoplay property to True, the user can click the Image window to play and pause the switch.
To receive mouse movement and click events, set the Sendmousemoveevents and Sendmouseclickevents properties to true. mouse events are :
MouseDown, when the user presses the mouse to produce;
MouseUp, occurs when the user releases the mouse;
MouseMove, when the user moves the mouse to produce;
Click to produce when the user clicks the mouse button on the media player;
Dbclick, which occurs when the user double-clicks the mouse button on the media player;
To receive keyboard events, set the Sendkeyboardevents property to True. Keyboard events are:
KeyDown, when the user presses a key to produce;
KeyUp, which occurs when a user releases a key;
KeyPress, occurs when the user presses and releases a key;

Monitoring flow status and network links

The flow state properties include:
Playstate: Playback status;
Openstate: Open state;
Bandwidth: bandwidth;
The supported events are:
Openstatechange: Open state change (triggered only if the Sendopenstatechangeevents property is true)
Playstatechange: Playback state changes (triggered only if the Sendplaystatechangeevents property is true)
Endofstream: Trigger at end of stream;
Newstream: Triggering when a new stream is opened;
Network receive properties include:
Receptionquality: Receive quality;
Receivedpackets: Packages received;
Lostpackets: The Lost package;
The properties of the monitoring buffer are:
Bufferingtime: Buffer time;
Bufferingcount: Buffer times;
BufferingProgress: Buffer process;
Buffering: Buffer events;

Error handling

The Media Player provides built-in error handling, which displays an error message in the dialog box or status bar. In addition, you can add your own error handlers. If the Senderrorevents property is set to True, the error box is not displayed, but the error event is sent, and if the Senderrorevents property is set to False, the error box is displayed, and the error event is sent instead.
The media Player supports the following error handling events:
Error event, refers to the occurrence of a dangerous mistake;
Warning incident, refers to the occurrence of a non dangerous error;
When your application receives an error event, you can detect the following attribute to determine the specific error message:
Haserror: Detects if the current media player has errors;
ErrorCode: Provides code values associated with this type of error;
ErrorDescription: Provide the wrong description information;
Errorcorrection: Specifies that the media player corrects this type of error;

Play CD

The media player sees the CD as a single audio stream (marked at the beginning of each track). To use a CD in a Web page, you need to set the FileName property to Cdaudi and must have 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 play the CD.
You can specify the order of play and the information for each track in the Windows Media Meta file. Examples are as follows:

<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>



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.