【发布时间】:2018-02-13 00:53:12
【问题描述】:
我正在尝试在我的打字稿文件中为 Angular 5 应用程序使用 AudioContext。它在 Chrome 上运行良好,在 Safari 上不起作用。我通过谷歌搜索看到的所有内容都说要使用window.webkitAudioContext,但是当打字稿编译器运行说它在类型 Window 上不存在时,它会立即爆炸。
let context = new AudioContext();
let source = context.createBufferSource();
context
.decodeAudioData(event.body)
.then(x => {
source.buffer = x;
source.connect(context.destination);
source.start(0);
});
【问题讨论】:
标签: typescript angular5 audiocontext webkitaudiocontext