You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

polyfills-webrtc.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. import {
  2. MediaStream,
  3. MediaStreamTrack,
  4. RTCSessionDescription,
  5. RTCIceCandidate,
  6. getUserMedia
  7. } from 'react-native-webrtc';
  8. import RTCPeerConnection from './RTCPeerConnection';
  9. (global => {
  10. if (typeof global.webkitMediaStream === 'undefined') {
  11. global.webkitMediaStream = MediaStream;
  12. }
  13. if (typeof global.MediaStreamTrack === 'undefined') {
  14. global.MediaStreamTrack = MediaStreamTrack;
  15. }
  16. if (typeof global.webkitRTCPeerConnection === 'undefined') {
  17. global.webkitRTCPeerConnection = RTCPeerConnection;
  18. }
  19. if (typeof global.RTCSessionDescription === 'undefined') {
  20. global.RTCSessionDescription = RTCSessionDescription;
  21. }
  22. if (typeof global.RTCIceCandidate === 'undefined') {
  23. global.RTCIceCandidate = RTCIceCandidate;
  24. }
  25. const navigator = global.navigator;
  26. if (navigator) {
  27. if (typeof navigator.webkitGetUserMedia === 'undefined') {
  28. navigator.webkitGetUserMedia = getUserMedia;
  29. }
  30. }
  31. })(global || window || this); // eslint-disable-line no-invalid-this