Vrishank
Vrishank

Reputation: 364

Send webRTC getUserMedia webCam stream over socketio

I have this piece of code:

navigator.mediaDevices.getUserMedia(param)
.then(function(stream) {
    video.srcObject = stream;
    video.play();
  }
})
.catch(function (err) {});

In this code I want to send this stream over socketio to nodejs server so that I can use it on receiver end for display in video element. How can I achieve this?

Upvotes: 1

Views: 4243

Answers (1)

datasedai
datasedai

Reputation: 982

I think something like this is your best bet: https://stackoverflow.com/a/17938723/5915143

You'd record the stream using MediaStreamRecorder and send it with 'emit()' calls on socket io to your server.

Alternatively you can use a streaming library built on socket.io like Endpoint.js to handle the stream.

Upvotes: 2

Related Questions