asp. net implements an online music player example
- 2020-11-30 08:15:52
- OfStack
<HTML>
<HEAD><TITLE>Playback Example</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
function addmedia(url)
{
// Player.controls.stop(); // Stop the player
// alert(Player.versionInfo); // Version information of the player
// Get to the Player Object to add media permissions to the playlist
document.getElementById("MediaPlayer").settings.requestMediaAccessRights("full");
// Gets the current playlist
var playlist=MediaPlayer.currentPlaylist;
// new 1 A specified URL the Media
var currMedia = MediaPlayer.newMedia(url);
// The new Media item Add to the list of players
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); // Removes items 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(); // Let the player start playing
}
// Add the 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"/>
<!-- Whether to play automatically -->
<param name="Balance" value="0"/>
<!-- Adjust left and right channel balance , Same as the old player code above -->
<param name="enabled" value="1"/>
<!-- Whether the player can be controlled by human -->
<param name="EnableContextMenu" value="-1"/>
<!-- Whether to enable the context menu -->
<param name="url" value=""/>
<!-- The address of the file to play -->
<param name="PlayCount" value="1"/>
<!-- Play time control , As an integer -->
<param name="rate" value="1"/>
<!-- Playback rate control ,1 For the normal , Allow the decimal ,1.0-2.0-->
<param name="currentPosition" value="0"/>
<!-- The control set : The current position -->
<param name="currentMarker" value="0"/>
<!-- The control set : The current mark -->
<param name="defaultFrame" value="0"/>
<!-- Display default frame -->
<param name="invokeURLs" value="0"/>
<!-- Script command Settings : Whether to call URL-->
<param name="baseURL" value=""/>
<!-- Script command Settings : The called URL-->
<param name="stretchToFit" value="0"/>
<!-- Whether to stretch to scale -->
<param name="volume" value="50"/>
<!-- Default sound size 0%-100%,50 For the 50%-->
<param name="mute" value="0"/>
<!-- If quiet -->
<param name="uiMode" value="Full"/>
<!-- Player display mode :Full Reveal all ;mini The most simplified ;None Playback controls are not displayed , Only the video window is displayed ;invisible Do not show all -->
<param name="windowlessVideo" value="0"/>
<!-- If it is 0 Full screen is allowed , Otherwise you can only view it in a window -->
<param name="fullScreen" value="0"/>
<!-- Start playing automatically full screen -->
<param name="enableErrorDialogs" value="0"/>
<!-- Whether error prompt reporting is enabled -->
<param name="SAMIStyle" value=""/>
<!--SAMI style -->
<param name="SAMILang" value=""/>
<!--SAMI language -->
<param name="SAMIFilename" value=""/>
<!-- subtitles 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><br><br><br>
<input type="checkbox" name="song" value ="mms://pub1.qmoon.net/911pop?cccode=cc1276"> Qmoon music station <br>
<input type="checkbox" name="song" value ="mms://live.rgd.com.cn/914"> Guangdong News Radio <br>
<input type="checkbox" name="song" value ="mms://live.rgd.com.cn/993"> The Sound of Guangdong Music <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 playlists " onClick = "clearlist();"> <br>
<INPUT TYPE = "BUTTON"ID = "add" Name="add" VALUE = "添加到播放列表"onClick = "addUrlToList();"><input type="Text" name="songURL" value ="http://">
</BODY>
</HTML>