Common Properties and methods of the Windows Media Player Control

Source: Internet
Author: User
Tags prefetch shuffle
Common Properties and methods of the Windows Media Player Control Author: Admin Date:-12-14 font size: small medium and large windows mediaplayer controls are often used in programming, but there are many attributes and methods that do not know how to use them. (The usage in Javascript is almost identical ).

Assume that the control is named WMP.

Property/Method Name: Note:
[Basic attributes]
URL: string; Specifies the media location, local address or network address
Uimode: string; Player interface mode, which can be full, Mini, none, invisible
Playstate: integer; Playing status, 1 = stopped, 2 = paused, 3 = playing, 6 = buffering, 9 = connecting, 10 = ready
Enablecontextmenu: Boolean; Enable/disable right-click menu
Fullscreen: Boolean; Whether to display in full screen
[Controls] WMP. Controls // basic player control
Controls. play; Play
Controls. Pause; Pause
Controls. Stop; Stop
Controls. currentposition: Double; Current Progress
Controls. currentpositionstring: string; Current progress, in string format. For example"
Controls. fastforward; Fast forward
Controls. fastreverse; Quick Return
Controls. Next; Next song
Controls. Previous; Last Song
[Settings] WMP. settings // basic player settings
Settings. Volume: integer; Volume, 0-100
Settings. autostart: Boolean; Automatic playback?
Settings. Mute: Boolean; Mute?
Settings. playcount: integer; Playback times
[Currentmedia] WMP. currentmedia // current media attribute
Currentmedia. Duration: Double; Total media Length
Currentmedia. durationstring: string; The total length of the media, in string format. For example"
Currentmedia. getiteminfo (const string ); Obtain the current media information "title" = media title, "author" = artist, "Copyright" = copyright information, "Description" = media content description, "duration" = duration (seconds), "filesize" = file size, "filetype" = file type, "sourceurl" = original address
Currentmedia. setiteminfo (const string ); Set media information by attribute name
Currentmedia. Name: string; Same as currentmedia. getiteminfo ("title ")
[Currentplaylist] WMP. currentplaylist // attributes of the current playlist
Currentplaylist. Count: integer; Number of media contained in the current playlist
Currentplaylist. item [integer]; Obtains or sets the media information of a specified project. Its Attributes are the same as those of WMP. currentmedia.

For more information, see the Windows Media Player 9 SDK documentation.

Web Applications Code :
<Object classid = "CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95" id = "mediaplayer1" width = "286" Height = "225">
<Param name = "audiostream" value = "-1">
<Param name = "autosize" value = "-1">
<! -- Whether to automatically adjust the playback size -->
<Param name = "autostart" value = "-1">
<! -- Automatic playback? -->
<Param name = "animationatstart" value = "-1">
<Param name = "allowscan" value = "-1">
<Param name = "allowchangedisplaysize" value = "-1">
<Param name = "autorewind" value = "0">
<Param name = "balance" value = "0">
<! -- Left-right channel balance, leftmost-9640, rightmost 9640 -->
<Param name = "baseurl" value>
<Param name = "bufferingtime" value = "15">
<! -- Buffer time -->
<Param name = "captioningid" value>
<Param name = "clicktoplay" value = "-1">
<Param name = "cursortype" value = "0">
<Param name = "currentposition" value = "0">
<! -- The current playback progress-1 indicates that the playback progress remains unchanged. 0 indicates that the start unit is seconds. For example, 10 indicates that the playback starts from 10th seconds. The value must be-1.0 or greater than or equal to 0. -->
<Param name = "currentmarker" value = "0">
<Param name = "defaultframe" value>
<Param name = "displaybackcolor" value = "0">
<Param name = "displayforecolor" value = "16777215">
<Param name = "displaymode" value = "0">
<Param name = "displaysize" value = "0">
<! -- Video 1-50%, 0-100%, 2-200%, 3-full screen, other values for 0 processing, decimal rounding, and then processing by the front -->
<Param name = "enabled" value = "-1">
<Param name = "enablecontextmenu" value = "-1">
<! -Right-click the menu and choose Menu Control>
<Param name = "enablepositioncontrols" value = "-1">
<Param name = "enablefullscreencontrols" value = "-1">
<Param name = "enabletracker" value = "-1">
<! -- Whether to allow pulling the playback progress bar to play anywhere -->
<Param name = "FILENAME" value = "http://01.wma" valuetype = "Ref">
<! -- Playback file address -->
<Param name = "invokeurls" value = "-1">
<Param name = "language" value = "-1">
<Param name = "mute" value = "0">
<! -- Mute or not -->
<Param name = "playcount" value = "10">
<! -- Indicates the number of replay times. If the value is 0, it indicates the number of replay times. -->
<Param name = "previewmode" value = "-1">
<Param name = "rate" value = "1">
<! -- Playback speed control. The value 1 indicates normal. decimals are allowed. -->
<Param name = "samistyle" value>
<! -- Sami style -->
<Param name = "samilang" value>
<! -- Sami language -->
<Param name = "samifilename" value>
<! -- Subtitle id -->
<Param name = "selectionstart" value = "-1">
<Param name = "selectionend" value = "-1">
<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">
<! -- Whether to display subtitles. It is a piece of black, and there will be a large piece of black below, which is generally not displayed -->
<Param name = "showcontrols" value = "-1">
<! -- Display control, such as playing, stopping, and pausing -->
<Param name = "showaudiocontrols" value = "-1">
<! -- Display volume control -->
<Param name = "showdisplay" value = "0">
<! -- Display program information, such as copyright -->
<Param name = "showgotobar" value = "0">
<! -- Enable context menu -->
<Param name = "showpositioncontrols" value = "-1">
<! -- Whether to display forward, backward, and list. If displayed, it is usually gray and uncontrollable. -->
<Param name = "showstatusbar" value = "-1">
<! -- Current playback information, indicating whether the video is being played, total playback time, and current playback time -->
<Param name = "showtracker" value = "-1">
<! -- Whether to display the current playback trace, that is, the current playback progress bar -->
<Param name = "transparentatstart" value = "-1">
<Param name = "videoborderwidth" value = "0">
<! -- The width of the display part. If the value is smaller than the video width, the minimum value is the video width, or the video width is increased to the specified value and the height is automatically increased. this change only changes the size of the black box around and does not change the video size -->
<Param name = "videobordercolor" value = "0">
<! -- Display the color of the black box, which is an RGB value. For example, FFFF00 is yellow. -->
<Param name = "videoborder3d" value = "0">
<Param name = "volume" value = "0">
<! -- Volume size. A negative value indicates the impairment of the current volume. The value automatically takes the absolute value. The maximum value is 0 and the minimum value is-9640. -->
<Param name = "windowlessvideo" value = "0">
<! -- If it is 0, full screen is allowed; otherwise, it can only be viewed in the window -->
</Object>

The above is old-fashioned code, and the following is new-style

<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 = "http://01.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>

In general, there are also differences between the two versions of the player, but you need to select the Player Based on your actual needs.

Next we will introduce the meanings of parameters of the Real Player webpage media player.

Meanings of 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.

The attribute meaning of controls... 

Component: imagewindow
Role: video display area

Component: All
Purpose: Embed all buttons, slide bars, and information panels of realplaver.

Component: controlpanel
Purpose: display all the control buttons, as well as the position slide and speaker icons, and the slide for adjusting the sound size.

Component: playbutton
Purpose: display the play and pause buttons.

Component: playonlybutton
Purpose: only display the playback button.

Component: pausebutton
Purpose: only the pause button is displayed.

Component: stopbutton
Purpose: only the stop button is displayed.

Component: ffctrl
Purpose: only display the fastforward button

Component: rwctrl
Purpose: only display the rewind button

Component: mutectrl
Purpose: display only the speaker icon and use it as the mute button.

Component: mutevolume
Purpose: display the small speaker icon (for Mute) and the slider on it for adjusting the volume

Component: volumeslider
Purpose: only display the vertical volume slide

Component: positionslider
Purpose: Display horizontal sliding bars

Component: tacctrl
Purpose: display the horizontal message box with title, author, and copyright information displayed in turn.

Component: homectrl
Purpose: display a small real ID

Component: infovolumepanel
Purpose: display the black message box. The title, author, and copyright information are displayed in green. The speaker icon and sound adjustment slide are displayed on the right hand side.

Component: infopanel
Role: Same as above, but no mute button or sound adjustment slide

Component: statusbar
Purpose: display the horizontal message box, including the part information, such as the part time and network status.

Component: statusfield
Function: similar to statusbar, but only displays the message area and network messages, for example, "re-buffenng ..."

Component: positionfield
Function: a small black message box that displays the length of the entire file segment and the position of the current frame in the segment.

Embedded Real Player

Program code <Object ID = "rplayer" classid = "CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" Height = "100%" width = "100%">
<Param name = "_ extentx" value = "23627">
<Param name = "_ extenty" value = "15187">
<Param name = "autostart" value = "-1">
<Param name = "Shuffle" value = "0">
<Param name = "prefetch" value = "0">
<Param name = "nolabels" value = "0">
<Param name = "src" value = "test. 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">
</Object>

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 getshowabout: 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.

[This log was edited by admin at,-12-18.]
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.