1.首先,点击Chrome的【自定义及控制】按钮,这个按钮在Chrome的右上角;然后选择【设置】,打开设置界面。
/iknow-pic.cdn.bcebos.com/f2deb48f8c5494eecaf276fe23f5e0fe98257e00"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/f2deb48f8c5494eecaf276fe23f5e0fe98257e00?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/f2deb48f8c5494eecaf276fe23f5e0fe98257e00"/>
2.在设置界面,我们一直往下拖,在底部,找到【高级】选项,点击它;
/iknow-pic.cdn.bcebos.com/42a98226cffc1e172d7ff5d64490f603728de911"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/42a98226cffc1e172d7ff5d64490f603728de911?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/42a98226cffc1e172d7ff5d64490f603728de911"/>
3.点击【高级】选项之后,会显示出之前隐藏的功能选项;
/iknow-pic.cdn.bcebos.com/c75c10385343fbf2bbcadfc4be7eca8064388f76"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/c75c10385343fbf2bbcadfc4be7eca8064388f76?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/c75c10385343fbf2bbcadfc4be7eca8064388f76"/>
4.我们找到【内容设置】,点击它;
/iknow-pic.cdn.bcebos.com/503d269759ee3d6d8f05fe2c4d166d224e4ade12"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/503d269759ee3d6d8f05fe2c4d166d224e4ade12?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/503d269759ee3d6d8f05fe2c4d166d224e4ade12"/>
5.然后会显示出【内容设置】的相关选项,找到【Flash】;点击【Flash】进去,将先询问的开关按钮关闭。这样就解决了如何把默认播放器设置成flash的问题了。
/iknow-pic.cdn.bcebos.com/d1160924ab18972b5107782de8cd7b899e510a13"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/d1160924ab18972b5107782de8cd7b899e510a13?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/d1160924ab18972b5107782de8cd7b899e510a13"/>
建立一个HTML5页面,放置<audio>标签,设置音频文件源,设置循环播放。准备两张图片,分别表示开启和暂停背景音乐两种状态,可以点击。
XML/HTML Code复制内容到剪贴板
<audio id="music2" src="music.mp3" loop="loop">你的浏览器不支持audio标签。</audio>
<a href="javascript:playPause()"><img src="pause.gif" width="48" height="50" id="music_btn2" border="0"></a>
Javascript
在点击开关图片按钮的时候调用了javascript脚本,playPause()函数。函数中判断audio音频播放状态,如果已经停止(paused)则调用.play()继续播放,如果是在播放状态,则立即暂停播放.pause(),两种状态切换时及时更新按钮图片,请看代码:
JavaScript Code复制内容到剪贴板
function playPause() {
var music = document.getElementById('music2')
var music_btn = document.getElementById('music_btn2')
if (music.paused){
music.play()
music_btn.src = 'play.gif'
}
else{
music.pause()
music_btn.src = 'pause.gif'
}
}
如果使用jQuery代码可以这样写:
JavaScript Code复制内容到剪贴板
<audio id="music" src="http://cctv3.qiniudn.com/zuixingfuderen.mp3" autoplay="autoplay" loop="loop">你的浏览器不支持audio标签。</audio>
<a id="audio_btn"><img src="play.gif" width="48" height="50" id="music_btn" border="0"></a>
<script>
$("#audio_btn").click(function(){
var music = document.getElementById("music")
if(music.paused){
music.play()
$("#music_btn").attr("src","play.gif")
}else{
music.pause()
$("#music_btn").attr("src","pause.gif")
}
})
</script>
解决如何把默认播放器设置成flash的步骤如下:
1.首先,点击Chrome的【自定义及控制】按钮,这个按钮在Chrome的右上角;然后选择【设置】,打开设置界面。
2.在设置界面,我们一直往下拖,在底部,找到【高级】选项,点击它;
3.点击【高级】选项之后,会显示出之前隐藏的功能选项;
4.我们找到【内容设置】,点击它;
5.然后会显示出【内容设置】的相关选项,找到【Flash】;点击【Flash】进去,将先询问的开关按钮关闭。这样就解决了如何把默认播放器设置成flash的问题了。