如何爲我的音頻創建暫停功能?我已在下面的腳本中使用了播放功能。暫停網絡音頻API聲音播放
function loadSound(url) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'arraybuffer';
// When loaded decode the data
request.onload = function() {
// decode the data
context.decodeAudioData(request.response, function(buffer) {
// when the audio is decoded play the sound
playSound(buffer);
}, onError);
}
request.send();
}
function playSound(buffer) {
sourceNode.buffer = buffer;
sourceNode.noteOn(0);
}
但我怎樣才能暫停或停止呢?
'sourceNode.noteOff(0);' – idbehold