在后台播放网页中的声音文件 [英] Play sound file in a web-page in the background

查看:340
本文介绍了在后台播放网页中的声音文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在背景的网页上播放声音文件(不想让媒体播放器UI出现),我的网站将在Fire-Fox上运行,我使用Embed元素并设置隐藏属性为true < embed name =myMusicsrc =Masgon.mp3type =audio / midi
autostart =falseHidden =trueloop = true>< / embed>

问题是没有声音播放,除非我删除了这种情况下的隐藏属性声音文件播放和媒体播放器用户界面出现,但我不希望那样。

解决方案

 < audio src =/ music / good_enough.mp3\" > 
< p>如果您正在阅读,则是因为您的浏览器不支持音频元素。 < / p为H.
< / audio>

如果您想要控件

 < audio src =/ music / good_enough.mp3controls> 

如果您正在阅读这些内容,那是因为您的浏览器不支持音频元素。< / p>
< / audio>

以及嵌入

    


I want to play a sound file on my web-page in the back-ground(don't want Media player UI to appear), my web-site will run on Fire-Fox, i used the Embed element and set the Hidden attribute to be true <embed name="myMusic" src="Masgon.mp3" type="audio/midi" autostart="false" Hidden="true" loop="true"></embed> the problem is that no sound is played unless i removed the hidden attribute on this case the sound file is played and the media player UI appears but i don't want that.

解决方案

<audio src="/music/good_enough.mp3">
<p>If you are reading this, it is because your browser does not support the audio element.     </p>
</audio>

and if you want the controls

<audio src="/music/good_enough.mp3" controls>
<p>If you are reading this, it is because your browser does not support the audio element.</p>
</audio>

and also using embed

<embed src="/music/good_enough.mp3" width="180" height="90" loop="false" autostart="false" hidden="true" />

这篇关于在后台播放网页中的声音文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆