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 954B

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