The SimpleUser class will not work with React Native (it depends on the DOM).
In order to use the API framework in React Native (for building Android and iOS apps):
- include the react-native-webrtc dependency into your React Native project
- call the exposed registerGlobals() function before creating a new
UserAgent
instance
By calling registerGlobals()
, classes required by WebRTC such as RTCPeerConnection
and MediaStream
(among others) will be exposed in the global scope which is required by the default WebRTC SessionDescriptionHandler.
For example...
import { registerGlobals } from 'react-native-webrtc';
import { UserAgent } from 'sip.js';
registerGlobals();
const ua = new UserAgent(/* configuration options here */);
The Core library works with React Native out of the box.