asp.net implementation of online music player sample

Source: Internet
Author: User

  This article mainly introduces the ASP.net implementation of online music player examples, need friends can refer to the following

  Code as follows: <HTML>      <head><title>playback example</title>      </HEAD>      <BODY>      <script language= "JavaScript" >  & nbsp   function   Addmedia (URL)       {     //Player.controls.stop ()     &N Bsp          /stop player    /alert (player.versioninfo); Player version information    /get permission to add media to the Player object's playlist       document.getElementById ("MediaPlayer"). Settings.requestmediaaccessrights ("full");     /get current playlist            & nbsp   VAR playlist=mediaplayer.currentplaylist;     //New media         for a specified URL            var currmedia = Mediaplayer.newmedia (URL);     //Add New Media item To player list                   &NBSP  playlist.appenditem (Currmedia);     }      function  clearlist ()       {                  //mediaplayer.currentplaylist.count return Number of songs in list     while (mediaplayer.currentplaylist.count>0) {              &N Bsp                  var            item =mediaplay Er.currentPlaylist.item (mediaplayer.currentplaylist.count-1);                & nbsp                mediaplayer.currentplaylist.removeitem (item);                /            Delete item from playlist   &NBSP ;                    }     }      function  addseletedsongtoplaylist ()   &NBSp   {                              cle Arlist ();                         var SelectItem = Docume Nt.getelementsbyname ("song");     /alert (selectitem.length);              for (var i=0;i<selectitem.length;i++)                           {      if (selectitem[i].checked==true)   &NBSP ;                            {     &NB Sp    //alert (selectitem[i].value);                                 Addmedia (s Electitem[i].value);                                }&NBSp                        }     //alert (MEDIAPL Ayer.currentPlaylist.count);                          mediaplayer.controls.play ();            //let player start to play    }     //Add song to playlist     function   Addurltolist () {                         addmedia ( document.getElementById ("Songurl"). Value);       </script>      <object classid= "CLSID : 6bf52a52-394a-11d3-b153-00c04f79faa6 "name=" MediaPlayer "width=" "height=" "The" "Id=" MediaPlayer "" style= "filter: Gray () ">          <param name=" AutoStart "value=" 1 "/>          <!--AutoPlay-->          <param name= "Balance" value= "0"/>          <!--adjust the left and right channel balance, with the above old player code-->          <param name= "Enabled" value= "1"/>          <!--player can be manipulated-->          <param name= "Enablecontextmenu" Value= "1"/>          <!--enable context menu-->      <param name= "url" value= ""/>          <!--playback file address-->          <param name= "Playcoun T "value=" 1 "/>          <!--playback times control, for integer-->          <param NA Me= "Rate" value= "1"/>          <!--playback rate control, 1 for normal, allow decimal,1.0-2.0-->      & nbsp   <param name= "currentposition" value= "0"/>          <!--control settings: Current Location-->  & nbsp       <param name= "Currentmarker" value= "0"/>          <!--control settings: Current markup--& gt;      &NBSp   <param name= "defaultframe" value= "0"/>          <!--show default frame-->    & nbsp     <param name= "invokeurls" value= "0"/>          <!--script command settings: whether to call url-->& nbsp         <param name= "BaseURL" value= ""/>          <!--script command settings: called ur l-->          <param name= "Stretchtofit" value= "0"/>          & lt;! --scaling-->          <param name= "volume" value= "a"/>        &NBS P <!--default sound size 0%-100%,50 50%-->          <param name= "Mute" value= "0"/>          <!--mute-->          <param name= "Uimode" value= "full"/>          <!--player display mode: full display all; Mini simplifies; None does not display playback control, only the video window is displayed; invisible all-->          <param name= "Windowlessvideo" value= "0"/>          <!--if it is 0, you can allow full screen, otherwise you can view only in the window-->& nbsp         <param name= "fullscreen" value= "0"/>          <!--start playing automatically full Screen-->          <param name= "enableerrordialogs" value= "0"/>        & nbsp <!--enable Error reporting-->          <param name= "Samistyle" value= ""/>      & nbsp   <!--Sami style-->          <param name= "Samilang" value= ""/>          <!--Sami language-->          <param name= "Samifilename" value= ""/>  & nbsp       <!--subtitle id-->      <embed id= "MediaPlayer" autostart= "1" clicktoplay= "0" Width= "height=" 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" > Lemon 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" > Guangdong musical Voice <br>       <br><input TYPE = "button" ID = "name=" Play " value =" Playing selected song " onclick =" A Ddseletedsongtoplaylist (); " >      <input TYPE = "button" ID = "Clear "name=" clean " value =" EMPTY playlist "OnClick =" clearlist (); " > <br>      <input TYPE = "button" ID = "Add"  name= "add" VALUE = "added to playlist" OnClick = Addur Ltolist (); " ><input type= "Text" name= "songurl" value = "http://" >      </BODY>      < /html>  
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.