Javascript 获取错误“;WebAssembly.Memory():无法分配内存;在android chrome浏览器上运行ffmpeg.wasm时
详细错误:Javascript 获取错误“;WebAssembly.Memory():无法分配内存;在android chrome浏览器上运行ffmpeg.wasm时,javascript,html,google-chrome,ffmpeg,webassembly,Javascript,Html,Google Chrome,Ffmpeg,Webassembly,详细错误: WebAssembly.Memory(): could not allocate memory at https://*******/ffmpeg-core.js:22:82 at https://*******/ffmpeg.min.js:1:6506 at f (https://*******/ffmpeg.min.js:1:11322) at Generator._invoke (https://*******/ffmpeg.min.js:1:11110) at Generat
WebAssembly.Memory(): could not allocate memory
at https://*******/ffmpeg-core.js:22:82
at https://*******/ffmpeg.min.js:1:6506
at f (https://*******/ffmpeg.min.js:1:11322)
at Generator._invoke (https://*******/ffmpeg.min.js:1:11110)
at Generator.next (https://*******/ffmpeg.min.js:1:11747)
at i (https://*******/ffmpeg.min.js:1:4295)
at c (https://*******/ffmpeg.min.js:1:4498)
ffmpeg的代码:
const downloadWithFFMPEG = async () =>{
const sourceBuffer = await fetch(recordingURL).then(r => r.arrayBuffer());
await ffmpeg.load();
await ffmpeg.FS(
"writeFile",
"input.webm",
new Uint8Array(sourceBuffer, 0, sourceBuffer.byteLength)
);
await ffmpeg.run("-i", "input.webm", "-c", "copy", "output.mp4")
const output = ffmpeg.FS("readFile", "output.mp4");
var link = document.createElement('a')
link.href = URL.createObjectURL(new Blob([output.buffer], { type: 'video/mp4;codecs=H264' }));
link.download = this.data;
link.click();
recording = false;
}
问题简介:
该错误仅适用于android chrome浏览器。同样的代码在pc/笔记本电脑chrome上运行良好。
还启用了上的Webassembly线程chrome://flags 对于android浏览器,正如有人建议我做的那样,但仍然存在相同的错误。有人能帮我吗?您可能会遇到此错误,因为设备上的内存确实不足 这是Wasm应用程序(或者通常是任何大型应用程序)的一个常见问题,因为移动设备在硬件方面(在本例中为RAM)比桌面设备受到的限制要大得多