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.

webrtc.js 1.3KB

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