Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: The value of "byteLength" is out of range. #5

Open
maphstr opened this issue Nov 29, 2022 · 3 comments
Open

RangeError: The value of "byteLength" is out of range. #5

maphstr opened this issue Nov 29, 2022 · 3 comments

Comments

@maphstr
Copy link

maphstr commented Nov 29, 2022

Hi i'm using this module in electron and everything works fine after until i've built the app with electron-builder
Then I get this error:

RangeError: The value of "byteLength" is out of range. It must be >= 1 and <= 6. Received 7
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at boundsError (node:internal/buffer:86:9)
at Buffer.readUIntBE (node:internal/buffer:273:3)
at w.readContent (main.c1a754a1e0df31f1.js:1:307044)
at w.readChunk (main.c1a754a1e0df31f1.js:1:305350)
at w.decode (main.c1a754a1e0df31f1.js:1:305037)
at main.c1a754a1e0df31f1.js:1:375265
at F (main.c1a754a1e0df31f1.js:1:374710)
at Object.next (main.c1a754a1e0df31f1.js:1:374817)
at I (main.c1a754a1e0df31f1.js:1:373505)
at v.invoke (polyfills.ffcb200af55b2a7d.js:1:6543)
at Object.onInvoke (main.c1a754a1e0df31f1.js:1:1495746)
at v.invoke (polyfills.ffcb200af55b2a7d.js:1:6483)
at M.run (polyfills.ffcb200af55b2a7d.js:1:1939)
at polyfills.ffcb200af55b2a7d.js:1:16777
at v.invokeTask (polyfills.ffcb200af55b2a7d.js:1:7161)
at Object.onInvokeTask (main.c1a754a1e0df31f1.js:1:1495559)
at v.invokeTask (polyfills.ffcb200af55b2a7d.js:1:7082)
at M.runTask (polyfills.ffcb200af55b2a7d.js:1:2556)
at _ (polyfills.ffcb200af55b2a7d.js:1:9176)

Anyone know whats going on here?

@buynao
Copy link
Owner

buynao commented Dec 2, 2022

You can refer to this demo for usage

Or provide the specific version you are using

@lizhen789
Copy link

我也碰到这个问题了,我是把录像直接保存到文件了,然后录制完成后再通过这个工具进行修复,但报错了。

const fixDuration = async (filePath: string): Promise<Blob> => {
    return new Promise((resolve, reject) => {
        // 读取视频文件内容
        const buf = fs.readFileSync(filePath);//读取文件,并将缓存区进行转换
        const uint8Buffer = Uint8Array.from(buf);
        const blob = new Blob([uint8Buffer],{type:'video/mp4'});
        console.log("转换后", blob)

        fixWebmDuration(blob).then((blob) => {
            log.log('修复webm文件时长成功')
            //将Blob文件流写入文件
            saveBlob(blob).then(res => {
                let stream = fs.createWriteStream(filePath, {mode: 777, flags: 'w', autoClose: true});
                stream.write(res);
                stream.end();
            })
            resolve(blob)
        }).catch((e) => {
            log.error('修复webm文件时长失败:%s', e)
            reject(e)
        })

    })
}

@Skyggedans
Copy link

Skyggedans commented Apr 25, 2023

Same for me, excepting that I'm getting this both in development and in release build.
Electron 22.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants