Js controls Windows Media Player

Source: Internet
Author: User

Windows Media Player

Html:

<Object classid = "clsid: 6BF52A52-394A-11D3-B153-00C04F79FAA6" id = "wmp">
<Param name = "URL" value = ""/> // media file address
<Param name = "rate" value = "1"/>
<Param name = "balance" value = "0"/> // audio channel 0 full channel,-100 left channel, 100 right channel
<Param name = "currentPosition" value = "0"/>
<Param name = "playCount" value = "1"/> // Number of playbacks
<Param name = "autoStart" value = "-1"/> // whether to play automatically-1 Yes, 0 No
<Param name = "currentMarker" value = "0"/>
<Param name = "invokeURLs" value = "-1"/>
<Param name = "volume" value = "50"/> // volume
<Param name = "mute" value = "0"/> '); // whether to mute-1 Yes, 0 No
<Param name = "uiMode" value = "none"/> // display all controls in player mode full (default). none is only for video windows, mini videos, and some common controls, invisiblei does not display any controls or video windows
<Param name = "stretchToFit" value = "0"/>
<Param name = "windowlessVideo" value = "0"/>
<Param name = "enabled" value = "-1"/> ');
<Param name = "no_enableContextMenu" value = "-1"/>
<Param name = "fullScreen" value = "0"/> '); // whether the screen is displayed
<Param name = "enableErrorDialogs" value = "-1"/> // whether error messages are allowed
</Object>


Javascript:


Wmp. URL = "" // playback media address
Wmp. controls. play () // start playing
Wmp. controls. stop () // stop playing
Wmp. controls. pause () // pause playback
Wmp. settings. mute = true | false // controls whether to mute
Wmp. fullScreen = true | false // determines whether the screen is full.

Get player status

Wmp. playState // player status, which consists of 1 to 10 States, as shown below

Wmp. playState = 1 // stop playing
Wmp. playState = 2 // pause playback
Wmp. playState = 3 // normal playback
Wmp. playState = 4 // search forward
Wmp. playState = 5 // search backward
Wmp. playState = 6 // buffer Processing
Wmp. playState = 7 // wait for response
Wmp. playState = 8 // The playback is complete.
Wmp. playState = 9 // connect to the media
Wmp. playState = 10 // ready

Wmp. controls. currentPositionString // obtain the current position of the media, as shown in the format
Wmp. controls. currentPosition // gets the current position of the media, which is displayed in the form of 300.001 seconds, accurate to milliseconds
Wmp. currentMedia. durationString // obtain the total length of the media, as shown in the format
Wmp. currentMedia. duration // obtain the total length of the media, which is displayed in the form of 300.001 seconds, accurate to milliseconds


Real Player

Javascript:

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


Real Player

Javascript:

Play an animation: Play ()
Stop Animation: StopPlay ()
Whether the animation is playing: IsPlaying ()
Jump to a frame: GotoFrame (frame_number)
Get the total number of frames of an animation: TotalFrames ()
Number of frames of the current animation to be returned: CurrentFrame ()
Returns the first frame of the animation: Rewind ()
Zoom in the specified area: SetZoomRect (left, top, right, buttom)
Change the animation size: Zoom (percent)
Make the animation Pan in the x and y directions: Pan (x_position, y_position, unit)
Returned animation load percentage: PercentLoaded ()
Loading Animation: LoadMovie (level_number, path)
Example: (Flash id in the webpage). LoadMovie (0, "***/***. swf ");
Movie_clip jump to the specified number of frames: TGotoFrame (movie_clip, frame_number)
Movie_clip jump to the specified tag: TGotoLabel (movie_clip, label_name)
Example: (Flash id in the webpage). TGotoFrame ("_ root. Instance name. Secondary Instance name", "tag name ");
Return movie_clip current frame: TCurrentFrame (movie_clip)
Return the current movie_clip label: TCurrentLabel (movie_clip)
Play movie_clip: TPlay (movie_clip)
Stop playing movie_clip: TStopPlay (movie_clip)
Get variable: GetVariable (variable_name)
Variable assignment: SetVariable (variable_name, value)
Call action on the specified frame: TCallFrame (movie_clip, frame_number)
Call specifies the action on the label: TCallLabel (movie_clip, label)
Get the specified attribute of movie_clip: TGetProperty (movie_clip, property)
Set the specified attribute of movie_clip: TSetProperty (movie_clip, property, number)

 


// Clear the embed object ========================================

Function removeEmbed (standard ){
Var example .doc ument. getElementsByTagName ('embed ');
For (I = object. length-1; I> = 0; I --){
If (object [I]. src. search (/\. (wav | avi | au | ra | rm | mid | wm | mp)/I )! =-1 ){
Object [I]. removeNode (true );
}
}
}
}

 

// Clear flash ============================================ =

Function removeFlash (Standard flash ){
Var example .doc ument. getElementsByTagName ('object ');
For (var I = object. length-1; I> = 0; I --){
If (object [I]. classid. toLowerCase () = 'clsid: d27cdb6e-ae6d-11cf-96b8-444553540000 '){
If (object [I]. movie. search (/\. swf/I )! =-1 ){
Object [I]. removeNode (true );
}
}
}
}
}

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.