react-native-webrtc 111.0.3 → 111.0.5
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.
- package/README.md +13 -10
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +16 -2
- package/ios/RCTWebRTC/CaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +2 -2
- package/ios/RCTWebRTC/ScreenCapturer.m +4 -0
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +1 -1
- package/ios/RCTWebRTC/VideoCaptureController.h +2 -1
- package/ios/RCTWebRTC/VideoCaptureController.m +3 -0
- package/ios/RCTWebRTC/WebRTCModule+Permissions.m +10 -1
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +1 -1
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +40 -3
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +10 -4
- package/ios/RCTWebRTC/WebRTCModule.m +3 -1
- package/ios/RCTWebRTC/WebRTCModuleOptions.h +1 -0
- package/ios/RCTWebRTC/WebRTCModuleOptions.m +1 -0
- package/ios/RCTWebRTC.xcodeproj/project.pbxproj +1 -0
- package/lib/commonjs/MediaStream.js +2 -3
- package/lib/commonjs/MediaStream.js.map +1 -1
- package/lib/commonjs/MediaStreamTrackEvent.js +12 -2
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
- package/lib/commonjs/MessageEvent.js +13 -2
- package/lib/commonjs/MessageEvent.js.map +1 -1
- package/lib/commonjs/RTCDataChannel.js +1 -8
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCDataChannelEvent.js +12 -2
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +2 -3
- package/lib/commonjs/RTCErrorEvent.js.map +1 -1
- package/lib/commonjs/RTCEvent.js +13 -3
- package/lib/commonjs/RTCEvent.js.map +1 -1
- package/lib/commonjs/RTCIceCandidate.js.map +1 -1
- package/lib/commonjs/RTCIceCandidateEvent.js +13 -2
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +4 -23
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCTrackEvent.js +18 -2
- package/lib/commonjs/RTCTrackEvent.js.map +1 -1
- package/lib/module/MediaStream.js +2 -3
- package/lib/module/MediaStream.js.map +1 -1
- package/lib/module/MediaStreamTrackEvent.js +12 -2
- package/lib/module/MediaStreamTrackEvent.js.map +1 -1
- package/lib/module/MessageEvent.js +13 -2
- package/lib/module/MessageEvent.js.map +1 -1
- package/lib/module/RTCDataChannel.js +2 -9
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCDataChannelEvent.js +12 -2
- package/lib/module/RTCDataChannelEvent.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +2 -2
- package/lib/module/RTCErrorEvent.js.map +1 -1
- package/lib/module/RTCEvent.js +14 -3
- package/lib/module/RTCEvent.js.map +1 -1
- package/lib/module/RTCIceCandidate.js.map +1 -1
- package/lib/module/RTCIceCandidateEvent.js +13 -2
- package/lib/module/RTCIceCandidateEvent.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +5 -24
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCTrackEvent.js +18 -2
- package/lib/module/RTCTrackEvent.js.map +1 -1
- package/lib/typescript/MediaStream.d.ts +14 -4
- package/lib/typescript/MediaStream.d.ts.map +1 -1
- package/lib/typescript/MediaStreamTrackEvent.d.ts +16 -5
- package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -1
- package/lib/typescript/MessageEvent.d.ts +17 -5
- package/lib/typescript/MessageEvent.d.ts.map +1 -1
- package/lib/typescript/RTCDataChannel.d.ts +12 -3
- package/lib/typescript/RTCDataChannel.d.ts.map +1 -1
- package/lib/typescript/RTCDataChannelEvent.d.ts +16 -5
- package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -1
- package/lib/typescript/RTCErrorEvent.d.ts +3 -3
- package/lib/typescript/RTCErrorEvent.d.ts.map +1 -1
- package/lib/typescript/RTCEvent.d.ts +12 -3
- package/lib/typescript/RTCEvent.d.ts.map +1 -1
- package/lib/typescript/RTCIceCandidate.d.ts +7 -5
- package/lib/typescript/RTCIceCandidate.d.ts.map +1 -1
- package/lib/typescript/RTCIceCandidateEvent.d.ts +17 -3
- package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -1
- package/lib/typescript/RTCPeerConnection.d.ts +18 -3
- package/lib/typescript/RTCPeerConnection.d.ts.map +1 -1
- package/lib/typescript/RTCTrackEvent.d.ts +20 -6
- package/lib/typescript/RTCTrackEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-webrtc.podspec +1 -1
- package/src/MediaStream.ts +14 -4
- package/src/MediaStreamTrackEvent.ts +18 -4
- package/src/MessageEvent.ts +19 -5
- package/src/RTCDataChannel.ts +10 -8
- package/src/RTCDataChannelEvent.ts +21 -4
- package/src/RTCErrorEvent.ts +3 -3
- package/src/RTCEvent.ts +18 -4
- package/src/RTCIceCandidate.ts +7 -1
- package/src/RTCIceCandidateEvent.ts +19 -4
- package/src/RTCPeerConnection.ts +20 -27
- package/src/RTCTrackEvent.ts +25 -4
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ A WebRTC module for React Native.
|
|
|
10
10
|
|
|
11
11
|
## Feature Overview
|
|
12
12
|
|
|
13
|
-
| | Android | iOS | macOS* | Windows* | Web* | Expo* |
|
|
14
|
-
| :-: |
|
|
15
|
-
| Audio/Video | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
16
|
-
| Data Channels | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
17
|
-
| Screen Capture | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
18
|
-
| Plan B | - | - | - | - | - | - |
|
|
19
|
-
| Unified Plan* | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
20
|
-
| Simulcast* | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
13
|
+
| | Android | iOS | tvOS | macOS* | Windows* | Web* | Expo* |
|
|
14
|
+
| :- | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
|
|
15
|
+
| Audio/Video | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
16
|
+
| Data Channels | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
17
|
+
| Screen Capture | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
18
|
+
| Plan B | - | - | - | - | - | - | - |
|
|
19
|
+
| Unified Plan* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
20
|
+
| Simulcast* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
|
|
21
21
|
|
|
22
22
|
> **macOS** - We don't currently actively support macOS at this time.
|
|
23
23
|
Support might return in the future.
|
|
@@ -25,9 +25,10 @@ Support might return in the future.
|
|
|
25
25
|
> **Windows** - We don't currently support the [react-native-windows](https://github.com/microsoft/react-native-windows) platform at this time.
|
|
26
26
|
Anyone interested in getting the ball rolling? We're open to contributions.
|
|
27
27
|
|
|
28
|
-
> **Web** - The [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for [react-native-web](https://github.com/necolas/react-native-web) support.
|
|
28
|
+
> **Web** - The [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for [react-native-web](https://github.com/necolas/react-native-web) support.
|
|
29
|
+
Which will allow you to use [(almost)](https://github.com/react-native-webrtc/react-native-webrtc-web-shim/tree/main#setup) the exact same code in your [react-native-web](https://github.com/necolas/react-native-web) project as you would with [react-native](https://reactnative.dev/) directly.
|
|
29
30
|
|
|
30
|
-
> **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default.
|
|
31
|
+
> **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default.
|
|
31
32
|
However you can get things working via the [expo-dev-client](https://docs.expo.dev/development/getting-started/) library and out-of-tree [config-plugins/react-native-webrtc](https://github.com/expo/config-plugins/tree/master/packages/react-native-webrtc) package.
|
|
32
33
|
|
|
33
34
|
> **Unified Plan** - As of version 106.0.0 Unified Plan is the only supported mode.
|
|
@@ -42,6 +43,7 @@ Software encode/decode factories have been enabled by default.
|
|
|
42
43
|
* Supported architectures
|
|
43
44
|
* Android: armeabi-v7a, arm64-v8a, x86, x86_64
|
|
44
45
|
* iOS: arm64, x86_64
|
|
46
|
+
* tvOS: arm64
|
|
45
47
|
* macOS: (temporarily disabled)
|
|
46
48
|
|
|
47
49
|
## Getting Started
|
|
@@ -57,6 +59,7 @@ Don't forget to follow platform guides below to cover any extra required steps.
|
|
|
57
59
|
|
|
58
60
|
- [Android Install](./Documentation/AndroidInstallation.md)
|
|
59
61
|
- [iOS Install](./Documentation/iOSInstallation.md)
|
|
62
|
+
- [tvOS Install](./Documentation/tvOSInstallation.md)
|
|
60
63
|
- [Basic Usage](./Documentation/BasicUsage.md)
|
|
61
64
|
- [Step by Step Call Guide](./Documentation/CallGuide.md)
|
|
62
65
|
- [Improving Call Reliability](./Documentation/ImprovingCallReliability.md)
|
|
@@ -280,7 +280,7 @@ public class SerializeUtils {
|
|
|
280
280
|
return null;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
RtpTransceiver.RtpTransceiverDirection direction = RtpTransceiver.RtpTransceiverDirection.
|
|
283
|
+
RtpTransceiver.RtpTransceiverDirection direction = RtpTransceiver.RtpTransceiverDirection.SEND_RECV;
|
|
284
284
|
List<String> streamIds = new ArrayList<>();
|
|
285
285
|
List<RtpParameters.Encoding> sendEncodings = new ArrayList<>();
|
|
286
286
|
|
|
@@ -42,6 +42,7 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
42
42
|
PeerConnectionFactory mFactory;
|
|
43
43
|
VideoEncoderFactory mVideoEncoderFactory;
|
|
44
44
|
VideoDecoderFactory mVideoDecoderFactory;
|
|
45
|
+
AudioDeviceModule mAudioDeviceModule;
|
|
45
46
|
|
|
46
47
|
// Need to expose the peer connection codec factories here to get capabilities
|
|
47
48
|
private final SparseArray<PeerConnectionObserver> mPeerConnectionObservers;
|
|
@@ -103,6 +104,7 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
103
104
|
// Saving the encoder and decoder factories to get codec info later when needed.
|
|
104
105
|
mVideoEncoderFactory = encoderFactory;
|
|
105
106
|
mVideoDecoderFactory = decoderFactory;
|
|
107
|
+
mAudioDeviceModule = adm;
|
|
106
108
|
|
|
107
109
|
getUserMediaImpl = new GetUserMediaImpl(this, reactContext);
|
|
108
110
|
}
|
|
@@ -113,6 +115,14 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
113
115
|
return "WebRTCModule";
|
|
114
116
|
}
|
|
115
117
|
|
|
118
|
+
@Override
|
|
119
|
+
public void onCatalystInstanceDestroy() {
|
|
120
|
+
if (mAudioDeviceModule != null) {
|
|
121
|
+
mAudioDeviceModule.release();
|
|
122
|
+
}
|
|
123
|
+
super.onCatalystInstanceDestroy();
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
private PeerConnection getPeerConnection(int id) {
|
|
117
127
|
PeerConnectionObserver pco = mPeerConnectionObservers.get(id);
|
|
118
128
|
return (pco == null) ? null : pco.getPeerConnection();
|
|
@@ -367,16 +377,20 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
367
377
|
}
|
|
368
378
|
|
|
369
379
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
370
|
-
public
|
|
380
|
+
public boolean peerConnectionInit(ReadableMap configuration, int id) {
|
|
371
381
|
PeerConnection.RTCConfiguration rtcConfiguration = parseRTCConfiguration(configuration);
|
|
372
382
|
|
|
373
383
|
try {
|
|
374
|
-
ThreadUtils
|
|
384
|
+
return (boolean) ThreadUtils
|
|
375
385
|
.submitToExecutor(() -> {
|
|
376
386
|
PeerConnectionObserver observer = new PeerConnectionObserver(this, id);
|
|
377
387
|
PeerConnection peerConnection = mFactory.createPeerConnection(rtcConfiguration, observer);
|
|
388
|
+
if (peerConnection == null) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
378
391
|
observer.setPeerConnection(peerConnection);
|
|
379
392
|
mPeerConnectionObservers.put(id, observer);
|
|
393
|
+
return true;
|
|
380
394
|
})
|
|
381
395
|
.get();
|
|
382
396
|
} catch (ExecutionException | InterruptedException e) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#if !TARGET_OS_TV
|
|
1
2
|
|
|
2
3
|
#import <Foundation/Foundation.h>
|
|
3
4
|
#import <WebRTC/RTCCameraVideoCapturer.h>
|
|
@@ -5,7 +6,6 @@
|
|
|
5
6
|
#import "CaptureController.h"
|
|
6
7
|
|
|
7
8
|
@interface VideoCaptureController : CaptureController
|
|
8
|
-
|
|
9
9
|
@property(nonatomic, readonly, strong) AVCaptureDeviceFormat *selectedFormat;
|
|
10
10
|
@property(nonatomic, readonly, assign) int frameRate;
|
|
11
11
|
|
|
@@ -15,3 +15,4 @@
|
|
|
15
15
|
- (void)switchCamera;
|
|
16
16
|
|
|
17
17
|
@end
|
|
18
|
+
#endif
|
|
@@ -23,13 +23,16 @@ RCT_EXPORT_METHOD(checkPermission
|
|
|
23
23
|
: (NSString *)mediaType resolver
|
|
24
24
|
: (RCTPromiseResolveBlock)resolve rejecter
|
|
25
25
|
: (RCTPromiseRejectBlock)reject) {
|
|
26
|
+
#if TARGET_OS_TV
|
|
27
|
+
resolve(@"tvOS is not supported");
|
|
28
|
+
return;
|
|
29
|
+
#else
|
|
26
30
|
AVMediaType mediaType_ = [self avMediaType:mediaType];
|
|
27
31
|
|
|
28
32
|
if (mediaType_ == nil) {
|
|
29
33
|
reject(@"invalid_type", @"Invalid media type", nil);
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
32
|
-
|
|
33
36
|
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:mediaType_];
|
|
34
37
|
switch (status) {
|
|
35
38
|
case AVAuthorizationStatusAuthorized:
|
|
@@ -44,12 +47,17 @@ RCT_EXPORT_METHOD(checkPermission
|
|
|
44
47
|
resolve(PERMISSION_DENIED);
|
|
45
48
|
break;
|
|
46
49
|
}
|
|
50
|
+
#endif
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
RCT_EXPORT_METHOD(requestPermission
|
|
50
54
|
: (NSString *)mediaType resolver
|
|
51
55
|
: (RCTPromiseResolveBlock)resolve rejecter
|
|
52
56
|
: (RCTPromiseRejectBlock)reject) {
|
|
57
|
+
#if TARGET_OS_TV
|
|
58
|
+
resolve(@"tvOS is not supported");
|
|
59
|
+
return;
|
|
60
|
+
#else
|
|
53
61
|
AVMediaType mediaType_ = [self avMediaType:mediaType];
|
|
54
62
|
|
|
55
63
|
if (mediaType_ == nil) {
|
|
@@ -61,6 +69,7 @@ RCT_EXPORT_METHOD(requestPermission
|
|
|
61
69
|
completionHandler:^(BOOL granted) {
|
|
62
70
|
resolve(@(granted));
|
|
63
71
|
}];
|
|
72
|
+
#endif
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
@end
|
|
@@ -29,12 +29,15 @@
|
|
|
29
29
|
RTCAudioTrack *audioTrack = [self.peerConnectionFactory audioTrackWithTrackId:trackId];
|
|
30
30
|
return audioTrack;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
/**
|
|
34
33
|
* Initializes a new {@link RTCVideoTrack} with the given capture controller
|
|
35
34
|
*/
|
|
36
35
|
- (RTCVideoTrack *)createVideoTrackWithCaptureController:
|
|
37
36
|
(CaptureController * (^)(RTCVideoSource *))captureControllerCreator {
|
|
37
|
+
#if TARGET_OS_TV
|
|
38
|
+
return nil;
|
|
39
|
+
#else
|
|
40
|
+
|
|
38
41
|
RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
|
|
39
42
|
|
|
40
43
|
NSString *trackUUID = [[NSUUID UUID] UUIDString];
|
|
@@ -45,14 +48,17 @@
|
|
|
45
48
|
[captureController startCapture];
|
|
46
49
|
|
|
47
50
|
return videoTrack;
|
|
51
|
+
#endif
|
|
48
52
|
}
|
|
49
|
-
|
|
50
53
|
/**
|
|
51
54
|
* Initializes a new {@link RTCMediaTrack} with the given tracks.
|
|
52
55
|
*
|
|
53
56
|
* @return An array with the mediaStreamId in index 0, and track infos in index 1.
|
|
54
57
|
*/
|
|
55
58
|
- (NSArray *)createMediaStream:(NSArray<RTCMediaStreamTrack *> *)tracks {
|
|
59
|
+
#if TARGET_OS_TV
|
|
60
|
+
return nil;
|
|
61
|
+
#else
|
|
56
62
|
NSString *mediaStreamId = [[NSUUID UUID] UUIDString];
|
|
57
63
|
RTCMediaStream *mediaStream = [self.peerConnectionFactory mediaStreamWithStreamId:mediaStreamId];
|
|
58
64
|
NSMutableArray<NSDictionary *> *trackInfos = [NSMutableArray array];
|
|
@@ -91,12 +97,16 @@
|
|
|
91
97
|
|
|
92
98
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
93
99
|
return @[ mediaStreamId, trackInfos ];
|
|
100
|
+
#endif
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
/**
|
|
97
104
|
* Initializes a new {@link RTCVideoTrack} which satisfies the given constraints.
|
|
98
105
|
*/
|
|
99
106
|
- (RTCVideoTrack *)createVideoTrack:(NSDictionary *)constraints {
|
|
107
|
+
#if TARGET_OS_TV
|
|
108
|
+
return nil;
|
|
109
|
+
#else
|
|
100
110
|
RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
|
|
101
111
|
|
|
102
112
|
NSString *trackUUID = [[NSUUID UUID] UUIDString];
|
|
@@ -111,10 +121,11 @@
|
|
|
111
121
|
#endif
|
|
112
122
|
|
|
113
123
|
return videoTrack;
|
|
124
|
+
#endif
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
- (RTCVideoTrack *)createScreenCaptureVideoTrack {
|
|
117
|
-
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX
|
|
128
|
+
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX || TARGET_OS_TV
|
|
118
129
|
return nil;
|
|
119
130
|
#endif
|
|
120
131
|
|
|
@@ -136,6 +147,11 @@
|
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
|
|
150
|
+
#if TARGET_OS_TV
|
|
151
|
+
reject(@"unsupported_platform", @"tvOS is not supported", nil);
|
|
152
|
+
return;
|
|
153
|
+
#else
|
|
154
|
+
|
|
139
155
|
RTCVideoTrack *videoTrack = [self createScreenCaptureVideoTrack];
|
|
140
156
|
|
|
141
157
|
if (videoTrack == nil) {
|
|
@@ -160,6 +176,7 @@ RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
|
160
176
|
|
|
161
177
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
162
178
|
resolve(@{@"streamId" : mediaStreamId, @"track" : trackInfo});
|
|
179
|
+
#endif
|
|
163
180
|
}
|
|
164
181
|
|
|
165
182
|
/**
|
|
@@ -173,6 +190,10 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
173
190
|
: (NSDictionary *)constraints successCallback
|
|
174
191
|
: (RCTResponseSenderBlock)successCallback errorCallback
|
|
175
192
|
: (RCTResponseSenderBlock)errorCallback) {
|
|
193
|
+
#if TARGET_OS_TV
|
|
194
|
+
errorCallback(@[ @"PlatformNotSupported", @"getUserMedia is not supported on tvOS." ]);
|
|
195
|
+
return;
|
|
196
|
+
#else
|
|
176
197
|
RTCAudioTrack *audioTrack = nil;
|
|
177
198
|
RTCVideoTrack *videoTrack = nil;
|
|
178
199
|
|
|
@@ -231,11 +252,15 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
231
252
|
|
|
232
253
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
233
254
|
successCallback(@[ mediaStreamId, tracks ]);
|
|
255
|
+
#endif
|
|
234
256
|
}
|
|
235
257
|
|
|
236
258
|
#pragma mark - Other stream related APIs
|
|
237
259
|
|
|
238
260
|
RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
|
|
261
|
+
#if TARGET_OS_TV
|
|
262
|
+
callback(@[]);
|
|
263
|
+
#else
|
|
239
264
|
NSMutableArray *devices = [NSMutableArray array];
|
|
240
265
|
AVCaptureDeviceDiscoverySession *videoevicesSession =
|
|
241
266
|
[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
|
|
@@ -277,6 +302,7 @@ RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
|
|
|
277
302
|
}];
|
|
278
303
|
}
|
|
279
304
|
callback(@[ devices ]);
|
|
305
|
+
#endif
|
|
280
306
|
}
|
|
281
307
|
|
|
282
308
|
RCT_EXPORT_METHOD(mediaStreamCreate : (nonnull NSString *)streamID) {
|
|
@@ -334,12 +360,17 @@ RCT_EXPORT_METHOD(mediaStreamRelease : (nonnull NSString *)streamID) {
|
|
|
334
360
|
}
|
|
335
361
|
|
|
336
362
|
RCT_EXPORT_METHOD(mediaStreamTrackRelease : (nonnull NSString *)trackID) {
|
|
363
|
+
#if TARGET_OS_TV
|
|
364
|
+
return;
|
|
365
|
+
#else
|
|
366
|
+
|
|
337
367
|
RTCMediaStreamTrack *track = self.localTracks[trackID];
|
|
338
368
|
if (track) {
|
|
339
369
|
track.isEnabled = NO;
|
|
340
370
|
[track.captureController stopCapture];
|
|
341
371
|
[self.localTracks removeObjectForKey:trackID];
|
|
342
372
|
}
|
|
373
|
+
#endif
|
|
343
374
|
}
|
|
344
375
|
|
|
345
376
|
RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnull NSString *)trackID : (BOOL)enabled) {
|
|
@@ -349,6 +380,7 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
|
|
|
349
380
|
}
|
|
350
381
|
|
|
351
382
|
track.isEnabled = enabled;
|
|
383
|
+
#if !TARGET_OS_TV
|
|
352
384
|
if (track.captureController) { // It could be a remote track!
|
|
353
385
|
if (enabled) {
|
|
354
386
|
[track.captureController startCapture];
|
|
@@ -356,14 +388,19 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
|
|
|
356
388
|
[track.captureController stopCapture];
|
|
357
389
|
}
|
|
358
390
|
}
|
|
391
|
+
#endif
|
|
359
392
|
}
|
|
360
393
|
|
|
361
394
|
RCT_EXPORT_METHOD(mediaStreamTrackSwitchCamera : (nonnull NSString *)trackID) {
|
|
395
|
+
#if TARGET_OS_TV
|
|
396
|
+
return;
|
|
397
|
+
#else
|
|
362
398
|
RTCMediaStreamTrack *track = self.localTracks[trackID];
|
|
363
399
|
if (track) {
|
|
364
400
|
RTCVideoTrack *videoTrack = (RTCVideoTrack *)track;
|
|
365
401
|
[(VideoCaptureController *)videoTrack.captureController switchCamera];
|
|
366
402
|
}
|
|
403
|
+
#endif
|
|
367
404
|
}
|
|
368
405
|
|
|
369
406
|
RCT_EXPORT_METHOD(mediaStreamTrackSetVolume : (nonnull NSNumber *)pcId : (nonnull NSString *)trackID : (double)volume) {
|
|
@@ -76,13 +76,19 @@ int _transceiverNextId = 0;
|
|
|
76
76
|
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(peerConnectionInit
|
|
77
77
|
: (RTCConfiguration *)configuration objectID
|
|
78
78
|
: (nonnull NSNumber *)objectID) {
|
|
79
|
+
__block BOOL ret = YES;
|
|
80
|
+
|
|
79
81
|
dispatch_sync(self.workerQueue, ^{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
[[RTCMediaConstraints alloc] initWithMandatoryConstraints:nil optionalConstraints:optionalConstraints];
|
|
82
|
+
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:nil
|
|
83
|
+
optionalConstraints:nil];
|
|
83
84
|
RTCPeerConnection *peerConnection = [self.peerConnectionFactory peerConnectionWithConfiguration:configuration
|
|
84
85
|
constraints:constraints
|
|
85
86
|
delegate:self];
|
|
87
|
+
if (peerConnection == nil) {
|
|
88
|
+
ret = NO;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
peerConnection.dataChannels = [NSMutableDictionary new];
|
|
87
93
|
peerConnection.reactTag = objectID;
|
|
88
94
|
peerConnection.remoteStreams = [NSMutableDictionary new];
|
|
@@ -93,7 +99,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(peerConnectionInit
|
|
|
93
99
|
self.peerConnections[objectID] = peerConnection;
|
|
94
100
|
});
|
|
95
101
|
|
|
96
|
-
return
|
|
102
|
+
return @(ret);
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
RCT_EXPORT_METHOD(peerConnectionSetConfiguration
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
self = [super init];
|
|
41
41
|
if (self) {
|
|
42
42
|
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
|
|
43
|
+
id<RTCAudioDevice> audioDevice = options.audioDevice;
|
|
43
44
|
id<RTCVideoDecoderFactory> decoderFactory = options.videoDecoderFactory;
|
|
44
45
|
id<RTCVideoEncoderFactory> encoderFactory = options.videoEncoderFactory;
|
|
45
46
|
NSDictionary *fieldTrials = options.fieldTrials;
|
|
@@ -69,7 +70,8 @@
|
|
|
69
70
|
RCTLogInfo(@"Using video decoder factory: %@", NSStringFromClass([decoderFactory class]));
|
|
70
71
|
|
|
71
72
|
_peerConnectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
|
|
72
|
-
decoderFactory:decoderFactory
|
|
73
|
+
decoderFactory:decoderFactory
|
|
74
|
+
audioDevice:audioDevice];
|
|
73
75
|
|
|
74
76
|
_peerConnections = [NSMutableDictionary new];
|
|
75
77
|
_localStreams = [NSMutableDictionary new];
|
|
@@ -7,6 +7,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
7
7
|
|
|
8
8
|
@property(nonatomic, strong, nullable) id<RTCVideoDecoderFactory> videoDecoderFactory;
|
|
9
9
|
@property(nonatomic, strong, nullable) id<RTCVideoEncoderFactory> videoEncoderFactory;
|
|
10
|
+
@property(nonatomic, strong, nullable) id<RTCAudioDevice> audioDevice;
|
|
10
11
|
@property(nonatomic, strong, nullable) NSDictionary *fieldTrials;
|
|
11
12
|
@property(nonatomic, assign) RTCLoggingSeverity loggingSeverity;
|
|
12
13
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _eventTargetShim = require("event-target-shim");
|
|
7
|
+
var _eventTargetShim = _interopRequireDefault(require("event-target-shim"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _MediaStreamTrack = _interopRequireDefault(require("./MediaStreamTrack"));
|
|
10
10
|
var _RTCUtil = require("./RTCUtil");
|
|
@@ -12,8 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
const {
|
|
13
13
|
WebRTCModule
|
|
14
14
|
} = _reactNative.NativeModules;
|
|
15
|
-
|
|
16
|
-
class MediaStream extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDIA_STREAM_EVENTS) {
|
|
15
|
+
class MediaStream extends _eventTargetShim.default {
|
|
17
16
|
_tracks = [];
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_eventTargetShim","require","_reactNative","_MediaStreamTrack","
|
|
1
|
+
{"version":3,"names":["_eventTargetShim","_interopRequireDefault","require","_reactNative","_MediaStreamTrack","_RTCUtil","obj","__esModule","default","WebRTCModule","NativeModules","MediaStream","EventTarget","_tracks","constructor","arg","_id","uniqueID","_reactTag","mediaStreamCreate","id","track","getTracks","addTrack","Array","isArray","streamId","streamReactTag","tracks","trackInfo","push","MediaStreamTrack","TypeError","active","index","indexOf","mediaStreamAddTrack","remote","_peerConnectionId","removeTrack","splice","mediaStreamRemoveTrack","slice","getTrackById","trackId","find","getAudioTracks","filter","kind","getVideoTracks","clone","Error","toURL","release","releaseTracks","arguments","length","undefined","mediaStreamRelease","exports"],"sourceRoot":"../../src","sources":["MediaStream.ts"],"mappings":"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"}
|
|
@@ -4,9 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
var _eventTargetShim = require("event-target-shim");
|
|
8
|
+
/**
|
|
9
|
+
* @eventClass
|
|
10
|
+
* This event is fired whenever the MediaStreamTrack has changed in any way.
|
|
11
|
+
* @param {MEDIA_STREAM_EVENTS} type - The type of event.
|
|
12
|
+
* @param {IMediaStreamTrackEventInitDict} eventInitDict - The event init properties.
|
|
13
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream#events MDN} for details.
|
|
14
|
+
*/
|
|
15
|
+
class MediaStreamTrackEvent extends _eventTargetShim.Event {
|
|
16
|
+
/** @eventProperty */
|
|
17
|
+
|
|
8
18
|
constructor(type, eventInitDict) {
|
|
9
|
-
|
|
19
|
+
super(type, eventInitDict);
|
|
10
20
|
this.track = eventInitDict.track;
|
|
11
21
|
}
|
|
12
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MediaStreamTrackEvent","constructor","type","eventInitDict","
|
|
1
|
+
{"version":3,"names":["_eventTargetShim","require","MediaStreamTrackEvent","Event","constructor","type","eventInitDict","track","exports","default"],"sourceRoot":"../../src","sources":["MediaStreamTrackEvent.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMC,qBAAqB,SAAiDC,sBAAK,CAAa;EACzG;;EAEAC,WAAWA,CAACC,IAAgB,EAAEC,aAA6C,EAAE;IACzE,KAAK,CAACD,IAAI,EAAEC,aAAa,CAAC;IAC1B,IAAI,CAACC,KAAK,GAAGD,aAAa,CAACC,KAAK;EACpC;AACJ;AAACC,OAAA,CAAAC,OAAA,GAAAP,qBAAA"}
|
|
@@ -4,9 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
var _eventTargetShim = require("event-target-shim");
|
|
8
|
+
/**
|
|
9
|
+
* @eventClass
|
|
10
|
+
* This event is fired whenever the RTCDataChannel send message.
|
|
11
|
+
* @param {MESSAGE_EVENTS} type - The type of event.
|
|
12
|
+
* @param {IMessageEventInitDict} eventInitDict - The event init properties.
|
|
13
|
+
* @see
|
|
14
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/message_event#event_type MDN} for details.
|
|
15
|
+
*/
|
|
16
|
+
class MessageEvent extends _eventTargetShim.Event {
|
|
17
|
+
/** @eventProperty */
|
|
18
|
+
|
|
8
19
|
constructor(type, eventInitDict) {
|
|
9
|
-
|
|
20
|
+
super(type, eventInitDict);
|
|
10
21
|
this.data = eventInitDict.data;
|
|
11
22
|
}
|
|
12
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MessageEvent","constructor","type","eventInitDict","
|
|
1
|
+
{"version":3,"names":["_eventTargetShim","require","MessageEvent","Event","constructor","type","eventInitDict","data","exports","default"],"sourceRoot":"../../src","sources":["MessageEvent.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMC,YAAY,SAA4CC,sBAAK,CAAa;EAC3F;;EAEAC,WAAWA,CAACC,IAAgB,EAAEC,aAAoC,EAAE;IAChE,KAAK,CAACD,IAAI,EAAEC,aAAa,CAAC;IAC1B,IAAI,CAACC,IAAI,GAAGD,aAAa,CAACC,IAAI;EAClC;AACJ;AAACC,OAAA,CAAAC,OAAA,GAAAP,YAAA"}
|
|
@@ -16,8 +16,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
const {
|
|
17
17
|
WebRTCModule
|
|
18
18
|
} = _reactNative.NativeModules;
|
|
19
|
-
|
|
20
|
-
class RTCDataChannel extends (0, _eventTargetShim.defineCustomEventTarget)(...DATA_CHANNEL_EVENTS) {
|
|
19
|
+
class RTCDataChannel extends _eventTargetShim.EventTarget {
|
|
21
20
|
binaryType = 'arraybuffer'; // we only support 'arraybuffer'
|
|
22
21
|
bufferedAmountLowThreshold = 0;
|
|
23
22
|
constructor(info) {
|
|
@@ -95,17 +94,14 @@ class RTCDataChannel extends (0, _eventTargetShim.defineCustomEventTarget)(...DA
|
|
|
95
94
|
this._id = ev.id;
|
|
96
95
|
}
|
|
97
96
|
if (this._readyState === 'open') {
|
|
98
|
-
// @ts-ignore
|
|
99
97
|
this.dispatchEvent(new _RTCDataChannelEvent.default('open', {
|
|
100
98
|
channel: this
|
|
101
99
|
}));
|
|
102
100
|
} else if (this._readyState === 'closing') {
|
|
103
|
-
// @ts-ignore
|
|
104
101
|
this.dispatchEvent(new _RTCDataChannelEvent.default('closing', {
|
|
105
102
|
channel: this
|
|
106
103
|
}));
|
|
107
104
|
} else if (this._readyState === 'closed') {
|
|
108
|
-
// @ts-ignore
|
|
109
105
|
this.dispatchEvent(new _RTCDataChannelEvent.default('close', {
|
|
110
106
|
channel: this
|
|
111
107
|
}));
|
|
@@ -123,8 +119,6 @@ class RTCDataChannel extends (0, _eventTargetShim.defineCustomEventTarget)(...DA
|
|
|
123
119
|
if (ev.type === 'binary') {
|
|
124
120
|
data = base64.toByteArray(ev.data).buffer;
|
|
125
121
|
}
|
|
126
|
-
|
|
127
|
-
// @ts-ignore
|
|
128
122
|
this.dispatchEvent(new _MessageEvent.default('message', {
|
|
129
123
|
data
|
|
130
124
|
}));
|
|
@@ -135,7 +129,6 @@ class RTCDataChannel extends (0, _eventTargetShim.defineCustomEventTarget)(...DA
|
|
|
135
129
|
}
|
|
136
130
|
this._bufferedAmount = ev.bufferedAmount;
|
|
137
131
|
if (this._bufferedAmount < this.bufferedAmountLowThreshold) {
|
|
138
|
-
// @ts-ignore
|
|
139
132
|
this.dispatchEvent(new _RTCDataChannelEvent.default('bufferedamountlow', {
|
|
140
133
|
channel: this
|
|
141
134
|
}));
|