Niels
Niels

Reputation: 557

How to handle a Media Stream in Node.js?

A really cool new feature in recent browser versions is HTMLMediaElement.captureStream() (this has recently been shipped in Chrome).

Now I understand how it works on the client side. You can reroute the stream to other HTMLMediaElement. However, I want to be able to send it to the server and handle it in Node.js.

How could this be done?

Upvotes: 2

Views: 2048

Answers (1)

Dave Irvine
Dave Irvine

Reputation: 416

As you don't want to use webRTC, you could potentially use the MediaStream recording API: https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API

Once you have the Blob objects you could send this data to Node using Websockets, distribute them back to browsers, re-assemble the Blobs, and play back the media.

However you couldn't stream these Blobs as they may not be individually playable. For that, you'll need webRTC.

Upvotes: 1

Related Questions