Attach data to simpleWebRTC room or video

378 Views Asked by At

I'm using simpleWebRTC for a multi-party video chat.

Each user creates his own room. When a user subscribes to another (in order to see this person 0 and registers in the db).

When a user chooses another - he gets this users username by XHR from the db.

I tried adding the data for the appropriate video (or room) - under the

webrtc.on('video added'......

Is there another way I can attach data to the video or room which is more reliable?

1

There are 1 best solutions below

2
On BEST ANSWER

This was just added very recently. You can now set nick on the config options passed to the constructor, which will be included in onVideoAdded -

var webrtc = new SimpleWebRTC({
     ... // your options here
     nick: 'my-user-id'
});

webrtc.on('videoAdded', function (peer) {
    //peer.nick is the other user's nick, and for them, this is yours
});