shinyoshiaki / werift-webrtc

WebRTC Implementation for TypeScript (Node.js), includes ICE/DTLS/SCTP/RTP/SRTP/WEBM/MP4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MediaRecorder error "EBML.typedArrayUtils.getNumberByteLength: number exceeds Number.MAX_SAFE_INTEGER"

kolserdav opened this issue · comments

Hello. I am trying to write through MediaRecorder:

public streams: Record<string, Record<string, werift.MediaStreamTrack[]>> = {};
const mediaRecorder = new werift.MediaRecorder(
      this.rtc.streams[roomId][item],
      path.resolve(__dirname, `../../rec/mr-${id}.webm`)
);
mediaRecorder.start();

After a few seconds this happens:

Error: EBML.typedArrayUtils.getNumberByteLength: number exceeds Number.MAX_SAFE_INTEGER
[0] [1]     at getNumberByteLength (/home/kol/Projects/werift-sfu-react/node_modules/@shinyoshiaki/ebml-builder/build/typedArrayUtils.js:86:15)
[0] [1]     at Object.numberToByteArray (/home/kol/Projects/werift-sfu-react/node_modules/@shinyoshiaki/ebml-builder/build/typedArrayUtils.js:5:46)
[0] [1]     at Object.<anonymous> (/home/kol/Projects/werift-sfu-react/node_modules/@shinyoshiaki/ebml-builder/build/ebml.js:43:44)
[0] [1]     at Object.memoized (/home/kol/Projects/werift-sfu-react/node_modules/lodash.memoize/index.js:575:23)
[0] [1]     at WEBMBuilder.createTrackEntry (/home/kol/Projects/werift-sfu-react/node_modules/werift/lib/rtp/src/container/webm.js:53:55)
[0] [1]     at /home/kol/Projects/werift-sfu-react/node_modules/werift/lib/rtp/src/container/webm.js:43:25
[0] [1]     at Array.map (<anonymous>)
[0] [1]     at new WEBMBuilder (/home/kol/Projects/werift-sfu-react/node_modules/werift/lib/rtp/src/container/webm.js:42:36)
[0] [1]     at new WebmOutput (/home/kol/Projects/werift-sfu-react/node_modules/werift/lib/rtp/src/processor/webm.js:20:24)
[0] [1]     at WebmFactory.start (/home/kol/Projects/werift-sfu-react/node_modules/werift/lib/webrtc/src/nonstandard/recorder/writer/webm.js:32:21)

I added video parameters and the error stopped being thrown:

const mediaRecorder = new werift.MediaRecorder(
      this.rtc.streams[roomId][item],
      path.resolve(__dirname, `../../rec/mr-${id}.webm`),
      {width: 640, height: 480} // add this line
);