PRATIK CHHETRI
PRATIK CHHETRI

Reputation: 3

Continuous merge and stream of blobs

In my code (Javascript), I am making use of socket.io to transmit the base64 data from agent to client to establish video calling functionality. For that in every 5 or 10 sec I am recording the video using mediaRecorder and sending it to client in base64 which will be converted to blob in every 10 sec.

Problem: So, I would like to know can I merge a new blob in every 10 sec along with stream the video?

I have already tried using createObjectURL(blob) this is not working . .

Upvotes: 0

Views: 493

Answers (1)

Brad
Brad

Reputation: 163301

This entire approach is seriously flawed and isn't going to work the way you want.

I am making use of socket.io to transmit the base64 data from agent to client to establish video calling functionality.

For video calling, you need low latency. The only reasonable way to get low latency realtime video in a browser is WebRTC. That means that you won't be using Socket.IO, nor Web Sockets (well, not for the video anyway... perhaps for signalling).

base64 data

Don't do this! Base64 encoding is only required for sending binary data in a text-based transport. Even if you used Socket.IO or Web Sockets, you wouldn't need base64... they both support binary transfer.

If you use base64, you increase the bandwidth usage by 33%, while wasting CPU and memory for no benefit.

Problem: So, I would like to know can I merge a new blob in every 10 sec along with stream the video?

Blobs are immutable. You can't change them once they are created.

You could use MediaSource Extensions, but this doesn't work with the video created by MediaRecorder today (sadly). You'll have to transcode that video server-side.

Realistically since this is video calling, abandon this entire stack and switch to WebRTC.

Upvotes: 1

Related Questions