Z
Z
zagamay_ru2018-06-14 14:13:51
WebRTC
zagamay_ru, 2018-06-14 14:13:51

How to make WEBRTC work?

Hi all!
I've been struggling with webrtc for a day now.
1) Found an interesting solution through signalhub and webrtc-swarm

navigator.mediaDevices.getUserMedia({
        video: this.roomData.video,
        audio: this.roomData.audio
      })
        .then(stream => {
          this.loader = false;

          let hub = signalhub(`room:${this.roomData.id}`, [
            `${this.host || 'http://localhost'}:6003`
          ]);

          this.swarm = new createSwarm(hub, {
            stream: stream
          });

          this.swarm.on('peer', (peer, id) => {
            this.$refs.video.srcObject = peer.stream;
            this.$refs.video.play();
          });

          this.swarm.on('disconnect', (peer, id) => {
            this.deletePeer(id);
          });
        });

In comes another user who is in this room, I checked this by sending a message to this peer. But when I read peer.stream, I see myself, that is, I do not receive the broadcast of another user, but I receive the broadcast from my webcam. 2) I tried to connect simple-peer , I even just copied a code example from them from github, but browsers swear at https://prnt.sc/juuz4q (on the firefox screen, but chrome also gives something similar). The error occurs when I do peer.signal(data) i.e. I make a connection between users. Who faced similar? this.swarm.on('peer', (peer, id) => {});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question