react-native-webrtc 1.92.2 → 1.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.prettierignore +9 -0
  2. package/.prettierrc.json +10 -0
  3. package/android/libs/.placeholder +0 -0
  4. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +0 -5
  5. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +199 -255
  6. package/apple/.placeholder +0 -0
  7. package/ios/RCTWebRTC/VideoCaptureController.m +5 -3
  8. package/metro.config.js +3 -4
  9. package/metro.config.macos.js +7 -8
  10. package/package.json +20 -12
  11. package/react-native.config.js +5 -6
  12. package/src/EventEmitter.js +1 -1
  13. package/src/MediaDevices.js +6 -12
  14. package/src/MediaStream.js +120 -131
  15. package/src/MediaStreamError.js +8 -10
  16. package/src/MediaStreamErrorEvent.js +6 -7
  17. package/src/MediaStreamEvent.js +6 -7
  18. package/src/MediaStreamTrack.js +89 -103
  19. package/src/MediaStreamTrackEvent.js +6 -7
  20. package/src/MessageEvent.js +7 -8
  21. package/src/Permissions.js +26 -23
  22. package/src/RTCDataChannel.js +127 -145
  23. package/src/RTCDataChannelEvent.js +6 -7
  24. package/src/RTCEvent.js +5 -6
  25. package/src/RTCIceCandidate.js +15 -16
  26. package/src/RTCIceCandidateEvent.js +8 -9
  27. package/src/RTCPeerConnection.js +295 -325
  28. package/src/RTCSessionDescription.js +15 -16
  29. package/src/RTCUtil.js +56 -57
  30. package/src/RTCView.js +59 -69
  31. package/src/ScreenCapturePickerView.js +2 -5
  32. package/src/getDisplayMedia.js +7 -6
  33. package/src/getUserMedia.js +85 -85
  34. package/src/index.js +28 -34
  35. package/tools/build-webrtc.py +61 -49
  36. package/tools/downloadBitcode.sh +4 -16
  37. package/tools/downloadWebRTC.js +100 -0
  38. package/android/libs/libjingle_peerconnection.so.jar +0 -0
  39. package/android/libs/libwebrtc.jar +0 -0
  40. package/apple/WebRTC.xcframework.tgz +0 -0
  41. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  42. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  43. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  44. package/ios/RCTWebRTC.xcodeproj/xcuserdata/saghul.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -1,23 +1,22 @@
1
- 'use strict';
2
1
 
3
2
  export default class RTCSessionDescription {
4
- sdp: string;
5
- type: string;
3
+ sdp: string;
4
+ type: string;
6
5
 
7
- constructor(info = {type: null, sdp: ''}) {
8
- this._sdp = info.sdp;
9
- this._type = info.type;
10
- }
6
+ constructor(info = { type: null, sdp: '' }) {
7
+ this._sdp = info.sdp;
8
+ this._type = info.type;
9
+ }
11
10
 
12
- get sdp() {
13
- return this._sdp;
14
- }
11
+ get sdp() {
12
+ return this._sdp;
13
+ }
15
14
 
16
- get type() {
17
- return this._type;
18
- }
15
+ get type() {
16
+ return this._type;
17
+ }
19
18
 
20
- toJSON() {
21
- return {sdp: this._sdp, type: this._type};
22
- }
19
+ toJSON() {
20
+ return { sdp: this._sdp, type: this._type };
21
+ }
23
22
  }
package/src/RTCUtil.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
 
3
2
  const DEFAULT_AUDIO_CONSTRAINTS = {};
4
3
 
@@ -19,13 +18,13 @@ const STANDARD_OA_OPTIONS = {
19
18
  };
20
19
 
21
20
  function getDefaultMediaConstraints(mediaType) {
22
- switch(mediaType) {
23
- case 'audio':
24
- return DEFAULT_AUDIO_CONSTRAINTS;
25
- case 'video':
26
- return DEFAULT_VIDEO_CONSTRAINTS;
27
- default:
28
- throw new TypeError(`Invalid media type: ${mediaType}`);
21
+ switch (mediaType) {
22
+ case 'audio':
23
+ return DEFAULT_AUDIO_CONSTRAINTS;
24
+ case 'video':
25
+ return DEFAULT_VIDEO_CONSTRAINTS;
26
+ default:
27
+ throw new TypeError(`Invalid media type: ${mediaType}`);
29
28
  }
30
29
  }
31
30
 
@@ -34,7 +33,7 @@ function extractString(constraints, prop) {
34
33
  const type = typeof value;
35
34
 
36
35
  if (type === 'object') {
37
- for (const v of [ 'exact', 'ideal' ]) {
36
+ for (const v of ['exact', 'ideal']) {
38
37
  if (value[v]) {
39
38
  return value[v];
40
39
  }
@@ -51,7 +50,7 @@ function extractNumber(constraints, prop) {
51
50
  if (type === 'number') {
52
51
  return Number.parseInt(value);
53
52
  } else if (type === 'object') {
54
- for (const v of [ 'exact', 'ideal', 'min', 'max' ]) {
53
+ for (const v of ['exact', 'ideal', 'min', 'max']) {
55
54
  if (value[v]) {
56
55
  return Number.parseInt(value[v]);
57
56
  }
@@ -60,56 +59,56 @@ function extractNumber(constraints, prop) {
60
59
  }
61
60
 
62
61
  function normalizeMediaConstraints(constraints, mediaType) {
63
- switch(mediaType) {
64
- case 'audio':
65
- return constraints;
66
- case 'video': {
67
- let c;
68
- if (constraints.mandatory) {
69
- // Old style.
70
- c = {
71
- deviceId: extractString(constraints.optional || {}, 'sourceId'),
72
- facingMode: extractString(constraints, 'facingMode'),
73
- frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),
74
- height: extractNumber(constraints.mandatory, 'minHeight'),
75
- width: extractNumber(constraints.mandatory, 'minWidth')
76
- };
77
- } else {
78
- // New style.
79
- c = {
80
- deviceId: extractString(constraints, 'deviceId'),
81
- facingMode: extractString(constraints, 'facingMode'),
82
- frameRate: extractNumber(constraints, 'frameRate'),
83
- height: extractNumber(constraints, 'height'),
84
- width: extractNumber(constraints, 'width')
85
- };
86
- }
62
+ switch (mediaType) {
63
+ case 'audio':
64
+ return constraints;
65
+ case 'video': {
66
+ let c;
67
+ if (constraints.mandatory) {
68
+ // Old style.
69
+ c = {
70
+ deviceId: extractString(constraints.optional || {}, 'sourceId'),
71
+ facingMode: extractString(constraints, 'facingMode'),
72
+ frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),
73
+ height: extractNumber(constraints.mandatory, 'minHeight'),
74
+ width: extractNumber(constraints.mandatory, 'minWidth')
75
+ };
76
+ } else {
77
+ // New style.
78
+ c = {
79
+ deviceId: extractString(constraints, 'deviceId'),
80
+ facingMode: extractString(constraints, 'facingMode'),
81
+ frameRate: extractNumber(constraints, 'frameRate'),
82
+ height: extractNumber(constraints, 'height'),
83
+ width: extractNumber(constraints, 'width')
84
+ };
85
+ }
87
86
 
88
- if (!c.deviceId) {
89
- delete c.deviceId;
90
- }
87
+ if (!c.deviceId) {
88
+ delete c.deviceId;
89
+ }
91
90
 
92
- if (!c.facingMode || (c.facingMode !== 'user' && c.facingMode !== 'environment')) {
93
- c.facingMode = DEFAULT_VIDEO_CONSTRAINTS.facingMode;
94
- }
91
+ if (!c.facingMode || (c.facingMode !== 'user' && c.facingMode !== 'environment')) {
92
+ c.facingMode = DEFAULT_VIDEO_CONSTRAINTS.facingMode;
93
+ }
95
94
 
96
- if (!c.frameRate) {
97
- c.frameRate = DEFAULT_VIDEO_CONSTRAINTS.frameRate;
98
- }
95
+ if (!c.frameRate) {
96
+ c.frameRate = DEFAULT_VIDEO_CONSTRAINTS.frameRate;
97
+ }
99
98
 
100
- if (!c.height && !c.width) {
101
- c.height = DEFAULT_VIDEO_CONSTRAINTS.height;
102
- c.width = DEFAULT_VIDEO_CONSTRAINTS.width;
103
- } else if (!c.height) {
104
- c.height = Math.round(c.width / ASPECT_RATIO);
105
- } else if (!c.width) {
106
- c.width = Math.round(c.height * ASPECT_RATIO);
107
- }
99
+ if (!c.height && !c.width) {
100
+ c.height = DEFAULT_VIDEO_CONSTRAINTS.height;
101
+ c.width = DEFAULT_VIDEO_CONSTRAINTS.width;
102
+ } else if (!c.height) {
103
+ c.height = Math.round(c.width / ASPECT_RATIO);
104
+ } else if (!c.width) {
105
+ c.width = Math.round(c.height * ASPECT_RATIO);
106
+ }
108
107
 
109
- return c;
110
- }
111
- default:
112
- throw new TypeError(`Invalid media type: ${mediaType}`);
108
+ return c;
109
+ }
110
+ default:
111
+ throw new TypeError(`Invalid media type: ${mediaType}`);
113
112
  }
114
113
  }
115
114
 
@@ -143,7 +142,7 @@ export function normalizeOfferAnswerOptions(options = {}) {
143
142
 
144
143
  // Convert standard options into WebRTC internal constant names.
145
144
  // See: https://github.com/jitsi/webrtc/blob/0cd6ce4de669bed94ba47b88cb71b9be0341bb81/sdk/media_constraints.cc#L113
146
- for (const [ key, value ] of Object.entries(options)) {
145
+ for (const [key, value] of Object.entries(options)) {
147
146
  const newKey = STANDARD_OA_OPTIONS[key.toLowerCase()];
148
147
  if (newKey) {
149
148
  newOptions[newKey] = String(Boolean(value));
@@ -159,7 +158,7 @@ export function normalizeOfferAnswerOptions(options = {}) {
159
158
  export function normalizeConstraints(constraints) {
160
159
  const c = deepClone(constraints);
161
160
 
162
- for (const mediaType of [ 'audio', 'video' ]) {
161
+ for (const mediaType of ['audio', 'video']) {
163
162
  const mediaTypeConstraints = c[mediaType];
164
163
  const typeofMediaTypeConstraints = typeof mediaTypeConstraints;
165
164
 
package/src/RTCView.js CHANGED
@@ -1,70 +1,60 @@
1
- 'use strict';
2
1
 
3
- import {
4
- NativeModules,
5
- requireNativeComponent,
6
- } from 'react-native';
7
- import PropTypes from 'prop-types';
8
-
9
- const {WebRTCModule} = NativeModules;
10
-
11
- const RTCView = {
12
- name: 'RTCVideoView',
13
- propTypes: {
14
-
15
- /**
16
- * Indicates whether the video specified by {@link #streamURL} should be
17
- * mirrored during rendering. Commonly, applications choose to mirror the
18
- * user-facing camera.
19
- */
20
- mirror: PropTypes.bool,
21
-
22
- /**
23
- * In the fashion of
24
- * https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
25
- * and https://www.w3.org/TR/html5/rendering.html#video-object-fit,
26
- * resembles the CSS style object-fit.
27
- */
28
- objectFit: PropTypes.oneOf(['contain', 'cover']),
29
-
30
- streamURL: PropTypes.string,
31
-
32
- /**
33
- * Similarly to the CSS property z-index, specifies the z-order of this
34
- * RTCView in the stacking space of all RTCViews. When RTCViews overlap,
35
- * zOrder determines which one covers the other. An RTCView with a larger
36
- * zOrder generally covers an RTCView with a lower one.
37
- *
38
- * Non-overlapping RTCViews may safely share a z-order (because one does not
39
- * have to cover the other).
40
- *
41
- * The support for zOrder is platform-dependent and/or
42
- * implementation-specific. Thus, specifying a value for zOrder is to be
43
- * thought of as giving a hint rather than as imposing a requirement. For
44
- * example, video renderers such as RTCView are commonly implemented using
45
- * OpenGL and OpenGL views may have different numbers of layers in their
46
- * stacking space. Android has three: a layer bellow the window (aka
47
- * default), a layer bellow the window again but above the previous layer
48
- * (aka media overlay), and above the window. Consequently, it is advisable
49
- * to limit the number of utilized layers in the stacking space to the
50
- * minimum sufficient for the desired display. For example, a video call
51
- * application usually needs a maximum of two zOrder values: 0 for the
52
- * remote video(s) which appear in the background, and 1 for the local
53
- * video(s) which appear above the remote video(s).
54
- */
55
- zOrder: PropTypes.number
56
- },
57
- };
58
-
59
- const View = requireNativeComponent('RTCVideoView', RTCView, {nativeOnly: {
60
- testID: true,
61
- accessibilityComponentType: true,
62
- renderToHardwareTextureAndroid: true,
63
- accessibilityLabel: true,
64
- accessibilityLiveRegion: true,
65
- importantForAccessibility: true,
66
- onLayout: true,
67
- nativeID: true,
68
- }});
69
-
70
- export default View;
2
+ import { requireNativeComponent } from 'react-native';
3
+
4
+ /**
5
+ * Native prop validation was removed from RN in:
6
+ * https://github.com/facebook/react-native/commit/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34
7
+ *
8
+ * So we list them here for documentation purposes.
9
+ */
10
+
11
+ /**
12
+ * Indicates whether the video specified by {@link #streamURL} should be
13
+ * mirrored during rendering. Commonly, applications choose to mirror the
14
+ * user-facing camera.
15
+ *
16
+ * mirror: boolean
17
+ */
18
+
19
+ /**
20
+ * In the fashion of
21
+ * https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
22
+ * and https://www.w3.org/TR/html5/rendering.html#video-object-fit,
23
+ * resembles the CSS style object-fit.
24
+ *
25
+ * objectFit: 'contain' | 'cover'
26
+ */
27
+
28
+ /**
29
+ * URL / id of the stream that should be rendered.
30
+ *
31
+ * streamURL: string
32
+ */
33
+
34
+ /**
35
+ * Similarly to the CSS property z-index, specifies the z-order of this
36
+ * RTCView in the stacking space of all RTCViews. When RTCViews overlap,
37
+ * zOrder determines which one covers the other. An RTCView with a larger
38
+ * zOrder generally covers an RTCView with a lower one.
39
+ *
40
+ * Non-overlapping RTCViews may safely share a z-order (because one does not
41
+ * have to cover the other).
42
+ *
43
+ * The support for zOrder is platform-dependent and/or
44
+ * implementation-specific. Thus, specifying a value for zOrder is to be
45
+ * thought of as giving a hint rather than as imposing a requirement. For
46
+ * example, video renderers such as RTCView are commonly implemented using
47
+ * OpenGL and OpenGL views may have different numbers of layers in their
48
+ * stacking space. Android has three: a layer bellow the window (aka
49
+ * default), a layer bellow the window again but above the previous layer
50
+ * (aka media overlay), and above the window. Consequently, it is advisable
51
+ * to limit the number of utilized layers in the stacking space to the
52
+ * minimum sufficient for the desired display. For example, a video call
53
+ * application usually needs a maximum of two zOrder values: 0 for the
54
+ * remote video(s) which appear in the background, and 1 for the local
55
+ * video(s) which appear above the remote video(s).
56
+ *
57
+ * zOrder: number
58
+ */
59
+
60
+ export default requireNativeComponent('RTCVideoView');
@@ -1,7 +1,4 @@
1
- 'use strict';
2
1
 
3
- import {
4
- requireNativeComponent,
5
- } from 'react-native';
2
+ import { requireNativeComponent } from 'react-native';
6
3
 
7
- export default requireNativeComponent('ScreenCapturePickerView');;
4
+ export default requireNativeComponent('ScreenCapturePickerView');
@@ -1,6 +1,5 @@
1
- 'use strict';
2
1
 
3
- import { Platform, NativeModules } from 'react-native';
2
+ import { NativeModules } from 'react-native';
4
3
 
5
4
  import MediaStream from './MediaStream';
6
5
  import MediaStreamError from './MediaStreamError';
@@ -9,8 +8,8 @@ const { WebRTCModule } = NativeModules;
9
8
 
10
9
  export default function getDisplayMedia() {
11
10
  return new Promise((resolve, reject) => {
12
- WebRTCModule.getDisplayMedia()
13
- .then(data => {
11
+ WebRTCModule.getDisplayMedia().then(
12
+ data => {
14
13
  const { streamId, track } = data;
15
14
 
16
15
  const info = {
@@ -22,8 +21,10 @@ export default function getDisplayMedia() {
22
21
  const stream = new MediaStream(info);
23
22
 
24
23
  resolve(stream);
25
- }, error => {
24
+ },
25
+ error => {
26
26
  reject(new MediaStreamError(error));
27
- });
27
+ }
28
+ );
28
29
  });
29
30
  }
@@ -1,6 +1,5 @@
1
- 'use strict';
2
1
 
3
- import {Platform, NativeModules} from 'react-native';
2
+ import { NativeModules } from 'react-native';
4
3
  import * as RTCUtil from './RTCUtil';
5
4
 
6
5
  import MediaStream from './MediaStream';
@@ -9,90 +8,91 @@ import permissions from './Permissions';
9
8
 
10
9
  const { WebRTCModule } = NativeModules;
11
10
 
12
-
13
11
  export default function getUserMedia(constraints = {}) {
14
- // According to
15
- // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,
16
- // the constraints argument is a dictionary of type MediaStreamConstraints.
17
- if (typeof constraints !== 'object') {
18
- return Promise.reject(new TypeError('constraints is not a dictionary'));
19
- }
20
-
21
- if ((typeof constraints.audio === 'undefined' || !constraints.audio)
22
- && (typeof constraints.video === 'undefined' || !constraints.video)) {
23
- return Promise.reject(new TypeError('audio and/or video is required'));
24
- }
25
-
26
- // Normalize constraints.
27
- constraints = RTCUtil.normalizeConstraints(constraints);
28
-
29
- // Request required permissions
30
- const reqPermissions = [];
31
- if (constraints.audio) {
32
- reqPermissions.push(permissions.request({ name: 'microphone' }));
33
- } else {
34
- reqPermissions.push(Promise.resolve(false));
35
- }
36
- if (constraints.video) {
37
- reqPermissions.push(permissions.request({ name: 'camera' }));
38
- } else {
39
- reqPermissions.push(Promise.resolve(false));
40
- }
41
-
42
- return new Promise((resolve, reject) => {
43
- Promise.all(reqPermissions).then(results => {
44
- const [ audioPerm, videoPerm ] = results;
45
-
46
- // Check permission results and remove unneeded permissions.
47
-
48
- if (!audioPerm && !videoPerm) {
49
- // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia
50
- // step 4
51
- const error = {
52
- message: 'Permission denied.',
53
- name: 'SecurityError'
54
- };
55
- reject(new MediaStreamError(error));
56
-
57
- return;
58
- }
59
-
60
- audioPerm || (delete constraints.audio);
61
- videoPerm || (delete constraints.video);
62
-
63
- const success = (id, tracks) => {
64
- // Store initial constraints.
65
- for (const trackInfo of tracks) {
66
- const c = constraints[trackInfo.kind];
67
- if (typeof c === 'object') {
68
- trackInfo.constraints = RTCUtil.deepClone(c);
12
+ // According to
13
+ // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,
14
+ // the constraints argument is a dictionary of type MediaStreamConstraints.
15
+ if (typeof constraints !== 'object') {
16
+ return Promise.reject(new TypeError('constraints is not a dictionary'));
17
+ }
18
+
19
+ if (
20
+ (typeof constraints.audio === 'undefined' || !constraints.audio) &&
21
+ (typeof constraints.video === 'undefined' || !constraints.video)
22
+ ) {
23
+ return Promise.reject(new TypeError('audio and/or video is required'));
24
+ }
25
+
26
+ // Normalize constraints.
27
+ constraints = RTCUtil.normalizeConstraints(constraints);
28
+
29
+ // Request required permissions
30
+ const reqPermissions = [];
31
+ if (constraints.audio) {
32
+ reqPermissions.push(permissions.request({ name: 'microphone' }));
33
+ } else {
34
+ reqPermissions.push(Promise.resolve(false));
35
+ }
36
+ if (constraints.video) {
37
+ reqPermissions.push(permissions.request({ name: 'camera' }));
38
+ } else {
39
+ reqPermissions.push(Promise.resolve(false));
40
+ }
41
+
42
+ return new Promise((resolve, reject) => {
43
+ Promise.all(reqPermissions).then(results => {
44
+ const [audioPerm, videoPerm] = results;
45
+
46
+ // Check permission results and remove unneeded permissions.
47
+
48
+ if (!audioPerm && !videoPerm) {
49
+ // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia
50
+ // step 4
51
+ const error = {
52
+ message: 'Permission denied.',
53
+ name: 'SecurityError'
54
+ };
55
+ reject(new MediaStreamError(error));
56
+
57
+ return;
69
58
  }
70
- }
71
-
72
- const info = {
73
- streamId: id,
74
- streamReactTag: id,
75
- tracks
76
- };
77
-
78
- resolve(new MediaStream(info));
79
- };
80
-
81
- const failure = (type, message) => {
82
- let error;
83
- switch (type) {
84
- case 'TypeError':
85
- error = new TypeError(message);
86
- break;
87
- }
88
- if (!error) {
89
- error = new MediaStreamError({ message, name: type });
90
- }
91
-
92
- reject(error);
93
- };
94
-
95
- WebRTCModule.getUserMedia(constraints, success, failure);
59
+
60
+ audioPerm || delete constraints.audio;
61
+ videoPerm || delete constraints.video;
62
+
63
+ const success = (id, tracks) => {
64
+ // Store initial constraints.
65
+ for (const trackInfo of tracks) {
66
+ const c = constraints[trackInfo.kind];
67
+ if (typeof c === 'object') {
68
+ trackInfo.constraints = RTCUtil.deepClone(c);
69
+ }
70
+ }
71
+
72
+ const info = {
73
+ streamId: id,
74
+ streamReactTag: id,
75
+ tracks
76
+ };
77
+
78
+ resolve(new MediaStream(info));
79
+ };
80
+
81
+ const failure = (type, message) => {
82
+ let error;
83
+ switch (type) {
84
+ case 'TypeError':
85
+ error = new TypeError(message);
86
+ break;
87
+ }
88
+ if (!error) {
89
+ error = new MediaStreamError({ message, name: type });
90
+ }
91
+
92
+ reject(error);
93
+ };
94
+
95
+ WebRTCModule.getUserMedia(constraints, success, failure);
96
+ });
96
97
  });
97
- });
98
98
  }
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
 
3
2
  import ScreenCapturePickerView from './ScreenCapturePickerView';
4
3
  import RTCPeerConnection from './RTCPeerConnection';
@@ -11,40 +10,35 @@ import mediaDevices from './MediaDevices';
11
10
  import permissions from './Permissions';
12
11
 
13
12
  export {
14
- ScreenCapturePickerView,
15
- RTCPeerConnection,
16
- RTCIceCandidate,
17
- RTCSessionDescription,
18
- RTCView,
19
- MediaStream,
20
- MediaStreamTrack,
21
- mediaDevices,
22
- permissions,
23
- registerGlobals
13
+ ScreenCapturePickerView,
14
+ RTCPeerConnection,
15
+ RTCIceCandidate,
16
+ RTCSessionDescription,
17
+ RTCView,
18
+ MediaStream,
19
+ MediaStreamTrack,
20
+ mediaDevices,
21
+ permissions,
22
+ registerGlobals
24
23
  };
25
24
 
26
25
  function registerGlobals() {
27
- // Should not happen. React Native has a global navigator object.
28
- if (typeof navigator !== 'object') {
29
- throw new Error('navigator is not an object');
30
- }
31
-
32
- if (!navigator.mediaDevices) {
33
- navigator.mediaDevices = {};
34
- }
35
-
36
- navigator.mediaDevices.getUserMedia =
37
- mediaDevices.getUserMedia.bind(mediaDevices);
38
-
39
- navigator.mediaDevices.getDisplayMedia =
40
- mediaDevices.getDisplayMedia.bind(mediaDevices);
41
-
42
- navigator.mediaDevices.enumerateDevices =
43
- mediaDevices.enumerateDevices.bind(mediaDevices);
44
-
45
- global.RTCPeerConnection = RTCPeerConnection;
46
- global.RTCIceCandidate = RTCIceCandidate;
47
- global.RTCSessionDescription = RTCSessionDescription;
48
- global.MediaStream = MediaStream;
49
- global.MediaStreamTrack = MediaStreamTrack;
26
+ // Should not happen. React Native has a global navigator object.
27
+ if (typeof navigator !== 'object') {
28
+ throw new Error('navigator is not an object');
29
+ }
30
+
31
+ if (!navigator.mediaDevices) {
32
+ navigator.mediaDevices = {};
33
+ }
34
+
35
+ navigator.mediaDevices.getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);
36
+ navigator.mediaDevices.getDisplayMedia = mediaDevices.getDisplayMedia.bind(mediaDevices);
37
+ navigator.mediaDevices.enumerateDevices = mediaDevices.enumerateDevices.bind(mediaDevices);
38
+
39
+ global.RTCPeerConnection = RTCPeerConnection;
40
+ global.RTCIceCandidate = RTCIceCandidate;
41
+ global.RTCSessionDescription = RTCSessionDescription;
42
+ global.MediaStream = MediaStream;
43
+ global.MediaStreamTrack = MediaStreamTrack;
50
44
  }