Copy codeThe Code is as follows:
<HTML>
<HEAD> <TITLE> Playback Example </TITLE>
</HEAD>
<BODY>
<Script language = "JavaScript">
Function addmedia (url)
{
// Player. controls. stop (); // stop the Player.
// Alert (Player. versionInfo); // the version of the Player.
// Obtain the permission to add media to the Player playlist.
Document. getElementById ("MediaPlayer"). settings. requestMediaAccessRights ("full ");
// Obtain the current playlist
Var playlist = MediaPlayer. currentPlaylist;
// Create a Media file with a specified URL
Var currMedia = MediaPlayer. newMedia (url );
// Add the new Media item to the player list
Playlist. appendItem (currMedia );
}
Function clearlist ()
{
// MediaPlayer. currentPlaylist. count returns the number of songs in the list.
While (MediaPlayer. currentPlaylist. count> 0 ){
Var item = MediaPlayer. currentPlaylist. item (MediaPlayer. currentPlaylist. count-1 );
MediaPlayer. currentPlaylist. removeItem (item); // delete an item from the playlist
}
}
Function addSeletedSongToPlayList ()
{
Clearlist ();
Var selectItem = document. getElementsByName ("song ");
// Alert (selectItem. length );
For (var I = 0; I <selectItem. length; I ++)
{
If (selectItem [I]. checked = true)
{
// Alert (selectItem [I]. value );
Addmedia (selectItem [I]. value );
}
}
// Alert (MediaPlayer. currentPlaylist. count );
MediaPlayer. controls. play (); // start playing the player.
}
// Add a song to the playlist
Function addUrlToList (){
Addmedia (document. getElementById ("songURL"). value );}
</Script>
<Object classid = "CLSID: 6BF52A52-394A-11d3-B153-00C04F79FAA6" name = "MediaPlayer" width = "320" height = "240" id = "MediaPlayer" style = "filter: gray ()">
<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 = ""/>
<! -- 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 = "0"/>
<! -- 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 = "Full"/>
<! -- 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 = "0"/>
<! -- Enable error prompt report -->
<Param name = "SAMIStyle" value = ""/>
<! -- SAMI style -->
<Param name = "SAMILang" value = ""/>
<! -- SAMI language -->
<Param name = "SAMIFilename" value = ""/>
<! -- Subtitle ID -->
<Embed id = "MediaPlayer" autostart = "1" clicktoplay = "0" width = "320" height = "240" showaudiocontrols = "1" autorewind = "0" autosize =" 0 "showcontrols =" 1 "align =" bottom "showstatusbar =" 1 "showdisplay =" 0 "animationatstart =" 1 "src =" "showtracker =" 1 "transparentatstart =" 0 "type =" application/x-mplayer2 "showgotobar =" 0 "pluginspage =" "defaultframe =" datawindow "border =" 1 "showcaptioning =" 0 "enablecontextmenu =" 1 "showpositioncontrols =" 0 "allowscan =" 1 "invokeurls =" 0 "/>
</Object>
<Script> addSeletedSongToPlayList (); </script>
<Br>
<Input type = "checkbox" name = "song" value = "mms: // pub1.qmoon.net/911pop? Cccode = cc1276 "> qingting music station <br>
<Input type = "checkbox" name = "song" value = "mms: // live.rgd.com.cn/914"> Guangdong News Agency <br>
<Input type = "checkbox" name = "song" value = "mms: // live.rgd.com.cn/993"> Guangdong Music voice <br>
<Br> <input type = "BUTTON" ID = "play" Name = "play" VALUE = "play the selected song" onClick = "addSeletedSongToPlayList ();">
<Input type = "BUTTON" ID = "clear" Name = "clear" VALUE = "clear playlist" onClick = "clearlist ();"> <br>
<Input type = "BUTTON" ID = "add" Name = "add" VALUE = "add to playlist" onClick = "addUrlToList (); "> <input type =" Text "name =" songURL "value =" http: // ">
</BODY>
</HTML>