Home > Web Front-end > JS Tutorial > body text

Summary of js wmp operation code (music broadcast function)_javascript skills

WBOY
Release: 2016-05-16 18:58:53
Original
1472 people have browsed it

WMP-Common attributes and methods in web pages

//Basic attributes
wmp.URL:String; //Specify media location, local or network address
wmp.uiMode :String; //Player interface mode, which can be Full, Mini, None, Invisible
wmp.playState:integer; //Playing status, 1=stop, 2=pause, 3=play, 6=buffering, 9=Connecting, 10=Ready
wmp.enableContextMenu:Boolean; //Enable/disable right-click menu
wmp.fullScreen:boolean; //Whether to display in full screen
//Common player controls
wmp.controls.play; //Play
wmp.controls.pause; //Pause
wmp.controls.stop; //Stop
wmp.controls.currentPosition:double; //Current progress
wmp.controls.currentPositionString:string; //Current progress, string format. Such as "00:23"
wmp.controls.fastForward; //Fast forward
wmp.controls.fastReverse; //Fast rewind
wmp.controls.next; //Next song
wmp .controls.previous; //Previous song
//Common player settings
wmp.settings.volume:integer; //Volume, 0-100
wmp.settings.autoStart:Boolean; // Whether to play automatically
wmp.settings.mute:Boolean; //Whether to mute
wmp.settings.playCount:integer; //Number of plays
wmp.settings.balance = -100; //(left sound )
wmp.settings.balance=100; //(right tone)
wmp.settings.balance=0; //(full tone)
//Commonly used current media properties
wmp.currentMedia .duration:double; //Total media length
wmp.currentMedia.durationString:string; //Total media length, string format. Such as "03:24"
wmp.currentMedia.getItemInfo(const string); //Get 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
wmp.currentMedia.setItemInfo( const string); //Set media information through attribute name
wmp.currentMedia.name:string; //Same as currentMedia.getItemInfo("Title")
wmp.network.bufferingProgress; //Buffering percentage
wmp.network.downloadProgress; //Download percentage
More comprehensive page parameter settings



























See above for relevant quotes and explanations!


How to play a music list?
Idea: To play a music list, two purposes need to be achieved, one is to loop, and the other is to determine whether the current song has been played. Only after the current song is played is completed, the loop is performed to implement detection.
var i=0;
playthis(firstmusic)
//Real-time detector, the interval is 1 second
d=setInterval(function shwotimer()
{
if(WMP.playState ==1)
{
if(i>=SoundArray.length)
{
//Clear the loop when all playback is completed
clearInterval(d);
}
else
{
//Play the next song when the playback is completed
playthis(url);
}
}
}
,1000);
such as If there are other control needs, such as pause, you can set a flag, that is, if the current pause is paused, the next step is to play, and vice versa
var pauseflag=0;
function Command_Pause()
{
if( pauseflag==0)
{
WMP.controls.Pause();
}
else
{
WMP.controls.play();
}
pauseflag=pauseflag==1?0:1;
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template