react-native-webrtc 1.92.1 → 1.94.2

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 (67) hide show
  1. package/.prettierignore +9 -0
  2. package/.prettierrc.json +10 -0
  3. package/README.md +2 -2
  4. package/android/libs/.placeholder +0 -0
  5. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +21 -8
  6. package/android/src/main/java/com/oney/WebRTCModule/StringUtils.java +24 -0
  7. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +199 -255
  8. package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +10 -2
  9. package/apple/.placeholder +0 -0
  10. package/ios/RCTWebRTC/VideoCaptureController.h +2 -2
  11. package/ios/RCTWebRTC/VideoCaptureController.m +131 -48
  12. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +39 -20
  13. package/metro.config.js +3 -4
  14. package/metro.config.macos.js +7 -8
  15. package/package.json +20 -12
  16. package/react-native.config.js +5 -6
  17. package/{EventEmitter.js → src/EventEmitter.js} +1 -1
  18. package/{MediaDevices.js → src/MediaDevices.js} +6 -12
  19. package/src/MediaStream.js +128 -0
  20. package/src/MediaStreamError.js +12 -0
  21. package/src/MediaStreamErrorEvent.js +11 -0
  22. package/src/MediaStreamEvent.js +11 -0
  23. package/src/MediaStreamTrack.js +104 -0
  24. package/src/MediaStreamTrackEvent.js +11 -0
  25. package/src/MessageEvent.js +10 -0
  26. package/{Permissions.js → src/Permissions.js} +26 -23
  27. package/src/RTCDataChannel.js +143 -0
  28. package/src/RTCDataChannelEvent.js +11 -0
  29. package/src/RTCEvent.js +8 -0
  30. package/src/RTCIceCandidate.js +20 -0
  31. package/src/RTCIceCandidateEvent.js +15 -0
  32. package/src/RTCPeerConnection.js +349 -0
  33. package/src/RTCSessionDescription.js +22 -0
  34. package/{RTCUtil.js → src/RTCUtil.js} +77 -57
  35. package/src/RTCView.js +60 -0
  36. package/src/ScreenCapturePickerView.js +4 -0
  37. package/{getDisplayMedia.js → src/getDisplayMedia.js} +7 -6
  38. package/src/getUserMedia.js +98 -0
  39. package/src/index.js +44 -0
  40. package/tools/build-webrtc.py +61 -49
  41. package/tools/downloadBitcode.sh +4 -16
  42. package/tools/downloadWebRTC.js +100 -0
  43. package/MediaStream.js +0 -138
  44. package/MediaStreamError.js +0 -14
  45. package/MediaStreamErrorEvent.js +0 -12
  46. package/MediaStreamEvent.js +0 -12
  47. package/MediaStreamTrack.js +0 -118
  48. package/MediaStreamTrackEvent.js +0 -12
  49. package/MessageEvent.js +0 -11
  50. package/RTCDataChannel.js +0 -161
  51. package/RTCDataChannelEvent.js +0 -12
  52. package/RTCEvent.js +0 -9
  53. package/RTCIceCandidate.js +0 -21
  54. package/RTCIceCandidateEvent.js +0 -16
  55. package/RTCPeerConnection.js +0 -379
  56. package/RTCSessionDescription.js +0 -23
  57. package/RTCView.js +0 -70
  58. package/ScreenCapturePickerView.js +0 -7
  59. package/android/libs/libjingle_peerconnection.so.jar +0 -0
  60. package/android/libs/libwebrtc.jar +0 -0
  61. package/apple/WebRTC.xcframework.tgz +0 -0
  62. package/getUserMedia.js +0 -98
  63. package/index.js +0 -50
  64. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  65. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  66. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  67. package/ios/RCTWebRTC.xcodeproj/xcuserdata/saghul.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -0,0 +1,9 @@
1
+ android
2
+ apple
3
+ examples
4
+ ios
5
+ macos
6
+ tools
7
+ Documentation
8
+ *.md
9
+ *.json
@@ -0,0 +1,10 @@
1
+ {
2
+ "printWidth": 120,
3
+ "tabWidth": 4,
4
+ "useTabs": false,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "trailingComma": "none",
8
+ "bracketSpacing": true,
9
+ "arrowParens": "avoid"
10
+ }
package/README.md CHANGED
@@ -7,7 +7,7 @@ A WebRTC module for React Native.
7
7
  - Support iOS / macOS / Android.
8
8
  - Support Video / Audio / Data Channels.
9
9
 
10
- **NOTE** for Expo users: this plugin doesn't work unless you eject.
10
+ > 🚨 Expo: This package is not available in the [Expo Go](https://expo.dev/client) app. Learn how you can use this package in [Custom Dev Clients](https://docs.expo.dev/development/getting-started/) via the out-of-tree [Expo Config Plugin](https://github.com/expo/config-plugins/tree/master/packages/react-native-webrtc).
11
11
 
12
12
  ## Community
13
13
 
@@ -15,7 +15,7 @@ Everyone is welcome to our [Discourse community](https://react-native-webrtc.dis
15
15
 
16
16
  ## WebRTC Revision
17
17
 
18
- * Currently used revision: [M92](https://github.com/jitsi/webrtc/commit/4f97ba956083bdd402aa6d3f55cc064831f88f50)
18
+ * Currently used revision: [M94](https://github.com/jitsi/webrtc/releases/tag/v94.0.0)
19
19
  * Supported architectures
20
20
  * Android: armeabi-v7a, arm64-v8a, x86, x86_64
21
21
  * iOS: arm64, x86_64 (for bitcode support, run [this script](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/tools/downloadBitcode.sh))
File without changes
@@ -107,9 +107,11 @@ class GetUserMediaImpl {
107
107
 
108
108
  AudioSource audioSource = pcFactory.createAudioSource(peerConstraints);
109
109
  AudioTrack track = pcFactory.createAudioTrack(id, audioSource);
110
+
111
+ // surfaceTextureHelper is initialized for videoTrack only, so its null here.
110
112
  tracks.put(
111
113
  id,
112
- new TrackPrivate(track, audioSource, /* videoCapturer */ null));
114
+ new TrackPrivate(track, audioSource, /* videoCapturer */ null, /* surfaceTextureHelper */ null));
113
115
 
114
116
  return track;
115
117
  }
@@ -180,11 +182,6 @@ class GetUserMediaImpl {
180
182
  final ReadableMap constraints,
181
183
  final Callback successCallback,
182
184
  final Callback errorCallback) {
183
- // TODO: change getUserMedia constraints format to support new syntax
184
- // constraint format seems changed, and there is no mandatory any more.
185
- // and has a new syntax/attrs to specify resolution
186
- // should change `parseConstraints()` according
187
- // see: https://www.w3.org/TR/mediacapture-streams/#idl-def-MediaTrackConstraints
188
185
 
189
186
  AudioTrack audioTrack = null;
190
187
  VideoTrack videoTrack = null;
@@ -386,7 +383,7 @@ class GetUserMediaImpl {
386
383
  VideoTrack track = pcFactory.createVideoTrack(id, videoSource);
387
384
 
388
385
  track.setEnabled(true);
389
- tracks.put(id, new TrackPrivate(track, videoSource, videoCaptureController));
386
+ tracks.put(id, new TrackPrivate(track, videoSource, videoCaptureController, surfaceTextureHelper));
390
387
 
391
388
  videoCaptureController.startCapture();
392
389
 
@@ -410,6 +407,8 @@ class GetUserMediaImpl {
410
407
  * if {@link #track} is a {@link VideoTrack}.
411
408
  */
412
409
  public final AbstractVideoCaptureController videoCaptureController;
410
+
411
+ private final SurfaceTextureHelper surfaceTextureHelper;
413
412
 
414
413
  /**
415
414
  * Whether this object has been disposed or not.
@@ -429,10 +428,12 @@ class GetUserMediaImpl {
429
428
  public TrackPrivate(
430
429
  MediaStreamTrack track,
431
430
  MediaSource mediaSource,
432
- AbstractVideoCaptureController videoCaptureController) {
431
+ AbstractVideoCaptureController videoCaptureController,
432
+ SurfaceTextureHelper surfaceTextureHelper) {
433
433
  this.track = track;
434
434
  this.mediaSource = mediaSource;
435
435
  this.videoCaptureController = videoCaptureController;
436
+ this.surfaceTextureHelper = surfaceTextureHelper;
436
437
  this.disposed = false;
437
438
  }
438
439
 
@@ -443,6 +444,18 @@ class GetUserMediaImpl {
443
444
  videoCaptureController.dispose();
444
445
  }
445
446
  }
447
+
448
+ /*
449
+ * As per webrtc library documentation - The caller still has ownership of {@code
450
+ * surfaceTextureHelper} and is responsible for making sure surfaceTextureHelper.dispose() is
451
+ * called. This also means that the caller can reuse the SurfaceTextureHelper to initialize a new
452
+ * VideoCapturer once the previous VideoCapturer has been disposed. */
453
+
454
+ if(surfaceTextureHelper != null) {
455
+ surfaceTextureHelper.stopListening();
456
+ surfaceTextureHelper.dispose();
457
+ }
458
+
446
459
  mediaSource.dispose();
447
460
  track.dispose();
448
461
  disposed = true;
@@ -1,5 +1,7 @@
1
1
  package com.oney.WebRTCModule;
2
2
 
3
+ import android.util.Log;
4
+
3
5
  import org.webrtc.PeerConnection;
4
6
  import org.webrtc.RTCStats;
5
7
  import org.webrtc.RTCStatsReport;
@@ -7,6 +9,8 @@ import org.webrtc.RTCStatsReport;
7
9
  import java.util.Map;
8
10
 
9
11
  public class StringUtils {
12
+ private static final String TAG = StringUtils.class.getSimpleName();
13
+
10
14
  /**
11
15
  * Constructs a JSON <tt>String</tt> representation of a specific array of
12
16
  * <tt>RTCStatsReport</tt>s (produced by {@link PeerConnection#getStats}).
@@ -74,6 +78,26 @@ public class StringUtils {
74
78
  }
75
79
 
76
80
  builder.append("]");
81
+ } else if (value instanceof Map) {
82
+ try {
83
+ Map<String, Object> mapValue = (Map) value;
84
+
85
+ boolean firstKey = true;
86
+ builder.append("{");
87
+
88
+ for (Map.Entry<String, Object> entry : mapValue.entrySet()) {
89
+ if (firstKey) {
90
+ firstKey = false;
91
+ } else {
92
+ builder.append(",");
93
+ }
94
+ builder.append("\"").append(entry.getKey()).append("\":");
95
+ appendValue(builder, entry.getValue());
96
+ }
97
+ builder.append("}");
98
+ } catch (ClassCastException e) {
99
+ Log.e(TAG, "Error parsing stats value " + value);
100
+ }
77
101
  } else if (value instanceof String) {
78
102
  builder.append("\"").append(value).append("\"");
79
103
  } else {