首頁  >  文章  >  web前端  >  javascript 播放器 控制_javascript技巧

javascript 播放器 控制_javascript技巧

WBOY
WBOY原創
2016-05-16 19:20:15890瀏覽

详细参数可查询MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/settingsobject.asp

nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">




<script> <BR>var state; <br><br>//初始化 <BR>function playerinit() <BR>{ <BR> player.url="mp3.m3u"; <BR> player.settings.autoStart = false ; <BR>} <br><br>//播放 <BR>function play() <BR>{ <BR> if (player.controls.isavailable('play')) <BR> { <BR> player.controls.play(); <BR> state=setInterval("updatetime()",1000); <BR> playerinfo.innerHTML = "播放"; <BR> } <BR>} <br><br>//暂停 <BR>function pause() <BR>{ <BR> if (player.controls.isavailable('pause')) <BR> { <BR> player.controls.pause(); <BR> clearInterval(state); <BR> playerinfo.innerHTML = "暂停"; <BR> } <BR>} <br><br>//停止 <BR>function stop() <BR>{ <BR> if (player.controls.isavailable('stop')) <BR> { <BR> player.controls.stop(); <BR> clearInterval(state); <BR> playerinfo.innerHTML = "停止"; <BR> } <BR>} <br><br>//前首 <BR>function previous() <BR>{ <BR> if (player.controls.isavailable( 'previous' )) <BR> { <BR> player.controls.previous(); <BR> playerinfo.innerHTML = "前一首"; <BR> } <BR>} <br><br>//后首 <BR>function next() <BR>{ <BR> if (player.controls.isavailable( 'next' )) <BR> { <BR> player.controls.next(); <BR> playerinfo.innerHTML = "下一首"; <BR> } <BR>} <br><br>//? <BR>function step() <BR>{ <BR> if (player.controls.isavailable( 'step' )) <BR> player.controls.step( 1 ); <BR>} <br><br>//音量- <BR>function voldown() <BR>{ <BR> if ( player.settings.volume < 5 ) <BR> { <BR> player.settings.volume = 0; <BR> playerinfo.innerHTML = "0"; <BR> } <BR> else <BR> { <BR> player.settings.volume -= 5; <BR> playerinfo.innerHTML = player.settings.volume; <BR> } <BR>} <br><br>//音量+ <BR>function volup() <BR>{ <BR> if ( player.settings.volume > 95 ) <BR> { <BR> player.settings.volume = 100; <BR> playerinfo.innerHTML = "100"; <BR> } <BR> else <BR> { <BR> player.settings.volume += 5; <BR> playerinfo.innerHTML = player.settings.volume; <BR> } <BR>} <br><br>//静音 <BR>function mute() <BR>{ <BR> player.settings.mute = !player.settings.mute; <BR>} <br><br>//声道 <BR>function balance() <BR>{ <BR> switch (player.settings.balance) <BR> { <BR> case 0: <BR> player.settings.balance = 100; <BR> playerinfo.innerHTML = '左声道'; <BR> break; <BR> case 100: <BR> player.settings.balance = -100; <BR> playerinfo.innerHTML = '右声道'; <BR> break; <BR> case -100: <BR> player.settings.balance = 0; <BR> playerinfo.innerHTML = '全声道'; <BR> break; <BR> default : <BR> player.settings.balance = 0; <BR> playerinfo.innerHTML = '全声道'; <BR> break; <BR> } <BR>} <br><br>//更新时间 <BR>function updatetime() <BR>{ <BR> playerinfo.innerHTML = player.controls.currentPositionString + " | " + player.currentMedia.durationString; <BR>} <br><br></script>



  
    
  
  
    
  
  
    
  

      
      
      
      
      
      
      
      
      
      
      
      
      
      
    

      










   

 

<script> <BR>switch (newstate){ <BR> case 1: <BR> playerinfo.innerHTML = "停止"; <BR> break; <BR> case 2: <BR> playerinfo.innerHTML = "暂停"; <BR> break; <BR> case 3: <BR> playerinfo.innerHTML = "正在播放"; <BR> break; <BR> case 4: <BR> playerinfo.innerHTML = "4"; <BR> break; <BR> case 5: <BR> playerinfo.innerHTML = "5"; <BR> break; <BR> case 6: <BR> playerinfo.innerHTML = "正在缓冲..."; <BR> break; <BR> case 7: <BR> playerinfo.innerHTML = "7"; <BR> break; <BR> case 8: <BR> playerinfo.innerHTML = "8"; <BR> break; <BR> case 9: <BR> playerinfo.innerHTML = "正在连接..."; <BR> break; <BR> case 10: <BR> playerinfo.innerHTML = "准备就绪。欢迎光临<a href='http://mp3.asp2004.net'>http://mp3.asp2004.net"; <BR> break; <BR> case 11: <BR> playerinfo.innerHTML = "11"; <BR> break; <BR> default: <BR> playerinfo.innerHTML = ""; <BR>} <BR></script>



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn