I am attempting to convert .ogg data into an ArrayBuffer.
In my Angular application component, I have the following code snippet:
ngOnInit() {
(window as any).AudioContext = (window as any).AudioContext || (window as any).webkitAudioContext;
this.audioContext = new AudioContext();
}
myFunction(oggArrayBuffer) {
this.audioContext.decodeAudioData(oggArrayBuffer, function(buffer) {
console.log('audio data successfully decoded', buffer);
},
function(e) { console.log('Error while decoding audio data', e); });
}
This code functions properly on Chrome, but Safari 11 raises the following error:
Error while decoding audio data: null
What could be causing this issue?