How to call without self stream?

63 views Asked by At

i have very important question for me. I was looking for answer on github, and stack, but I didn't found any solution.

So the question is, How to call peer without providing stream.

Imagine this situation. Peer1 is a "host" peer, he has id, and sends it to Peer2 "client". Host want to create call, that all clients could see host stream. Clients want to only see a stream from host, but not sends self stream.

Why? Because they want to keep stream privite, and if there will be many clients, the host will be forced to download all data from all clients - that will be unefficient.

So how to do this? Is there any solution for this?

Host code:

this.peer.on('call', (call) => {
  this.navig.getUserMedia({video: true, audio: true}, (stream) => {
    call.answer(stream);
    call.on('stream', (remotestream) => {
      this.videoElement.nativeElement.src = URL.createObjectURL(remotestream);
      this.videoElement.nativeElement.play();
    });
  }, function (err) {
    console.log('Failed to get stream', err);
  });
});

Clients:

 navig.getUserMedia({video: true, audio: true}, (stream) => {
  var call = this.peer.call(this.idToJoin, stream);
  call.on('stream', (remotestream) => {
    this.video.nativeElement.src = URL.createObjectURL(remotestream);
    this.video.nativeElement.play();
  })
}, function (err) {
  console.log('Failed to get stream', err);
});
0

There are 0 answers