Когда при тестировании в браузере с использованием Ionic Serve (chrome) звук воспроизводится нормально.
Вот что у меня есть:
Код: Выделить всё
function snare(e) {
var audioSource = 'assets/audio/snare1.wav';
var request = new XMLHttpRequest();
request.open('GET', audioSource, true);
request.responseType = 'arraybuffer';
// Decode asynchronously
request.onload = function() {
audioContext.decodeAudioData(request.response, function(theBuffer) {
buffer = theBuffer;
playSound(buffer);
});
}
request.send();
}
function playSound(buffer) {
var source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(audioContext.destination);
source.start(0);
}
Есть идеи, почему это может пойти не так?
Подробнее здесь: https://stackoverflow.com/questions/433 ... in-browser
Мобильная версия