Web Audio API을 사용하여 오디오 파일의 시각화에서 브라우저 간 지원을 위해 WAAPISim Polyfill을 사용하고 있습니다. polyfill은 "WebAudioAPI => AudioDataAPI => Flash"순서로 다음 메소드를 사용하려고 시도합니다. 내가 JS에이 같은 오디오 파일을로드하고 있습니다 :WAAPISim Polyfill - .wav 폴백을 사용하여 .mp3을로드하는 방법
polyfill의 문서에서 언급 한 바와 같이// load the specified sound
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();
}
loadSound("audio/bird.wav");
이 polyfill는이 방법에 대한 WAV 형식을 지원합니다. "ArrayBuffer에서 createBuffer를, decodeAudioData에서 wav 형식 만 지원합니다."
지금은 .wav 만로드 중이지만 지원할 브라우저 대신 .mp3 (작은 파일)을로드하고 싶습니다. 구현이 .mp3과 함께 작동하고 그에 따라 올바른 파일을로드하는지 여부를 어떻게 확인할 수 있습니까?