1

I am trying to use simple-peer with react-native-webrtc package to create a connection. I believe this is the issue here but couldn't find any solution yet. https://github.com/feross/simple-peer/issues/109#issuecomment-576302328

Here is my client side code when a new peer joins it'll send its information via socket.io, thus first peer can add it as a peer:

this.socketRef.on("user joined", payload => {
        const peer = this.addPeer(payload.signal, payload.callerID)
        this.peersRef.push({
          peerID: payload.callerID,
          peer,
        })

        const peerObj = {
          peer,
          peerID: payload.callerID
        }

        this.peers.push(peerObj)
      })
addPeer(incomingSignal, callerID) {
    const peer = new Peer({
      initiator: false,
      trickle: false,
      stream: this.stream
    })

    peer.on("signal", signal => {
        this.socketRef.emit("returning signal", {signal, callerID})
    })

    peer.signal(incomingSignal) 

    return peer
  }

but i'm getting this error:

Error: No WebRTC support: Not a supported browser

Any help is appreciated

1 Answers1

0

you can call like this

const peer = new Peer(
 {initiator: true, 
 wrtc: { 
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  mediaDevices,
  registerGlobals
  },
});
  • Can you please explain how this solves the OP's problem? How was the code the OP was using inadequate and what does your code do different to make it work? Just giving a code snippet without explaining *how* it solves the problem deprives the OP and anyone else that sees this question from really learning something and understanding how this works. – Frans May 31 '21 at 05:46