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.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.RTCIceCandidate === 'undefined') {
  17. global.RTCIceCandidate = RTCIceCandidate;
  18. }
  19. if (typeof global.RTCPeerConnection === 'undefined') {
  20. global.RTCPeerConnection = RTCPeerConnection;
  21. }
  22. if (typeof global.webkitRTCPeerConnection === 'undefined') {
  23. global.webkitRTCPeerConnection = RTCPeerConnection;
  24. }
  25. if (typeof global.RTCSessionDescription === 'undefined') {
  26. global.RTCSessionDescription = RTCSessionDescription;
  27. }
  28. const navigator = global.navigator;
  29. if (navigator) {
  30. if (typeof navigator.webkitGetUserMedia === 'undefined') {
  31. navigator.webkitGetUserMedia = getUserMedia;
  32. }
  33. }
  34. })(global || window || this); // eslint-disable-line no-invalid-this