【发布时间】:2021-12-25 21:30:24
【问题描述】:
网站上有录音机和录音播放器。 Firefox 没问题,但我在基于 Chronium 的浏览器中收到以下警告。
[弃用] ScriptProcessorNode 已弃用。请改用 AudioWorkletNode。 (https://developers.google.com/web/updates/2017/12/audio-worklet)
this.config = {
bufferLen: 4096,
numChannels: 2,
mimeType: 'audio/ogg'
};
this.recording = false;
this.callbacks = {
getBuffer: [],
exportWAV: []
};
Object.assign(this.config, cfg);
this.context = source.context;
this.node = (this.context.createScriptProcessor || this.context.createJavaScriptNode).call(this.context, this.config.bufferLen, this.config.numChannels, this.config.numChannels);
this.node.onaudioprocess = function (e) {
if (!_this.recording) return;
var buffer = [];
for (var channel = 0; channel < _this.config.numChannels; channel++) {
buffer.push(e.inputBuffer.getChannelData(channel));
}
_this.worker.postMessage({
command: 'record',
buffer: buffer
});
};
如何进行此更改?
【问题讨论】:
-
我下面的回答没有回答你的问题吗?
标签: audio