jiti-meet/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js

44 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-12-17 10:03:10 +00:00
import {
MediaStream,
MediaStreamTrack,
RTCSessionDescription,
RTCIceCandidate,
mediaDevices,
permissions
2016-12-17 10:03:10 +00:00
} from 'react-native-webrtc';
import RTCPeerConnection from './RTCPeerConnection';
2016-12-17 10:03:10 +00:00
(global => {
2018-08-16 12:27:31 +00:00
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;
}
2018-08-16 12:27:31 +00:00
if (typeof global.RTCPeerConnection === 'undefined') {
2016-12-17 10:03:10 +00:00
global.webkitRTCPeerConnection = RTCPeerConnection;
}
if (typeof global.RTCSessionDescription === 'undefined') {
global.RTCSessionDescription = RTCSessionDescription;
}
const navigator = global.navigator;
if (navigator) {
2018-08-16 12:27:31 +00:00
if (typeof navigator.mediaDevices === 'undefined') {
navigator.mediaDevices = mediaDevices;
}
if (typeof navigator.permissions === 'undefined') {
navigator.permissions = permissions;
}
}
})(global || window || this); // eslint-disable-line no-invalid-this