ffmpegwasm / ffmpegwasm/ffmpeg.wasm

Not allowed to load local resource

Đang mở
#514 6 bình luận 4 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
17.8k
Fork
1.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**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**
![Screenshot 2023-06-28 at 8 36 49 AM](https://github.com/ffmpegwasm/ffmpeg.wasm/assets/17055027/683ab1b1-91c5-4878-818b-8b28448c55b1)

**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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.