Very comprehensive JavaScript controls mediaplayer and RealPlayer objects

Source: Internet
Author: User

Mediaplayer
1 Ting's Code It's really good to synchronize the Code with the lyrics. I 'd like to get a better grasp of the basics.
Play: mediaplayer. Play ()
Pause: mediaplayer. Pause ()
Location: mediaplayer. setcurrententry (lwhichentry)
Mediaplayer. Next ()
Mediaplayer. Previous ()
Loop: mediaplayer. playcount = 0
0: the clip plays repeatedly
1: once
Stop: mediaplayer. Stop ()
========================================
Allowchangedisplaysize returns or sets whether the end user can set the display size (logical type)
Allowscan returns or sets whether scanning is allowed (logical)
Animationatstart returns or sets whether to play an animation sequence (logical type) before the control starts playing)
Audiostream returns or sets the audio stream number (used for multi-audio stream editing, default:-1) (long integer)
Autorewind returns or sets whether to automatically repeat a media file after playback (logical)
Autosize returns or sets whether to automatically adjust the control size to adapt to the loaded media (logical type)
Autostart returns or sets whether to automatically start playing after loading a media file (logical)
Balance returns or sets the playing channel of the specified stereo media file (-10000 is the left channel, 10000 is the right channel, 0 is the stereo) (long integer)
Bandwidth returns or sets the bandwidth of the current file (long integer)
Baseurl returns the basic http url (string)
Bufferingcount: total buffer time for media file playback (long integer)
Bufferingprogress return buffer completion percentage (long integer)
Bufferingtime: the buffer time returned (double-precision)
Canpreview returns or sets whether the currently displayed clip can be previewed (logical)
Canscan returns or sets whether the current file supports fast forward or return (logical type)
Canseek returns or sets whether the current file can be searched and located at a certain time (logical)
Canseektomarkers returns or sets whether the file supports searching for tags (logical type)
Captioningid returns the name (string) of the frame or control displayed in the title)
Channeldescription returns the description of the radio station (string)
Channelname returns the name of the station (string)
Channelurl returns the location of the station metadata file (string)
Clicktoplay returns or sets whether the video can be paused or played by clicking an image (logical)
Clientid returns the unique identifier (string) of the client)
Codeccount returns the number of installable codecs files used (long integer)
Contactaddress: return the contact address (string) of the radio station)
Contactemail returns the contact email address (string) of the radio station)
Contactphone returns the contact number (string) of the radio station)
Creationdate: return the creation date (date type) of the clip)
Currentmarker returns or sets the current bookmarked number (long integer)
Currentposition returns or sets the current position of the clip (Double Precision)
Cursortype returns or sets the pointer type (long integer)
Defaultframe returns or sets the default target HTTP frame (string) of the control)
Displaybackcolor returns or sets the background color (ole_color value) of the display panel)
Displayforecolor returns or sets the foreground color (ole_color value) of the display panel)
Displaymode returns or sets whether to display the current position in seconds or frames (mpdisplaymodeconstants value) on the display panel)
Displaysize returns or sets the size of the image display window (mpdisplaysizeconstant value)
Duration returns or sets the playback time of a clip or clip (dual-precision)
Enablecontextmenu return or set whether to allow the use of context menu (logical)
Enabled returns or sets whether the control is available (logical)
Enablefullscreencontrols returns or sets whether full screen control is available (logical)
Enablepositioncontrols returns or sets whether location control is available (logical)
Enabletracker returns or sets whether the search bar control is available (logical)
Errorcode returns the current error code (long integer)
Errorcorrection returns the error correction type (long integer) of the current clip)
Errordescription returns the description (string) of the current error)
Filename returns or sets the name of the clip to be played (string)
Haserror indicates whether the control has an error (logical type)
Hasmultipleitems returns or sets whether the control contains content (logical) of multiple projects)
Imagesourceheight returns or sets the height of the original image (long integer) of the current clip)
Imagesourcewidth: returns or sets the width of the original image (long integer) of the current clip)
Invokeurls returns or sets whether the URL automatically sends the request (logical)
Isbroadcast returns or sets whether the source is broadcast (logical)
Isdurationvalid returns or sets whether the duration value is valid (logical)
Language returns or sets the language of the current region supported by the localization language (long integer)
Lostpackets returns the number of lost data packets (long integer)
Markercount returns the number of file bookmarks (long integer)
Mute returns or sets whether the control is playing the sound (logical)
Openstate returns the control content source status (long integer)
Playcount returns or sets the number of times a video clip is played (long integer)
Playstate returns the current operation status (long integer) of the control)
Previewmode returns or sets whether the control is in preview mode (logical)
Rate returns or sets the playback frame rate (Double Precision)
Readystate returns whether the control is ready (readystateconstant value)
Receivedpackets returns the number of received packets (long integer)
Predictionquality returns the percentage of data packets received in the last 30 seconds (long integer)
Recoveredpackets returns the number of converted data packets (long integer)
Samifilename returns or sets the closed-captioning file name (string)
Samilang returns or sets the closed captioning language (string)
Samistyle returns or sets the closed captioning style (string)
Selectionend: return or set the end position of the stream (double precision type)
Selectionstart returns or sets the starting position of the stream (double precision type)
Senderrorevents returns or sets whether the control sends an error event (logical)
Sendkeyboardevents returns or sets whether the control sends Keyboard Events (logical)
Sendmouseclickevents returns or sets whether the control sends a mouse click event (logical type)
Sendmousemoveevents returns or sets whether the control sends a mouse movement event (logical)
Sendopenstatechangeevents returns or sets whether the control sends an open status change event (logical type)
Sendplaystatechangeevents returns or sets whether the control sends a playback status change event (logical type)
Sendwarningevents returns or sets whether the control sends a warning event (logical)
Showaudiocontrols returns or sets whether to display audio control (logical)
Showcaptioning returns or sets whether to display Subtitles (logical type)
Showcontrols returns or sets whether the control panel is visible (logical)
Showdisplay returns or sets whether to display the display panel (logical)
Showgotobar returns or sets whether to display the jump bar (logical type)
Showpositioncontrols returns or sets whether to display location control (logical type)
Showstatusbar returns or sets whether to display the status bar (logical)
Showtracker returns or sets whether to display the search bar (logical type)
Sourcelink returns the path of the Content File (string)
Sourceprotocol returns the protocol used to receive data (long integer)
Streamcount returns the number of media frames (long integer)
Transparentatstart returns or sets whether the control is transparent (logical) before and after start playback)
Videoborder3d returns or sets whether the video border is displayed as 3D (logical)
Videobordercolor returns or sets the video border color (OLE _ color)
Videoborderwidth: returns or sets the video Border width (long integer)
Volume returns or sets the volume (long integer)
========================================================== ======
Mediaplayer attributes and Methods

Attribute/method name: Description:
[Basic attributes]
URL: string; specifies the media location, local or network address
Uimode: string; player interface mode, which can be full, Mini, none, invisible
Playstate: integer; playback status, 1 = stopped, 2 = paused, 3 = played, 6 = buffering, 9 = connected, 10 = ready
Enablecontextmenu: Boolean; enable/disable context 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, string format. For example"
Controls. fastforward; Fast Forward
Controls. fastreverse; fast return
Controls. Next; next
Controls. Previous; previous Curve
[Settings] WMP. settings // basic player settings
Settings. Volume: integer; volume: 0-100
Settings. autostart: Boolean; Whether to play automatically
Settings. Mute: Boolean; mute
Settings. playcount: integer; number of playbacks
[Currentmedia] WMP. currentmedia // current media attribute
Currentmedia. Duration: Double; total media Length
Currentmedia. durationstring: string; total media length, in string format. For example"
Currentmedia. getiteminfo (const string); get 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]; gets or sets the media information of the specified project. Its subattributes are the same as that of WMP. currentmedia.
The following is RealPlayer:

<Object ID = "javademo" classid = "CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" Height = "280" width = "200">
<Param name = "autostart" value = "0">
<Param name = "Shuffle" value = "0">
<Param name = "prefetch" value = "0">
<Param name = "nolabels" value = "0">
<Param name = "src" value = "yy.wma">
<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>

// Control start
<Input type = button value = play onclick = "javademo. doplay ()">
<Input type = button value = pause onclick = "javademo. dopause ()">
<Input type = button value = stop onclick = "javademo. dostop ()">
Real Player Control
Player. doplay () playback
Player. dopause () pause
Player. dostop () Stop
Player. getlength () returns the total length of the playback file (in milliseconds)
Player. getposition () returns the current time and position of the playback file (in milliseconds)
Player. getplaystate () returns the player status (0: stopped, 1: connected, 2: buffered, 3: played, 4: paused, 5: searched)
Player. setposition (n) the time point jumps to n (n is measured in milliseconds)
Player. setvolume (n) sets the volume (N ranges from 0 to 100)
Player. setmute (s) Mute (S values: true and false)
Player. setfullscreen () Full Screen
Player. setsource () sets the File Source
Media Player Control
Player. Controls. Play (); play
Player. Controls. Stop (); stop
Player. Controls. Pause (); pause
Player. Controls. currentposition: returns the current time and position of the playback file (in seconds)
Player. Controls. currentpositionstring string in time format "0: 32"
Player. currentmedia. Duration returns the total length of the playback file (in seconds)
Player. currentmedia. durationstring Time Format String "4: 34"
Player. settings. Volume volume (0-100)
Player. settings. Balance channel, which can be used to control the stereo, left and right audio channels. However, the values are unclear.
Player. settings. Mute = s mute (S values: true and false)
Player. closedcaption. captioningid: ID of the container with subtitles displayed on the webpage
Player. closedcaption. samifilename subtitle file address
Player. playstate: Player status (3: Playing, 2: paused, 1: stopped)
Attribute
All
Show all menus
Controlpanel
Display Control Panel
Infovolumepanel
Display sound panel
Infopanel
Display information panel
Statusbar
Show status Columns
Playbutton
Show start sequence
Stopbutton
Show stop renew
Volumeslider
Display sound adjustment button
Posititonslider
Display position adjustment button
Positionfield
Display Location Area
Statusfield
Show status Columns
SRC
Source location of sound
Autostart
Automatic playback?
Nolabels
Whether to display title, author, coptright, and other information
Autogotourl
Whether to automatically send URL events
Method
Aboutbox
Show about dialog box
Canplaypause
Can I pause or replay a video?
Canstop
Can RealAudio be stopped?
Doplaypause
Set playing or pause
Dostop
Stop playing
Donextitem
Play the next audio file
Doprevitem
Play the last sound file
Editpreferences
Enable Setting Dialog Box
Hasnextitem
Check whether a sound file exists.
Hasprevitem
Check whether there is a previous sound file
Hideshowstatistics
Set the dialog box for enabling or disabling connection statistics
Isstatisticsvisible
Check whether the connection statistics dialog box is enabled
Dogotourl
Load the set RealAudio audio file
Event
Onclipopened
Events triggered when RealAudio audio files are enabled
Onclipclosed
Events triggered when RealAudio audio files are disabled
Onshowstatus
Event triggered when the Status column text changes
Ongotourl
Events triggered when a URL event occurs during audio playback
The default value 0 indicates no, and the value-1 or 1 indicates yes)
<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 = "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 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 = "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>

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.