我想将 .ogg 内容解码为 ArrayBuffer。
我的 Angular 应用程序组件中有以下代码:
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('decoded audio data', buffer);
},
function(e) { console.log('Error with decoding audio data', e); });
}
这适用于 Chrome,但在 Safari 11 上,会触发错误:
解码音频数据时出错 null
我会错过什么?