我需要在我的主页上添加一个音频文件,但我需要在移动到另一个标题/页面时音频不会停止。我需要这个音频.mp3文件在后台播放。我正在使用Microsoft Expression Web 4.你能帮助我吗?感谢!!!
这就是我现在使用的:
<audio id="myAudio"
<source src="audiofile.mp3"
type='audio/mp3'>
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type='audio/ogg; codecs=vorbis'>
Your user agent does not support the HTML5 Audio element.
</audio>
<button type="button" onclick="aud_play_pause()" style="width: 296px; height: 35px">
<span class="auto-style1">
<strong>If you want to listen - click this!</strong></span></button>
<script>
function aud_play_pause() {
var myAudio = document.getElementById("myAudio");
if (myAudio.paused) {
myAudio.play();
} else {
myAudio.pause();
}
}
我把它放在我用来导航的.php文件中。此时我不确定它是否是正确的代码,甚至是在正确的位置!
答案 0 :(得分:1)
试试这个:
<audio src="/music/your_file.mp3" autoplay>
<p>If you are reading this, it is because your browser does not support the audio element. </p>
<embed src="/music/your_file.mp3" width="180" height="90" hidden="true" />
</audio>
更新
如果你导航到另一个页面,它将停止轨道,它将在新页面上重新开始。
有三种方法可以在所有页面中连续播放曲目:
答案 1 :(得分:0)
使用以下代码:
<embed src="filename.extension" autostart="true" loop="true"
width="0" height="0">
</embed>
<noembed><bgsound src="filename.extension" loop="infinite"></noembed>
它在这里工作......