Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(rn,polyfills) simplify WebRTC polyfills

Saúl Ibarra Corretgéd3d442e4d223
diff --git a/react/features/mobile/polyfills/webrtc.js b/react/features/mobile/polyfills/webrtc.js
index 2186f03a7b..41721ed94d 100644
--- a/react/features/mobile/polyfills/webrtc.js
+++ b/react/features/mobile/polyfills/webrtc.js
@@ -1,43 +1,11 @@
-import {
- MediaStream,
- MediaStreamTrack,
- RTCIceCandidate,
- RTCSessionDescription,
- mediaDevices,
- permissions
-} from 'react-native-webrtc';
+import { registerGlobals } from 'react-native-webrtc';
import RTCPeerConnection from './RTCPeerConnection';
-(global => {
- if (typeof global.MediaStream === 'undefined') {
- global.MediaStream = MediaStream;
- }
- if (typeof global.MediaStreamTrack === 'undefined') {
- global.MediaStreamTrack = MediaStreamTrack;
- }
- if (typeof global.RTCIceCandidate === 'undefined') {
- global.RTCIceCandidate = RTCIceCandidate;
- }
- if (typeof global.RTCPeerConnection === 'undefined') {
- global.RTCPeerConnection = RTCPeerConnection;
- }
- if (typeof global.RTCPeerConnection === 'undefined') {
- global.webkitRTCPeerConnection = RTCPeerConnection;
- }
- if (typeof global.RTCSessionDescription === 'undefined') {
- global.RTCSessionDescription = RTCSessionDescription;
- }
-
- const navigator = global.navigator;
-
- if (navigator) {
- if (typeof navigator.mediaDevices === 'undefined') {
- navigator.mediaDevices = mediaDevices;
- }
- if (typeof navigator.permissions === 'undefined') {
- navigator.permissions = permissions;
- }
- }
+registerGlobals();
+(global => {
+ // Override with ours.
+ // TODO: consider dropping our override.
+ global.RTCPeerConnection = RTCPeerConnection;
})(global || window || this); // eslint-disable-line no-invalid-this