Javascript controls the operation object tag player. getlength ()

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.