Common web embedded player code collection

Source: Internet
Author: User
Tags prefetch return tag shuffle

The player we see on the Web page is nothing more than WMP/RealONE/Macromedia Flash Player. Others are different from panel or other controls are added, some players installed on the computer are also integrated with the decoder. The core encoding and decoding technologies are the same. For example, the most popular windows media streams on the Network (ASF, WMA, WMV format ...), real stream (RM, rmvb ...), there are also MPEG series encoding formats (MP4/MP3 format ...)
Windows Media video is a streaming media format launched by Microsoft. It is extended in the "same-door" ASF (Advanced stream format) format upgrade. in the same video quality, the WMV format is very small, so it is suitable for online playback and transmission. Windows Media player9 is compatible with all formats of WMV. The official encoder is Windows Media Encoder. However, if you want to convert high-quality WMV files, you must have a large memory to process data...
I accidentally discovered that the castpost player can define its own size. Online playback in WMV format can be said to be fast enough, then I spent a lot of effort to put some wonderful short films and some classic MTV into the WMV format. Although I cannot download them now, as long as there are not too many connected people, playing is still very smooth ^_^

WMP is added with the ActiveX decoder control, which not only supports playing music, but also flash and other video files.
<Object align = center classid = "CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95" class = Object ID = mediaplayer width = 196 Height = 196>
<Param name = showstatusbar value = 0>
<Param name = filename value = "http: // 202. 116. *. */Video/story/Chinese/hynh/B. wmv">
<Embed type = application/X-oleobject codebase = "http://activex.microsoft.com/activex/con... n/nsmp2inf. Cab # version = 5, 1, 52,701">
</Embed>
</Object>
To use WMP for continuous playback, please refer to the ASX element file usage instructions: Use ASX PlayList

The above player is old-fashioned, version 6.4! The new player appeared after mediaplayer9.0. That is to say, it can be used normally only when 9.0 or more players are installed.

The following is the new player code, which is much simpler than before:
<Object ID = "Player" Height = "64" width = "260" classid = "CLSID: 6bf52a52-394a-11d3-b153-00c04f79faa6">
<Param name = "autostart" value = "-1">
<! -- Automatic playback? -->
<Param name = "balance" value = "0">
<! -- Adjust the left-right channel balance and the old player code above -->
<Param name = "enabled" value = "-1">
<! -- Whether the player can be controlled by humans -->
<Param name = "enablecontextmenu" value = "-1">
<! -- Enable context menu -->
<Param name = "url" value = "/blog/1.wma">
<! -- Playback file address -->
<Param name = "playcount" value = "1">
<! -- Control the number of playbacks, which is an integer -->
<Param name = "rate" value = "1">
<! -- The playback speed is controlled. 1 is normal, and decimal places are allowed. -->
<Param name = "currentposition" value = "0">
<! -- Control settings: Current Position -->
<Param name = "currentmarker" value = "0">
<! -- Control settings: Current tag -->
<Param name = "defaultframe" value = "">
<! -- Display default frame -->
<Param name = "invokeurls" value = "0">
<! -- Script command setting: whether to call URL -->
<Param name = "baseurl" value = "">
<! -- Script command setting: called URL -->
<Param name = "stretchtofit" value = "0">
<! -- Scale up or not -->
<Param name = "volume" value = "50">
<! -- The default sound size is 0%-100%, and 50 is 50%. -->
<Param name = "mute" value = "0">
<! -- Mute or not -->
<Param name = "uimode" value = "mini">
<! -- Player display mode: full display all; Mini is the most simplified; none does not show the playback control, only the video window is displayed; invisible does not show all -->
<Param name = "windowlessvideo" value = "0">
<! -- If it is 0, full screen is allowed; otherwise, it can only be viewed in the window -->
<Param name = "fullscreen" value = "0">
<! -- Whether to enable automatic full screen playback -->
<Param name = "enableerrordialogs" value = "-1">
<! -- Enable error prompt report -->
<Param name = "samistyle" value>
<! -- Sami style -->
<Param name = "samilang" value>
<! -- Sami language -->
<Param name = "samifilename" value>
<! -- Subtitle id -->
</Object>

--------------------------------------------------------------------------------

RealOne Player Code:
<Object ID = "vid" classid = "CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width = 427 Height = 300>
<Param name = "_ extentx" value = "11298">
<Param name = "_ extenty" value = "7938">
<Param name = "autostart" value = "-1">
<Param name = "Shuffle" value = "0">
<Param name = "prefetch" value = "0">
<Param name = "nolabels" value = "-1">
<Param name = "src" value = "rtsp: // 211.89.225.1/encoder/cnr3";>
<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">
</Object> <Object ID = "vid2" classid = "CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width = 427 Height = 30>
<Param name = "_ extentx" value = "11298">
<Param name = "_ extenty" value = "794">
<Param name = "autostart" value = "-1">
<Param name = "Shuffle" value = "0">
<Param name = "prefetch" value = "0">
<Param name = "nolabels" value = "-1">
<Param name = "src" value = "rtsp: // 211.89.225.1/encoder/cnr3";>
<Param name = "controls" value = "controlpanel">
<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">
</Object>

--------------------------------------------------------------------------------

Looking at a lot of complicated appearances, there are actually some more player parameters, you can not...
Meanings of Real Player webpage player Parameters

Parameter: autostart attribute: true or false: Specifies whether to automatically play the specified source file
Parameter: backgroundcolor attribute: Any hexadecimal value starting with the symbol "#" or any predefined color function: Specifies the background color of the image window.
Parameter: center attribute: true or false: specifies that the part is played with the initial encoding size in the center of the image window.
Parameter: classid property: "CLSID: CFCDAA03-8BE4-1lcf-B84B0020AFBBCCFA: ** function: Specifies the unique string identifier of the ActiveX control to recognize the embedded realpalyer player.
Parameter: Console attribute: any string function: Aggregates various RealPlayer controls on the webpage so that they can be used interactively or independently without affecting each other.
Parameters: Controls attributes: imagewindow, all, controlpanel, plavbutton, playonlybutton, pausebutton, stopbutton, ffctrl, rwctrl, mutectrl, mutevolume, volume, positionslider, tacctrl, homectrl, role, infopanel, statusbar, statusfield, and positionfield: You can specify the control that is visible.
Parameter: height attribute: any integer. It specifies the height of the RealPlayer element. Unit: pixel.
Parameter: Id attribute: any string. function: specify the name of the RealPlayer element in the tag.
Parameter: imagestatus attribute: true or false: determines whether to display status information in the image window. The default value is true.
Parameter: loop attribute: true or false. function: allows you to specify whether the part has an infinite loop.
Parameter: maintainaspect attribute: true or false: by default, RealPlayer can stretch all parts to fill the entire image window.
Parameter: Name attribute: any string. function: specify a name for the RealPlayer element in the tag (ID is used in the tag)
Parameter: nojava attribute: true or false. function: Avoid starting a Java VM.
Parameter: nolabels attribute: true or false: title or copyright information cannot be displayed (it is junk when realplayer5.0 or above ...)
Parameter: nologo attribute: true or false: prevents display in the image window during RealPlayer startup
Parameter: numloop attribute: any integer function: enables you to specify the number of file loop times without the parameter loop.
Parameter: prefetch attribute: true or false: Specifies whether RealPlayer can obtain stream description information before playback. The default value is false.
Parameter: Region property: any string used together with SMIL. Allow you to specify HTML to replace smil
Parameter: scriptcallbacks attribute: A list separated by commas (,). It specifies the browser's callback monitoring (Advanced !)
Parameter: shuffle attribute: true or false: used together with a multi-file RAM file or SMIL file. Allows RealPlayer To Play files in the list randomly.
Parameter: src attribute: Any legal relative or complete URL function: Specifies the address of the playback file or source file.
Parameter: Type attribute: String function: Specify the MIME type for the embedded plug-in
Parameter: width attribute: any integer. function: Specify the width of the RealPlayer element.

RealPlayer functions, methods, and processes

This is all functions and methods of Real Player ActiveX control library (version 1.0). If you are interested, please study them.

Function getsource: widestring;
Procedure setsource (const lpsznewvalue: widestring );
Function getconsole: widestring;
Procedure setconsole (const lpsznewvalue: widestring );
Function getcontrols: widestring;
Procedure setcontrols (const lpsznewvalue: widestring );
Function getnolabels: wordbool;
Procedure setnolabels (bnewvalue: wordbool );
Function getautostart: wordbool;
Procedure setautostart (bnewvalue: wordbool );
Function getautogotourl: wordbool;
Procedure setautogotourl (bnewvalue: wordbool );
Function getvolume: smallint;
Procedure setvolume (nvol: smallint );
Function getmute: wordbool;
Procedure setmute (bmute: wordbool );
Function getloop: wordbool;
Procedure setloop (bval: wordbool );
Function getimagestatus: wordbool;
Procedure setimagestatus (benable: wordbool );
Function getpacketstotal: integer;
Function getpacketsreceived: integer;
Function getpacketsoutoforder: integer;
Function getpacketsmissing: integer;
Function getpacketsearly: integer;
Function getpacketslate: integer;
Function getbandwidthaverage: integer;
Function getbandwidthcurrent: integer;
Procedure doplaypause;
Procedure dostop;
Procedure donextitem;
Procedure doprevitem;
Function canplaypause: wordbool;
Function canstop: wordbool;
Function hasnextitem: wordbool;
Function hasprevitem: wordbool;
Function hasnextentry: wordbool;
Function haspreventry: wordbool;
Procedure donextentry;
Procedure dopreventry;
Procedure aboutbox;
Procedure editpreferences;
Procedure hideshowstatistics;
Function isstatisticsvisible: wordbool;
Procedure dogotourl (const URL: widestring; const target: widestring );
Procedure doplay;
Procedure dopause;
Function getposition: integer;
Function getplaystate: integer;
Function getlength: integer;
Function gettitle: widestring;
Function getauthor: widestring;
Function getcopyright: widestring;
Function getclipwidth: integer;
Function getclipheight: integer;
Function canplay: wordbool;
Function canpause: wordbool;
Procedure setposition (lposition: integer );
Function getnumloop: integer;
Procedure setnumloop (lval: integer );
Function getcenter: wordbool;
Procedure setcenter (bval: wordbool );
Function getnologo: wordbool;
Procedure setnologo (bval: wordbool );
Function getmaintainaspect: wordbool;
Procedure setmaintainaspect (bval: wordbool );
Function getbackgroundcolor: widestring;
Procedure setbackgroundcolor (const pval: widestring );
Function getstereostate: wordbool;
Function getlivestate: wordbool;
Function getshowstatistics: wordbool;
Procedure setshowstatistics (bval: wordbool );
Function getshowpreferences: wordbool;
Procedure setshowpreferences (bval: wordbool );
Function getshowonmouseover wordbool;
Procedure setshowabout (bval: wordbool );
Function getoriginalsize: wordbool;
Procedure setoriginalsize;
Function getdoublesize: wordbool;
Procedure setdoublesize;
Function getfullscreen: wordbool;
Procedure setfullscreen;
Function getenablecontextmenu: wordbool;
Procedure setenablecontextmenu (bval: wordbool );
Function getenableoriginalsize: wordbool;
Procedure setenableoriginalsize (bval: wordbool );
Function getenabledoublesize: wordbool;
Procedure setenabledoublesize (bval: wordbool );
Function getenablefullscreen: wordbool;
Procedure setenablefullscreen (bval: wordbool );
Function getenablemessagebox: wordbool;
Procedure setenablemessagebox (bval: wordbool );
Procedure settitle (const pval: widestring );
Procedure setauthor (const pval: widestring );
Procedure setcopyright (const pval: widestring );
Function getwantkeyboardevents: wordbool;
Procedure setwantkeyboardevents (bwantsevents: wordbool );
Function getwantmouseevents: wordbool;
Procedure setwantmouseevents (bwantsevents: wordbool );
Function getnumentries: smallint;
Function getcurrententry: smallint;
Function getentrytitle (uentryindex: smallint): widestring;
Function getentryauthor (uentryindex: smallint): widestring;
Function getentrycopyright (uentryindex: smallint): widestring;
Function getentryabstract (uentryindex: smallint): widestring;
Procedure setcanseek (bcanseek: wordbool );
Function getcanseek: wordbool;
Function getbufferingtimeelapsed: integer;
Function getbufferingtimeremaining: integer;
Function getconnectionbandwidth: integer;
Function getpreferedlanguagestring: widestring;
Function getpreferedlanguageid: integer;
Function getusercountryid: integer;
Function getnumsources: smallint;
Function getsourcetransport (nsourcenum: smallint): widestring;
Function getwanterrors: wordbool;
Procedure setwanterrors (bval: wordbool );
Function getshuffle: wordbool;
Procedure setshuffle (bval: wordbool );
Function getversioninfo: widestring;
Function getlastmessage: widestring;
Function getlasterrorseverity: integer;
Function getlasterrorrmacode: integer;
Function getlasterrorusercode: integer;
Function getlasterroruserstring: widestring;
Function getlasterrormoreinfourl: widestring;
Procedure setprefetch (bval: wordbool );
Function getprefetch: wordbool;
Procedure setregion (const pval: widestring );
Function getregion: widestring;
Function getisplus: wordbool;
Function getconsoleevents: wordbool;
Procedure setconsoleevents (bval: wordbool );
Function getdrminfo (const pval: widestring): widestring;
Property controlinterface: irealaudio read getcontrolinterface;
Property defaultinterface: irealaudio read getcontrolinterface;
 
Guide to WMP video control on Web pages

// Wmplayer. Controls. currentposition = wmplayer. currentmedia. Duration * (I/100)
//
//
//
□Playback method and attributes
In addition to playing, pausing, and stopping, the media player can also use the following attributes:
Scan-similar to the fast forward and backward functions of a video recorder;
Search (seeking) -- directly move to the specific stage time marked in the clip;

□Playback
The Media Player provides two techniques to specify the media name (CLIP) to be played. You can set the filename attribute or call the open method. If the value of the autostart attribute is true, after the filename attribute is set to the URL of the video clip, the video clip starts to play; otherwise, the video clip does not start to play, unless you call the play method. The open method starts playing asynchronously. It is not like the play method that starts playing after other processes are completed.
The Media Player provides the following attributes and methods similar to those of a video recorder to control streaming media playback:
Play, stop, and pause methods to start, stop, and pause streaming media.
Playcount attribute to set the number of playback times of a file.
Autorewind attribute to determine whether to return to the start part of the video clip when the playback is stopped.

□Audio Control
Media Player provides the following attributes to manage audio:
Balance attribute to determine the sound balance between the left and right speakers;
Volume attribute, used to increase or decrease the volume;
The mute attribute, which is used to disable or enable sound;
※You can set the showaudiocontrols attribute to true to add a sound processing control in the control bar.

□Scan
Media Player provides the following attributes for scanning:
Fastforward method, fast forward;
Fastreverse method, fast down;
Rate attribute to change the playback speed;
※To enable film editing to be scanned, set the canscan and allowscan attributes to true.

□Search
The following attributes are used for search:
The markercount attribute indicates the total number of tags in a clip;
Currentmaker, getmarkername, and getmarkertime are used to return tag information;
Markerhit event, triggered when a tag is encountered;
Currentposition attribute, current position (measured in seconds), which can be used to move the playback header to the point specified in the clip;
Positionchange event, triggered when the currentposition attribute is set;
※To search for any time, set the canseek attribute to true. To search for a tag, set the canseektomarkers attribute to true.

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

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

-

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.