欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp.net实现在线音乐播放器示例

程序员文章站 2024-02-24 09:49:22
复制代码 代码如下:     playback example<...</div> <div class="content"> <p></p> <div class="codetitle"> <span><a style="cursor: pointer" data="45328" class="copybut" id="copybut45328" onclick="docopy('code45328')" target="_blank" rel="nofollow" href="/default/index/url?u=aHR0cHM6Ly93d3cuMTBxaWFud2FuLmNvbQ=="><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code45328"> <br><html> <br>    <head><title>playback example</title> <br>    </head> <br>    <body> <br>    <script language="javascript"> <br>    function   addmedia(url) <br>    { <br>    // player.controls.stop();                 //停止播放器<br>    // alert(player.versioninfo); //播放器的版本信息<br>    //取得向player对象的播放列表中添加媒体的权限<br>      document.getelementbyid("mediaplayer").settings.requestmediaaccessrights("full"); <br>    // 取得当前的播放列表           <br>    var playlist=mediaplayer.currentplaylist; <br>    //新建一个指定url的media<br>                   var currmedia = mediaplayer.newmedia(url); <br>    //把新建的media item添加到播放器列表<br>                     playlist.appenditem(currmedia); <br>    } <br>    function  clearlist() <br>    {               <br>    //mediaplayer.currentplaylist.count返回列表中的歌曲数量<br>    while(mediaplayer.currentplaylist.count>0) { <br>                               var            item =mediaplayer.currentplaylist.item(mediaplayer.currentplaylist.count-1); <br>                               mediaplayer.currentplaylist.removeitem(item);                 //            从播放列表中删除项<br>                        } <br>    } <br>    function  addseletedsongtoplaylist() <br>    {       <br>                       clearlist(); <br>                       var selectitem = document.getelementsbyname("song"); <br>    // alert(selectitem.length);         <br>    for(var i=0;i<selectitem.length;i++) <br>                        { <br>    if(selectitem[i].checked==true) <br>                             {       <br>    //alert(selectitem[i].value);<br>                                addmedia(selectitem[i].value);  <br>                             } <br>                        } <br>    // alert(mediaplayer.currentplaylist.count);<br>                         mediaplayer.controls.play();            //让播放器开始播放<br>    } <br>    //添加歌曲到播放列表<br>    function   addurltolist(){ <br>                       addmedia(document.getelementbyid("songurl").value );} <br>    </script> <br>    <object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" name="mediaplayer" width="320" height="240" id="mediaplayer" style="filter:gray()"> <br>        <param name="autostart" value="1"/> <br>        <!--是否自动播放--> <br>        <param name="balance" value="0"/> <br>        <!--调整左右声道平衡,同上面旧播放器代码--> <br>        <param name="enabled" value="1"/> <br>        <!--播放器是否可人为控制--> <br>        <param name="enablecontextmenu" value="-1"/> <br>        <!--是否启用上下文菜单--> <br>    <param name="url" value=""/> <br>        <!--播放的文件地址--> <br>        <param name="playcount" value="1"/> <br>        <!--播放次数控制,为整数--> <br>        <param name="rate" value="1"/> <br>        <!--播放速率控制,1为正常,允许小数,1.0-2.0--> <br>        <param name="currentposition" value="0"/> <br>        <!--控件设置:当前位置--> <br>        <param name="currentmarker" value="0"/> <br>        <!--控件设置:当前标记--> <br>        <param name="defaultframe" value="0"/> <br>        <!--显示默认框架--> <br>        <param name="invokeurls" value="0"/> <br>        <!--脚本命令设置:是否调用url--> <br>        <param name="baseurl" value=""/> <br>        <!--脚本命令设置:被调用的url--> <br>        <param name="stretchtofit" value="0"/> <br>        <!--是否按比例伸展--> <br>        <param name="volume" value="50"/> <br>        <!--默认声音大小0%-100%,50则为50%--> <br>        <param name="mute" value="0"/> <br>        <!--是否静音--> <br>        <param name="uimode" value="full"/> <br>        <!--播放器显示模式:full显示全部;mini最简化;none不显示播放控制,只显示视频窗口;invisible全部不显示--> <br>        <param name="windowlessvideo" value="0"/> <br>        <!--如果是0可以允许全屏,否则只能在窗口中查看--> <br>        <param name="fullscreen" value="0"/> <br>        <!--开始播放是否自动全屏--> <br>        <param name="enableerrordialogs" value="0"/> <br>        <!--是否启用错误提示报告--> <br>        <param name="samistyle" value=""/> <br>        <!--sami样式--> <br>        <param name="samilang" value=""/> <br>        <!--sami语言--> <br>        <param name="samifilename" value=""/> <br>        <!--字幕id--> <br>    <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"/> <br>    </object> <br>    <script>addseletedsongtoplaylist();</script> <br>    <br><br><br><br> <br>    <input type="checkbox" name="song" value ="mms://pub1.qmoon.net/911pop?cccode=cc1276">青檬音乐台 <br> <br>    <input type="checkbox" name="song" value ="mms://live.rgd.com.cn/914">广东新闻电台<br> <br>    <input type="checkbox" name="song" value ="mms://live.rgd.com.cn/993">广东音乐之声<br> <br>    <br><input type = "button" id = "play"name="play"  value = "播放选中的歌曲"  onclick = "addseletedsongtoplaylist();"> <br>    <input type = "button" id = "clear" name="clear"  value = "清空播放列表" onclick = "clearlist();"> <br> <br>    <input type = "button"id = "add"  name="add" value = "添加到播放列表"onclick = "addurltolist();"><input type="text" name="songurl" value ="http://"> <br>    </body> <br>    </html><br> </div> </div> <div class="info-pre-next"> <p> 上一篇: <a href="/article/2503179.html"> asp.net文件上传示例分享 </a> </p> <p> 下一篇: <a href="/article/2503181.html"> Java1.8中StringJoiner的使用及源码详析 </a> </p> </div> <div class="wz_tuijian"> <p> 推荐阅读 </p> <ul> <li> <a href="/article/2503180.html" target="_blank" title="asp.net实现在线音乐播放器示例"> <h2> asp.net实现在线音乐播放器示例 </h2> </a> </li> <li> <a href="/article/2498156.html" target="_blank" title="asp.net用三层实现多条件检索示例"> <h2> asp.net用三层实现多条件检索示例 </h2> </a> </li> <li> <a href="/article/2496396.html" target="_blank" title="Python实现在线音乐播放器"> <h2> Python实现在线音乐播放器 </h2> </a> </li> <li> <a href="/article/2485610.html" target="_blank" title="Java实现的简单音乐播放器功能示例"> <h2> Java实现的简单音乐播放器功能示例 </h2> </a> </li> <li> <a href="/article/2459289.html" target="_blank" title="asp.net实现的MD5加密和DES加解密算法类完整示例"> <h2> asp.net实现的MD5加密和DES加解密算法类完整示例 </h2> </a> </li> <li> <a href="/article/2302168.html" target="_blank" title="Python实现的视频播放器功能完整示例"> <h2> Python实现的视频播放器功能完整示例 </h2> </a> </li> <li> <a href="/article/2280799.html" target="_blank" title="ios 流媒体播放器实现流程及FreeStreamer的使用的示例"> <h2> ios 流媒体播放器实现流程及FreeStreamer的使用的示例 </h2> </a> </li> <li> <a href="/article/2269718.html" target="_blank" title="ios 流媒体播放器实现流程及FreeStreamer的使用的示例"> <h2> ios 流媒体播放器实现流程及FreeStreamer的使用的示例 </h2> </a> </li> <li> <a href="/article/2266649.html" target="_blank" title="Android开发实现的简单媒体播放器功能示例"> <h2> Android开发实现的简单媒体播放器功能示例 </h2> </a> </li> <li> <a href="/article/2259558.html" target="_blank" title="asp.net(c#)编程实现将彩色图片变灰阶图片的方法示例"> <h2> asp.net(c#)编程实现将彩色图片变灰阶图片的方法示例 </h2> </a> </li> </ul> </div> </article> </div> </main> <footer><div class="box"><div class="ft_nav"><div class="ft_about"><p>关于网站</p><ul><li><a href="/sitemap.xml" target="_blank" title="网站地图">网站地图</a></li><li><a href="/list/2/" title="最新程序员文章站">最新程序员文章站</a></li></ul></div><div class="ft_contact"><ul><li>本站所有数据收集于网络如有侵犯到您的权益,请联系我们进行下架处理。</li><li class="email_show"></li></ul></div></div><div class="copyright"><div class="cr_left"><p> 备案号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">粤ICP备20058927号</a></p><p>© Copyright © 2020-2022 www.superweb999.com 程序员文章站. </p></div></div></div></footer> </body> </html>