JavaScript - 如何停止 运行 音频?
JavaScript - How can I stop a running audio?
以后需要时如何停止此循环音频? (它一直在 Google Chrome 稳定、金丝雀中测试过)
var song = null;
function a() {
song = new Audio("audio/ring.wav");
song.controls = false;
song.loop = true;
song.autoplay = true;
document.body.appendChild(song);
}
a();
var song = null;
function a() {
song = new Audio("audio/ring.wav");
song.controls = false;
song.loop = true;
song.autoplay = true;
document.body.appendChild(song);
}
a();
// Pause the audio, please note there is no stop event
song.pause();
以后需要时如何停止此循环音频? (它一直在 Google Chrome 稳定、金丝雀中测试过)
var song = null;
function a() {
song = new Audio("audio/ring.wav");
song.controls = false;
song.loop = true;
song.autoplay = true;
document.body.appendChild(song);
}
a();
var song = null;
function a() {
song = new Audio("audio/ring.wav");
song.controls = false;
song.loop = true;
song.autoplay = true;
document.body.appendChild(song);
}
a();
// Pause the audio, please note there is no stop event
song.pause();