6
votes

I'm trying to use react-native-webrtc in the constructor for simple peer

import wrtc from 'react-native-webrtc';

const peer = new SimplePeer({initiator: true, wrtc: wrtc});

the error I'm getting is

ExceptionsManager.js:179 Error: No WebRTC support: Not a supported browser

1

1 Answers

1
votes

you have to import it like this


import {
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  mediaDevices,
  registerGlobals
} from 'react-native-webrtc';

const peer = new SimplePeer(
{initiator: true, 
 wrtc: { 
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  mediaDevices,
  registerGlobals
  },
});