ffmpegwasm / ffmpegwasm/ffmpeg.wasm

Help and explanation please: `Uncaught (in promise) RuntimeError: null function or function signature mismatch` + Code

Open
#665 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I do not actually know what this error means on the language of this package, but I can provide you with a simple example where it appears and **breaks** the worker (meaning worker becomes unusable until a page reload).

![image](https://github.com/ffmpegwasm/ffmpeg.wasm/assets/109352196/74519da4-232f-492e-b9f4-081873850bcc)

Here is the video.

https://github.com/ffmpegwasm/ffmpeg.wasm/assets/109352196/0e88899b-d14a-4fc4-8937-ef68672d2d50

See the code below.

## Next 14.0.4

A simple mockup project I bootstrapped just to show the error in your package guys

```tsx
'use client'

import { FFmpeg } from '@ffmpeg/ffmpeg'
import { fetchFile, toBlobURL } from '@ffmpeg/util'
import { downloadZip } from 'client-zip'
import { useRef, useState } from 'react'

export default function HomePage() {
const [loaded, setLoaded] = useState(false)
const [isLoading, setIsLoading] = useState(false)
const ffmpegRef = useRef(new FFmpeg())

const load = async () => {
setIsLoading(true)
const baseURL = 'https://unpkg.com/@ffmpeg/core@0.12.6/dist/umd'
const ffmpeg = ffmpegRef.current
await ffmpeg.load({
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
})
setLoaded(true)
setIsLoading(false)
}

const convertAndDownload = async (files: File[]) => {
const ffmpeg = ffmpegRef.current
const convertedFiles = await Promise.all(
files.map(async (song) => {
const key = song.size
const iName = key + '.mp3'
const oName = key + '.ogg'
await ffmpeg.writeFile(iName, await fetchFile(song))
await ffmpeg.exec(['-i', iName, oName])
const o = (await ffmpeg.readFile(oName)) as Uint8Array
return new File([o.buffer], song.name, { type: 'audio/ogg' })
})
)

const blob = await downloadZip(convertedFiles).blob()

const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'songs.zip'
a.click()
}

return (

{loaded ? (
{
const mp3Files = Array.from(e.target.files!)
convertAndDownload(mp3Files)
}}
/>
) : (
{isLoading ? 'loading...' : 'load'}
)}

)
}
```

If you ever encountered this error, please give your feedback and solutions. Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.