WMP and RealPlayer space commands

Source: Internet
Author: User

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, 0: stopped)

========================================================== ====================

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

Many times, in addition to text and images, the website will be perfect if two songs or even videos are added. Although there are many ways to add audio and video, it is most convenient to directly implement multimedia playback by embedding a Microsoft Media Player. The Code is as follows:

Program code
<Object class = Object ID = mediaplayer classid = CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95>
<Embed type = application/X-oleobject codebase = http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename = Mp src = playback file path> </embed> </Object>

Immediately, the webpage has a powerful and comprehensive all-around player.
Many times, things may have ended here, but the demand is ever-changing. Sometimes we want to add a full screen button to the player and sometimes choose a playlist, in other cases, an error is automatically prompted ...... Then we may need to work a little bit more on this player, or even re-customize a playback interface that is more suitable for our own needs, then the following content will be used.

Program code
<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://happy.hustonline.net/music/play.aspx mid = 0010330a67b5318a">
<! -- 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 -->

These parameters can be used to control most of the player attributes.

Program code
Document. mplay. Play ();
Document. mplay. setfullscreen ();
......

You can call the Player Object method for control.

Program code
<Script language = "JavaScript" for = "mediaplayer" event = "endofstream">
Alert ("playing is complete. Thank you for listening. ");
</SCRIPT>

Event is used to respond to and process the feedback.

 

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.