ffmpegwasm / ffmpegwasm/ffmpeg.wasm
Not allowed to load local resource
- Lingua principale
- C
- Stelle
- 17.8k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Describe the bug**
Working fine locally, but when i commit to production it fails to load the 'fetchFile.js' file:
```
_app-89c14310fa418025204d.js:1 Not allowed to load local resource: file:///codebuild/output/src10319366/src/app-sls-lav/node_modules/@ffmpeg/ffmpeg/src/browser/fetchFile.js
```
I am on Nextjs 12, and my code:
```
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg'
const convertVideo = async (file: any) => {
const ffmpeg = createFFmpeg({
corePath: 'https://unpkg.com/@ffmpeg/core@0.10.0/dist/ffmpeg-core.js',
log: true
})
try {
await ffmpeg.load()
ffmpeg.FS('writeFile', 'input.mp4', await fetchFile(file))
await ffmpeg.run('-i', 'input.mp4', 'output.mp4')
const data = ffmpeg.FS('readFile', 'output.mp4')
const videoUrl = URL.createObjectURL(
new Blob([data.buffer], { type: 'video/mp4' })
)
setConvertedVideoSrc(videoUrl)
ffmpeg.FS('unlink', 'input.mp4')
ffmpeg.FS('unlink', 'output.mp4')
} catch (error) {
console.log('erro ffmpeg', error)
}
}
```
I have the `ffmpeg-core.js`, `ffmpeg-core.wasm` and `ffmpeg-core.worker.js` on my public folder, and it works fine if i put my domain on the `corePath` or if i am using unpkg like the example before, it doesn't complain about ffmpeg-core, but it fails on the `fetchFile` function.
I already tried moving the function to this same file, putting on the public folder or an utils folder and importing it, and i always get this error.
**To Reproduce**
Just write that code and try to use it on production.
**Expected behavior**
To properly load the function.
**Screenshots**

**Desktop (please complete the following information):**
- OS: macOS ventura
- Browser: Chrome and Firefox have this error.
- Version: Chrome Version 114.0.5735.198 (Official Build) (x86_64), Firefox 114.0.2 (64-bit)
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.