react-native-webrtc 111.0.0 → 111.0.6
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/.github/workflows/android_ci.yml +5 -1
- package/.github/workflows/ios_ci.yml +4 -0
- package/ISSUE_TEMPLATE.md +27 -12
- package/README.md +22 -10
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +0 -1
- package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +19 -14
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +53 -8
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +21 -21
- package/ios/RCTWebRTC/CaptureController.m +4 -0
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +7 -1
- package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +2 -2
- package/ios/RCTWebRTC/ScreenCapturer.m +4 -0
- package/ios/RCTWebRTC/SerializeUtils.m +12 -10
- 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 +42 -8
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +29 -13
- 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/EventEmitter.js +4 -16
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/Logger.js +2 -26
- package/lib/commonjs/Logger.js.map +1 -1
- package/lib/commonjs/MediaDevices.js +8 -15
- package/lib/commonjs/MediaDevices.js.map +1 -1
- package/lib/commonjs/MediaStream.js +21 -44
- package/lib/commonjs/MediaStream.js.map +1 -1
- package/lib/commonjs/MediaStreamError.js +0 -11
- package/lib/commonjs/MediaStreamError.js.map +1 -1
- package/lib/commonjs/MediaStreamErrorEvent.js +0 -9
- package/lib/commonjs/MediaStreamErrorEvent.js.map +1 -1
- package/lib/commonjs/MediaStreamTrack.js +14 -69
- package/lib/commonjs/MediaStreamTrack.js.map +1 -1
- package/lib/commonjs/MediaStreamTrackEvent.js +11 -10
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
- package/lib/commonjs/MessageEvent.js +12 -10
- package/lib/commonjs/MessageEvent.js.map +1 -1
- package/lib/commonjs/Permissions.js +19 -29
- package/lib/commonjs/Permissions.js.map +1 -1
- package/lib/commonjs/RTCDataChannel.js +18 -77
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCDataChannelEvent.js +11 -10
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +2 -15
- package/lib/commonjs/RTCErrorEvent.js.map +1 -1
- package/lib/commonjs/RTCIceCandidate.js +0 -14
- package/lib/commonjs/RTCIceCandidate.js.map +1 -1
- package/lib/commonjs/RTCIceCandidateEvent.js +13 -13
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +129 -239
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtcpParameters.js +0 -10
- package/lib/commonjs/RTCRtcpParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpCapabilities.js +5 -22
- package/lib/commonjs/RTCRtpCapabilities.js.map +1 -1
- package/lib/commonjs/RTCRtpCodecCapability.js +0 -8
- package/lib/commonjs/RTCRtpCodecCapability.js.map +1 -1
- package/lib/commonjs/RTCRtpCodecParameters.js +0 -19
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpEncodingParameters.js +4 -34
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpHeaderExtension.js +0 -12
- package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -1
- package/lib/commonjs/RTCRtpParameters.js +2 -18
- package/lib/commonjs/RTCRtpParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiveParameters.js +0 -5
- package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiver.js +1 -26
- package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
- package/lib/commonjs/RTCRtpSendParameters.js +0 -22
- package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpSender.js +1 -30
- package/lib/commonjs/RTCRtpSender.js.map +1 -1
- package/lib/commonjs/RTCRtpTransceiver.js +3 -36
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
- package/lib/commonjs/RTCSessionDescription.js +0 -13
- package/lib/commonjs/RTCSessionDescription.js.map +1 -1
- package/lib/commonjs/RTCTrackEvent.js +16 -14
- package/lib/commonjs/RTCTrackEvent.js.map +1 -1
- package/lib/commonjs/RTCUtil.js +9 -36
- package/lib/commonjs/RTCUtil.js.map +1 -1
- package/lib/commonjs/RTCView.js +6 -3
- package/lib/commonjs/RTCView.js.map +1 -1
- package/lib/commonjs/ScreenCapturePickerView.js +0 -3
- package/lib/commonjs/ScreenCapturePickerView.js.map +1 -1
- package/lib/commonjs/getDisplayMedia.js +0 -6
- package/lib/commonjs/getDisplayMedia.js.map +1 -1
- package/lib/commonjs/getUserMedia.js +7 -28
- package/lib/commonjs/getUserMedia.js.map +1 -1
- package/lib/commonjs/index.js +1 -26
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/EventEmitter.js +5 -12
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/Logger.js +2 -22
- package/lib/module/Logger.js.map +1 -1
- package/lib/module/MediaDevices.js +9 -9
- package/lib/module/MediaDevices.js.map +1 -1
- package/lib/module/MediaStream.js +24 -39
- package/lib/module/MediaStream.js.map +1 -1
- package/lib/module/MediaStreamError.js +0 -9
- package/lib/module/MediaStreamError.js.map +1 -1
- package/lib/module/MediaStreamErrorEvent.js +0 -7
- package/lib/module/MediaStreamErrorEvent.js.map +1 -1
- package/lib/module/MediaStreamTrack.js +14 -62
- package/lib/module/MediaStreamTrack.js.map +1 -1
- package/lib/module/MediaStreamTrackEvent.js +11 -8
- package/lib/module/MediaStreamTrackEvent.js.map +1 -1
- package/lib/module/MessageEvent.js +12 -8
- package/lib/module/MessageEvent.js.map +1 -1
- package/lib/module/Permissions.js +19 -26
- package/lib/module/Permissions.js.map +1 -1
- package/lib/module/RTCDataChannel.js +20 -67
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCDataChannelEvent.js +11 -8
- package/lib/module/RTCDataChannelEvent.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +2 -11
- package/lib/module/RTCErrorEvent.js.map +1 -1
- package/lib/module/RTCIceCandidate.js +0 -12
- package/lib/module/RTCIceCandidate.js.map +1 -1
- package/lib/module/RTCIceCandidateEvent.js +13 -11
- package/lib/module/RTCIceCandidateEvent.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +131 -215
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtcpParameters.js +0 -8
- package/lib/module/RTCRtcpParameters.js.map +1 -1
- package/lib/module/RTCRtpCapabilities.js +5 -17
- package/lib/module/RTCRtpCapabilities.js.map +1 -1
- package/lib/module/RTCRtpCodecCapability.js +0 -6
- package/lib/module/RTCRtpCodecCapability.js.map +1 -1
- package/lib/module/RTCRtpCodecParameters.js +0 -17
- package/lib/module/RTCRtpCodecParameters.js.map +1 -1
- package/lib/module/RTCRtpEncodingParameters.js +4 -32
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/module/RTCRtpHeaderExtension.js +0 -10
- package/lib/module/RTCRtpHeaderExtension.js.map +1 -1
- package/lib/module/RTCRtpParameters.js +2 -12
- package/lib/module/RTCRtpParameters.js.map +1 -1
- package/lib/module/RTCRtpReceiveParameters.js +0 -1
- package/lib/module/RTCRtpReceiveParameters.js.map +1 -1
- package/lib/module/RTCRtpReceiver.js +1 -19
- package/lib/module/RTCRtpReceiver.js.map +1 -1
- package/lib/module/RTCRtpSendParameters.js +0 -18
- package/lib/module/RTCRtpSendParameters.js.map +1 -1
- package/lib/module/RTCRtpSender.js +1 -23
- package/lib/module/RTCRtpSender.js.map +1 -1
- package/lib/module/RTCRtpTransceiver.js +3 -32
- package/lib/module/RTCRtpTransceiver.js.map +1 -1
- package/lib/module/RTCSessionDescription.js +0 -11
- package/lib/module/RTCSessionDescription.js.map +1 -1
- package/lib/module/RTCTrackEvent.js +16 -12
- package/lib/module/RTCTrackEvent.js.map +1 -1
- package/lib/module/RTCUtil.js +9 -32
- package/lib/module/RTCUtil.js.map +1 -1
- package/lib/module/RTCView.js +1 -0
- package/lib/module/RTCView.js.map +1 -1
- package/lib/module/ScreenCapturePickerView.js.map +1 -1
- package/lib/module/getDisplayMedia.js.map +1 -1
- package/lib/module/getUserMedia.js +7 -18
- package/lib/module/getUserMedia.js.map +1 -1
- package/lib/module/index.js +2 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/EventEmitter.d.ts +3 -2
- package/lib/typescript/EventEmitter.d.ts.map +1 -0
- package/lib/typescript/Logger.d.ts +1 -0
- package/lib/typescript/Logger.d.ts.map +1 -0
- package/lib/typescript/MediaDevices.d.ts +6 -3
- package/lib/typescript/MediaDevices.d.ts.map +1 -0
- package/lib/typescript/MediaStream.d.ts +17 -7
- package/lib/typescript/MediaStream.d.ts.map +1 -0
- package/lib/typescript/MediaStreamError.d.ts +1 -0
- package/lib/typescript/MediaStreamError.d.ts.map +1 -0
- package/lib/typescript/MediaStreamErrorEvent.d.ts +1 -0
- package/lib/typescript/MediaStreamErrorEvent.d.ts.map +1 -0
- package/lib/typescript/MediaStreamTrack.d.ts +21 -6
- package/lib/typescript/MediaStreamTrack.d.ts.map +1 -0
- package/lib/typescript/MediaStreamTrackEvent.d.ts +17 -5
- package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -0
- package/lib/typescript/MessageEvent.d.ts +19 -6
- package/lib/typescript/MessageEvent.d.ts.map +1 -0
- package/lib/typescript/Permissions.d.ts +2 -1
- package/lib/typescript/Permissions.d.ts.map +1 -0
- package/lib/typescript/RTCDataChannel.d.ts +14 -4
- package/lib/typescript/RTCDataChannel.d.ts.map +1 -0
- package/lib/typescript/RTCDataChannelEvent.d.ts +17 -5
- package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -0
- package/lib/typescript/RTCErrorEvent.d.ts +5 -4
- package/lib/typescript/RTCErrorEvent.d.ts.map +1 -0
- package/lib/typescript/RTCIceCandidate.d.ts +8 -5
- package/lib/typescript/RTCIceCandidate.d.ts.map +1 -0
- package/lib/typescript/RTCIceCandidateEvent.d.ts +18 -3
- package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -0
- package/lib/typescript/RTCPeerConnection.d.ts +23 -8
- package/lib/typescript/RTCPeerConnection.d.ts.map +1 -0
- package/lib/typescript/RTCRtcpParameters.d.ts +1 -0
- package/lib/typescript/RTCRtcpParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpCapabilities.d.ts +1 -0
- package/lib/typescript/RTCRtpCapabilities.d.ts.map +1 -0
- package/lib/typescript/RTCRtpCodecCapability.d.ts +1 -0
- package/lib/typescript/RTCRtpCodecCapability.d.ts.map +1 -0
- package/lib/typescript/RTCRtpCodecParameters.d.ts +1 -0
- package/lib/typescript/RTCRtpCodecParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +1 -0
- package/lib/typescript/RTCRtpEncodingParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpHeaderExtension.d.ts +1 -0
- package/lib/typescript/RTCRtpHeaderExtension.d.ts.map +1 -0
- package/lib/typescript/RTCRtpParameters.d.ts +1 -0
- package/lib/typescript/RTCRtpParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -0
- package/lib/typescript/RTCRtpReceiveParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpReceiver.d.ts +1 -0
- package/lib/typescript/RTCRtpReceiver.d.ts.map +1 -0
- package/lib/typescript/RTCRtpSendParameters.d.ts +2 -1
- package/lib/typescript/RTCRtpSendParameters.d.ts.map +1 -0
- package/lib/typescript/RTCRtpSender.d.ts +1 -0
- package/lib/typescript/RTCRtpSender.d.ts.map +1 -0
- package/lib/typescript/RTCRtpTransceiver.d.ts +1 -0
- package/lib/typescript/RTCRtpTransceiver.d.ts.map +1 -0
- package/lib/typescript/RTCSessionDescription.d.ts +1 -0
- package/lib/typescript/RTCSessionDescription.d.ts.map +1 -0
- package/lib/typescript/RTCTrackEvent.d.ts +21 -6
- package/lib/typescript/RTCTrackEvent.d.ts.map +1 -0
- package/lib/typescript/RTCUtil.d.ts +1 -0
- package/lib/typescript/RTCUtil.d.ts.map +1 -0
- package/lib/typescript/RTCView.d.ts +1 -0
- package/lib/typescript/RTCView.d.ts.map +1 -0
- package/lib/typescript/ScreenCapturePickerView.d.ts +1 -0
- package/lib/typescript/ScreenCapturePickerView.d.ts.map +1 -0
- package/lib/typescript/getDisplayMedia.d.ts +1 -0
- package/lib/typescript/getDisplayMedia.d.ts.map +1 -0
- package/lib/typescript/getUserMedia.d.ts +1 -0
- package/lib/typescript/getUserMedia.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +3 -5
- package/react-native-webrtc.podspec +1 -1
- package/src/MediaDevices.ts +13 -4
- package/src/MediaStream.ts +37 -13
- package/src/MediaStreamTrack.ts +28 -7
- package/src/MediaStreamTrackEvent.ts +18 -4
- package/src/MessageEvent.ts +19 -5
- package/src/RTCDataChannel.ts +22 -9
- package/src/RTCDataChannelEvent.ts +21 -4
- package/src/RTCErrorEvent.ts +3 -3
- package/src/RTCIceCandidate.ts +7 -1
- package/src/RTCIceCandidateEvent.ts +19 -4
- package/src/RTCPeerConnection.ts +61 -35
- package/src/RTCRtpTransceiver.ts +2 -2
- package/src/RTCTrackEvent.ts +25 -4
- package/src/index.ts +1 -2
- package/tools/format.sh +6 -0
- package/lib/commonjs/MediaStreamEvent.js +0 -23
- package/lib/commonjs/MediaStreamEvent.js.map +0 -1
- package/lib/commonjs/RTCEvent.js +0 -20
- package/lib/commonjs/RTCEvent.js.map +0 -1
- package/lib/module/MediaStreamEvent.js +0 -14
- package/lib/module/MediaStreamEvent.js.map +0 -1
- package/lib/module/RTCEvent.js +0 -11
- package/lib/module/RTCEvent.js.map +0 -1
- package/lib/typescript/MediaStreamEvent.d.ts +0 -8
- package/lib/typescript/RTCEvent.d.ts +0 -4
- package/src/MediaStreamEvent.ts +0 -11
- package/src/RTCEvent.ts +0 -7
|
@@ -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];
|
|
@@ -75,7 +81,7 @@
|
|
|
75
81
|
VideoCaptureController *vcc = (VideoCaptureController *)videoTrack.captureController;
|
|
76
82
|
AVCaptureDeviceFormat *format = vcc.selectedFormat;
|
|
77
83
|
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
|
|
78
|
-
settings = @{@"height" : @(dimensions.height), @"width" : @(dimensions.width), @"frameRate" : @(
|
|
84
|
+
settings = @{@"height" : @(dimensions.height), @"width" : @(dimensions.width), @"frameRate" : @(30)};
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -83,7 +89,6 @@
|
|
|
83
89
|
@"enabled" : @(track.isEnabled),
|
|
84
90
|
@"id" : trackId,
|
|
85
91
|
@"kind" : track.kind,
|
|
86
|
-
@"label" : trackId,
|
|
87
92
|
@"readyState" : @"live",
|
|
88
93
|
@"remote" : @(NO),
|
|
89
94
|
@"settings" : settings
|
|
@@ -92,12 +97,16 @@
|
|
|
92
97
|
|
|
93
98
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
94
99
|
return @[ mediaStreamId, trackInfos ];
|
|
100
|
+
#endif
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
/**
|
|
98
104
|
* Initializes a new {@link RTCVideoTrack} which satisfies the given constraints.
|
|
99
105
|
*/
|
|
100
106
|
- (RTCVideoTrack *)createVideoTrack:(NSDictionary *)constraints {
|
|
107
|
+
#if TARGET_OS_TV
|
|
108
|
+
return nil;
|
|
109
|
+
#else
|
|
101
110
|
RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
|
|
102
111
|
|
|
103
112
|
NSString *trackUUID = [[NSUUID UUID] UUIDString];
|
|
@@ -112,10 +121,11 @@
|
|
|
112
121
|
#endif
|
|
113
122
|
|
|
114
123
|
return videoTrack;
|
|
124
|
+
#endif
|
|
115
125
|
}
|
|
116
126
|
|
|
117
127
|
- (RTCVideoTrack *)createScreenCaptureVideoTrack {
|
|
118
|
-
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX
|
|
128
|
+
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX || TARGET_OS_TV
|
|
119
129
|
return nil;
|
|
120
130
|
#endif
|
|
121
131
|
|
|
@@ -137,6 +147,11 @@
|
|
|
137
147
|
}
|
|
138
148
|
|
|
139
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
|
+
|
|
140
155
|
RTCVideoTrack *videoTrack = [self createScreenCaptureVideoTrack];
|
|
141
156
|
|
|
142
157
|
if (videoTrack == nil) {
|
|
@@ -155,13 +170,13 @@ RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
|
155
170
|
@"enabled" : @(videoTrack.isEnabled),
|
|
156
171
|
@"id" : videoTrack.trackId,
|
|
157
172
|
@"kind" : videoTrack.kind,
|
|
158
|
-
@"label" : videoTrack.trackId,
|
|
159
173
|
@"readyState" : @"live",
|
|
160
174
|
@"remote" : @(NO)
|
|
161
175
|
};
|
|
162
176
|
|
|
163
177
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
164
178
|
resolve(@{@"streamId" : mediaStreamId, @"track" : trackInfo});
|
|
179
|
+
#endif
|
|
165
180
|
}
|
|
166
181
|
|
|
167
182
|
/**
|
|
@@ -175,6 +190,10 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
175
190
|
: (NSDictionary *)constraints successCallback
|
|
176
191
|
: (RCTResponseSenderBlock)successCallback errorCallback
|
|
177
192
|
: (RCTResponseSenderBlock)errorCallback) {
|
|
193
|
+
#if TARGET_OS_TV
|
|
194
|
+
errorCallback(@[ @"PlatformNotSupported", @"getUserMedia is not supported on tvOS." ]);
|
|
195
|
+
return;
|
|
196
|
+
#else
|
|
178
197
|
RTCAudioTrack *audioTrack = nil;
|
|
179
198
|
RTCVideoTrack *videoTrack = nil;
|
|
180
199
|
|
|
@@ -218,14 +237,13 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
218
237
|
VideoCaptureController *vcc = (VideoCaptureController *)videoTrack.captureController;
|
|
219
238
|
AVCaptureDeviceFormat *format = vcc.selectedFormat;
|
|
220
239
|
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
|
|
221
|
-
settings = @{@"height" : @(dimensions.height), @"width" : @(dimensions.width), @"frameRate" : @(
|
|
240
|
+
settings = @{@"height" : @(dimensions.height), @"width" : @(dimensions.width), @"frameRate" : @(30)};
|
|
222
241
|
}
|
|
223
242
|
|
|
224
243
|
[tracks addObject:@{
|
|
225
244
|
@"enabled" : @(track.isEnabled),
|
|
226
245
|
@"id" : trackId,
|
|
227
246
|
@"kind" : track.kind,
|
|
228
|
-
@"label" : trackId,
|
|
229
247
|
@"readyState" : @"live",
|
|
230
248
|
@"remote" : @(NO),
|
|
231
249
|
@"settings" : settings
|
|
@@ -234,11 +252,15 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
234
252
|
|
|
235
253
|
self.localStreams[mediaStreamId] = mediaStream;
|
|
236
254
|
successCallback(@[ mediaStreamId, tracks ]);
|
|
255
|
+
#endif
|
|
237
256
|
}
|
|
238
257
|
|
|
239
258
|
#pragma mark - Other stream related APIs
|
|
240
259
|
|
|
241
260
|
RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
|
|
261
|
+
#if TARGET_OS_TV
|
|
262
|
+
callback(@[]);
|
|
263
|
+
#else
|
|
242
264
|
NSMutableArray *devices = [NSMutableArray array];
|
|
243
265
|
AVCaptureDeviceDiscoverySession *videoevicesSession =
|
|
244
266
|
[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
|
|
@@ -280,6 +302,7 @@ RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
|
|
|
280
302
|
}];
|
|
281
303
|
}
|
|
282
304
|
callback(@[ devices ]);
|
|
305
|
+
#endif
|
|
283
306
|
}
|
|
284
307
|
|
|
285
308
|
RCT_EXPORT_METHOD(mediaStreamCreate : (nonnull NSString *)streamID) {
|
|
@@ -337,12 +360,17 @@ RCT_EXPORT_METHOD(mediaStreamRelease : (nonnull NSString *)streamID) {
|
|
|
337
360
|
}
|
|
338
361
|
|
|
339
362
|
RCT_EXPORT_METHOD(mediaStreamTrackRelease : (nonnull NSString *)trackID) {
|
|
363
|
+
#if TARGET_OS_TV
|
|
364
|
+
return;
|
|
365
|
+
#else
|
|
366
|
+
|
|
340
367
|
RTCMediaStreamTrack *track = self.localTracks[trackID];
|
|
341
368
|
if (track) {
|
|
342
369
|
track.isEnabled = NO;
|
|
343
370
|
[track.captureController stopCapture];
|
|
344
371
|
[self.localTracks removeObjectForKey:trackID];
|
|
345
372
|
}
|
|
373
|
+
#endif
|
|
346
374
|
}
|
|
347
375
|
|
|
348
376
|
RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnull NSString *)trackID : (BOOL)enabled) {
|
|
@@ -352,6 +380,7 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
|
|
|
352
380
|
}
|
|
353
381
|
|
|
354
382
|
track.isEnabled = enabled;
|
|
383
|
+
#if !TARGET_OS_TV
|
|
355
384
|
if (track.captureController) { // It could be a remote track!
|
|
356
385
|
if (enabled) {
|
|
357
386
|
[track.captureController startCapture];
|
|
@@ -359,14 +388,19 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
|
|
|
359
388
|
[track.captureController stopCapture];
|
|
360
389
|
}
|
|
361
390
|
}
|
|
391
|
+
#endif
|
|
362
392
|
}
|
|
363
393
|
|
|
364
394
|
RCT_EXPORT_METHOD(mediaStreamTrackSwitchCamera : (nonnull NSString *)trackID) {
|
|
395
|
+
#if TARGET_OS_TV
|
|
396
|
+
return;
|
|
397
|
+
#else
|
|
365
398
|
RTCMediaStreamTrack *track = self.localTracks[trackID];
|
|
366
399
|
if (track) {
|
|
367
400
|
RTCVideoTrack *videoTrack = (RTCVideoTrack *)track;
|
|
368
401
|
[(VideoCaptureController *)videoTrack.captureController switchCamera];
|
|
369
402
|
}
|
|
403
|
+
#endif
|
|
370
404
|
}
|
|
371
405
|
|
|
372
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
|
|
@@ -120,18 +126,31 @@ RCT_EXPORT_METHOD(peerConnectionCreateOffer
|
|
|
120
126
|
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:options
|
|
121
127
|
optionalConstraints:nil];
|
|
122
128
|
|
|
129
|
+
NSMutableArray *receiversIds = [NSMutableArray new];
|
|
130
|
+
for (RTCRtpTransceiver *transceiver in peerConnection.transceivers) {
|
|
131
|
+
[receiversIds addObject:transceiver.receiver.receiverId];
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
RTCCreateSessionDescriptionCompletionHandler handler = ^(RTCSessionDescription *desc, NSError *error) {
|
|
124
135
|
dispatch_async(self.workerQueue, ^{
|
|
125
136
|
if (error) {
|
|
126
137
|
reject(@"E_OPERATION_ERROR", error.localizedDescription, nil);
|
|
127
138
|
} else {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
NSMutableArray *newTransceivers = [NSMutableArray new];
|
|
140
|
+
for (RTCRtpTransceiver *transceiver in peerConnection.transceivers) {
|
|
141
|
+
if (![receiversIds containsObject:transceiver.receiver.receiverId]) {
|
|
142
|
+
NSMutableDictionary *newTransceiver = [NSMutableDictionary new];
|
|
143
|
+
newTransceiver[@"transceiverOrder"] = [NSNumber numberWithInt:_transceiverNextId++];
|
|
144
|
+
newTransceiver[@"transceiver"] =
|
|
145
|
+
[SerializeUtils transceiverToJSONWithPeerConnectionId:objectID transceiver:transceiver];
|
|
146
|
+
[newTransceivers addObject:newTransceiver];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
131
149
|
id data = @{
|
|
132
|
-
@"sdpInfo" :
|
|
150
|
+
@"sdpInfo" : @{@"type" : [RTCSessionDescription stringForType:desc.type], @"sdp" : desc.sdp},
|
|
133
151
|
@"transceiversInfo" :
|
|
134
|
-
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection]
|
|
152
|
+
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection],
|
|
153
|
+
@"newTransceivers" : newTransceivers
|
|
135
154
|
};
|
|
136
155
|
resolve(data);
|
|
137
156
|
}
|
|
@@ -160,11 +179,8 @@ RCT_EXPORT_METHOD(peerConnectionCreateAnswer
|
|
|
160
179
|
if (error) {
|
|
161
180
|
reject(@"E_OPERATION_ERROR", error.localizedDescription, nil);
|
|
162
181
|
} else {
|
|
163
|
-
NSMutableDictionary *sdpInfo = [NSMutableDictionary new];
|
|
164
|
-
sdpInfo[@"type"] = [RTCSessionDescription stringForType:desc.type];
|
|
165
|
-
sdpInfo[@"sdp"] = desc.sdp;
|
|
166
182
|
id data = @{
|
|
167
|
-
@"sdpInfo" :
|
|
183
|
+
@"sdpInfo" : @{@"type" : [RTCSessionDescription stringForType:desc.type], @"sdp" : desc.sdp},
|
|
168
184
|
@"transceiversInfo" :
|
|
169
185
|
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection]
|
|
170
186
|
};
|
|
@@ -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
|
|
|
@@ -6,58 +6,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addListener = addListener;
|
|
7
7
|
exports.removeListener = removeListener;
|
|
8
8
|
exports.setupNativeEvents = setupNativeEvents;
|
|
9
|
-
|
|
10
9
|
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
10
|
var _EventEmitter = _interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
12
|
// @ts-ignore
|
|
13
|
+
|
|
17
14
|
const {
|
|
18
15
|
WebRTCModule
|
|
19
|
-
} = _reactNative.NativeModules;
|
|
20
|
-
// re-emit them on a JS-only emitter.
|
|
16
|
+
} = _reactNative.NativeModules;
|
|
21
17
|
|
|
18
|
+
// This emitter is going to be used to listen to all the native events (once) and then
|
|
19
|
+
// re-emit them on a JS-only emitter.
|
|
22
20
|
const nativeEmitter = new _reactNative.NativeEventEmitter(WebRTCModule);
|
|
23
21
|
const NATIVE_EVENTS = ['peerConnectionSignalingStateChanged', 'peerConnectionStateChanged', 'peerConnectionOnRenegotiationNeeded', 'peerConnectionIceConnectionChanged', 'peerConnectionIceGatheringChanged', 'peerConnectionGotICECandidate', 'peerConnectionDidOpenDataChannel', 'peerConnectionOnRemoveTrack', 'peerConnectionOnTrack', 'dataChannelStateChanged', 'dataChannelReceiveMessage', 'dataChannelDidChangeBufferedAmount', 'mediaStreamTrackMuteChanged', 'mediaStreamTrackEnded'];
|
|
24
22
|
const eventEmitter = new _EventEmitter.default();
|
|
25
|
-
|
|
26
23
|
function setupNativeEvents() {
|
|
27
24
|
for (const eventName of NATIVE_EVENTS) {
|
|
28
25
|
nativeEmitter.addListener(eventName, function () {
|
|
29
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
27
|
args[_key] = arguments[_key];
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
eventEmitter.emit(eventName, ...args);
|
|
34
30
|
});
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
const _subscriptions = new Map();
|
|
39
|
-
|
|
40
34
|
function addListener(listener, eventName, eventHandler) {
|
|
41
35
|
var _subscriptions$get;
|
|
42
|
-
|
|
43
36
|
if (!NATIVE_EVENTS.includes(eventName)) {
|
|
44
37
|
throw new Error(`Invalid event: ${eventName}`);
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
if (!_subscriptions.has(listener)) {
|
|
48
40
|
_subscriptions.set(listener, []);
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
(_subscriptions$get = _subscriptions.get(listener)) === null || _subscriptions$get === void 0 ? void 0 : _subscriptions$get.push(eventEmitter.addListener(eventName, eventHandler));
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
function removeListener(listener) {
|
|
55
45
|
var _subscriptions$get2;
|
|
56
|
-
|
|
57
46
|
(_subscriptions$get2 = _subscriptions.get(listener)) === null || _subscriptions$get2 === void 0 ? void 0 : _subscriptions$get2.forEach(sub => {
|
|
58
47
|
sub.remove();
|
|
59
48
|
});
|
|
60
|
-
|
|
61
49
|
_subscriptions.delete(listener);
|
|
62
50
|
}
|
|
63
51
|
//# sourceMappingURL=EventEmitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_EventEmitter","_interopRequireDefault","obj","__esModule","default","WebRTCModule","NativeModules","nativeEmitter","NativeEventEmitter","NATIVE_EVENTS","eventEmitter","EventEmitter","setupNativeEvents","eventName","addListener","_len","arguments","length","args","Array","_key","emit","_subscriptions","Map","listener","eventHandler","_subscriptions$get","includes","Error","has","set","get","push","removeListener","_subscriptions$get2","forEach","sub","remove","delete"],"sourceRoot":"../../src","sources":["EventEmitter.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8E,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAD9E;;AAGA,MAAM;EAAEG;AAAa,CAAC,GAAGC,0BAAa;;AAEtC;AACA;AACA,MAAMC,aAAa,GAAG,IAAIC,+BAAkB,CAACH,YAAY,CAAC;AAE1D,MAAMI,aAAa,GAAG,CAClB,qCAAqC,EACrC,4BAA4B,EAC5B,qCAAqC,EACrC,oCAAoC,EACpC,mCAAmC,EACnC,+BAA+B,EAC/B,kCAAkC,EAClC,6BAA6B,EAC7B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,uBAAuB,CAC1B;AAED,MAAMC,YAAY,GAAG,IAAIC,qBAAY,CAAC,CAAC;AAEhC,SAASC,iBAAiBA,CAAA,EAAG;EAChC,KAAK,MAAMC,SAAS,IAAIJ,aAAa,EAAE;IACnCF,aAAa,CAACO,WAAW,CAACD,SAAS,EAAE,YAAa;MAAA,SAAAE,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAATC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;QAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;MAAA;MACzCV,YAAY,CAACW,IAAI,CAACR,SAAS,EAAE,GAAGK,IAAI,CAAC;IACzC,CAAC,CAAC;EACN;AACJ;AAKA,MAAMI,cAAoD,GAAG,IAAIC,GAAG,CAAC,CAAC;AAE/D,SAAST,WAAWA,CAACU,QAAkB,EAAEX,SAAiB,EAAEY,YAA0B,EAAQ;EAAA,IAAAC,kBAAA;EACjG,IAAI,CAACjB,aAAa,CAACkB,QAAQ,CAACd,SAAS,CAAC,EAAE;IACpC,MAAM,IAAIe,KAAK,CAAE,kBAAiBf,SAAU,EAAC,CAAC;EAClD;EAEA,IAAI,CAACS,cAAc,CAACO,GAAG,CAACL,QAAQ,CAAC,EAAE;IAC/BF,cAAc,CAACQ,GAAG,CAACN,QAAQ,EAAE,EAAE,CAAC;EACpC;EAEA,CAAAE,kBAAA,GAAAJ,cAAc,CAACS,GAAG,CAACP,QAAQ,CAAC,cAAAE,kBAAA,uBAA5BA,kBAAA,CAA8BM,IAAI,CAACtB,YAAY,CAACI,WAAW,CAACD,SAAS,EAAEY,YAAY,CAAC,CAAC;AACzF;AAEO,SAASQ,cAAcA,CAACT,QAAkB,EAAQ;EAAA,IAAAU,mBAAA;EACrD,CAAAA,mBAAA,GAAAZ,cAAc,CAACS,GAAG,CAACP,QAAQ,CAAC,cAAAU,mBAAA,uBAA5BA,mBAAA,CAA8BC,OAAO,CAACC,GAAG,IAAI;IACzCA,GAAG,CAACC,MAAM,CAAC,CAAC;EAChB,CAAC,CAAC;EAEFf,cAAc,CAACgB,MAAM,CAACd,QAAQ,CAAC;AACnC"}
|
package/lib/commonjs/Logger.js
CHANGED
|
@@ -4,27 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
|
|
14
9
|
class Logger {
|
|
10
|
+
static ROOT_PREFIX = 'rn-webrtc';
|
|
15
11
|
static enable(ns) {
|
|
16
12
|
_debug.default.enable(ns);
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
constructor(prefix) {
|
|
20
|
-
_defineProperty(this, "_debug", void 0);
|
|
21
|
-
|
|
22
|
-
_defineProperty(this, "_info", void 0);
|
|
23
|
-
|
|
24
|
-
_defineProperty(this, "_warn", void 0);
|
|
25
|
-
|
|
26
|
-
_defineProperty(this, "_error", void 0);
|
|
27
|
-
|
|
28
15
|
const _prefix = `${Logger.ROOT_PREFIX}:${prefix}`;
|
|
29
16
|
this._debug = (0, _debug.default)(`${_prefix}:DEBUG`);
|
|
30
17
|
this._info = (0, _debug.default)(`${_prefix}:INFO`);
|
|
@@ -36,30 +23,19 @@ class Logger {
|
|
|
36
23
|
this._warn.log = log;
|
|
37
24
|
this._error.log = log;
|
|
38
25
|
}
|
|
39
|
-
|
|
40
26
|
debug(msg) {
|
|
41
27
|
this._debug(msg);
|
|
42
28
|
}
|
|
43
|
-
|
|
44
29
|
info(msg) {
|
|
45
30
|
this._info(msg);
|
|
46
31
|
}
|
|
47
|
-
|
|
48
32
|
warn(msg) {
|
|
49
33
|
this._warn(msg);
|
|
50
34
|
}
|
|
51
|
-
|
|
52
35
|
error(msg, err) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const trace = (_err$stack = err === null || err === void 0 ? void 0 : err.stack) !== null && _err$stack !== void 0 ? _err$stack : 'N/A';
|
|
56
|
-
|
|
36
|
+
const trace = (err === null || err === void 0 ? void 0 : err.stack) ?? 'N/A';
|
|
57
37
|
this._error(`${msg} Trace: ${trace}`);
|
|
58
38
|
}
|
|
59
|
-
|
|
60
39
|
}
|
|
61
|
-
|
|
62
40
|
exports.default = Logger;
|
|
63
|
-
|
|
64
|
-
_defineProperty(Logger, "ROOT_PREFIX", 'rn-webrtc');
|
|
65
41
|
//# sourceMappingURL=Logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_debug","_interopRequireDefault","require","obj","__esModule","default","Logger","ROOT_PREFIX","enable","ns","debug","constructor","prefix","_prefix","_info","_warn","_error","log","console","bind","msg","info","warn","error","err","trace","stack","exports"],"sourceRoot":"../../src","sources":["Logger.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGX,MAAMG,MAAM,CAAC;EACxB,OAAOC,WAAW,GAAG,WAAW;EAOhC,OAAOC,MAAMA,CAACC,EAAU,EAAQ;IAC5BC,cAAK,CAACF,MAAM,CAACC,EAAE,CAAC;EACpB;EAEAE,WAAWA,CAACC,MAAc,EAAE;IACxB,MAAMC,OAAO,GAAI,GAAEP,MAAM,CAACC,WAAY,IAAGK,MAAO,EAAC;IAEjD,IAAI,CAACZ,MAAM,GAAG,IAAAU,cAAK,EAAE,GAAEG,OAAQ,QAAO,CAAC;IACvC,IAAI,CAACC,KAAK,GAAG,IAAAJ,cAAK,EAAE,GAAEG,OAAQ,OAAM,CAAC;IACrC,IAAI,CAACE,KAAK,GAAG,IAAAL,cAAK,EAAE,GAAEG,OAAQ,OAAM,CAAC;IACrC,IAAI,CAACG,MAAM,GAAG,IAAAN,cAAK,EAAE,GAAEG,OAAQ,QAAO,CAAC;IAEvC,MAAMI,GAAG,GAAGC,OAAO,CAACD,GAAG,CAACE,IAAI,CAACD,OAAO,CAAC;IAErC,IAAI,CAAClB,MAAM,CAACiB,GAAG,GAAGA,GAAG;IACrB,IAAI,CAACH,KAAK,CAACG,GAAG,GAAGA,GAAG;IACpB,IAAI,CAACF,KAAK,CAACE,GAAG,GAAGA,GAAG;IACpB,IAAI,CAACD,MAAM,CAACC,GAAG,GAAGA,GAAG;EACzB;EAEAP,KAAKA,CAACU,GAAW,EAAQ;IACrB,IAAI,CAACpB,MAAM,CAACoB,GAAG,CAAC;EACpB;EAEAC,IAAIA,CAACD,GAAW,EAAQ;IACpB,IAAI,CAACN,KAAK,CAACM,GAAG,CAAC;EACnB;EAEAE,IAAIA,CAACF,GAAW,EAAQ;IACpB,IAAI,CAACL,KAAK,CAACK,GAAG,CAAC;EACnB;EAEAG,KAAKA,CAACH,GAAW,EAAEI,GAAW,EAAQ;IAClC,MAAMC,KAAK,GAAG,CAAAD,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEE,KAAK,KAAI,KAAK;IAEjC,IAAI,CAACV,MAAM,CAAE,GAAEI,GAAI,WAAUK,KAAM,EAAC,CAAC;EACzC;AACJ;AAACE,OAAA,CAAAtB,OAAA,GAAAC,MAAA"}
|
|
@@ -4,23 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _eventTargetShim = require("event-target-shim");
|
|
9
|
-
|
|
10
8
|
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
9
|
var _getDisplayMedia = _interopRequireDefault(require("./getDisplayMedia"));
|
|
13
|
-
|
|
14
10
|
var _getUserMedia = _interopRequireDefault(require("./getUserMedia"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
const {
|
|
19
13
|
WebRTCModule
|
|
20
14
|
} = _reactNative.NativeModules;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDIA_DEVICES_EVENTS) {
|
|
15
|
+
class MediaDevices extends _eventTargetShim.EventTarget {
|
|
24
16
|
/**
|
|
25
17
|
* W3C "Media Capture and Streams" compatible {@code enumerateDevices}
|
|
26
18
|
* implementation.
|
|
@@ -28,17 +20,17 @@ class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDI
|
|
|
28
20
|
enumerateDevices() {
|
|
29
21
|
return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));
|
|
30
22
|
}
|
|
23
|
+
|
|
31
24
|
/**
|
|
32
25
|
* W3C "Screen Capture" compatible {@code getDisplayMedia} implementation.
|
|
33
26
|
* See: https://w3c.github.io/mediacapture-screen-share/
|
|
34
27
|
*
|
|
35
28
|
* @returns {Promise}
|
|
36
29
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
30
|
getDisplayMedia() {
|
|
40
31
|
return (0, _getDisplayMedia.default)();
|
|
41
32
|
}
|
|
33
|
+
|
|
42
34
|
/**
|
|
43
35
|
* W3C "Media Capture and Streams" compatible {@code getUserMedia}
|
|
44
36
|
* implementation.
|
|
@@ -47,15 +39,16 @@ class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDI
|
|
|
47
39
|
* @param {*} constraints
|
|
48
40
|
* @returns {Promise}
|
|
49
41
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
42
|
getUserMedia(constraints) {
|
|
53
43
|
return (0, _getUserMedia.default)(constraints);
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
}
|
|
57
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Define the `onxxx` event handlers.
|
|
49
|
+
*/
|
|
50
|
+
const proto = MediaDevices.prototype;
|
|
51
|
+
(0, _eventTargetShim.defineEventAttribute)(proto, 'devicechange');
|
|
58
52
|
var _default = new MediaDevices();
|
|
59
|
-
|
|
60
53
|
exports.default = _default;
|
|
61
54
|
//# sourceMappingURL=MediaDevices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_eventTargetShim","require","_reactNative","_getDisplayMedia","_interopRequireDefault","_getUserMedia","obj","__esModule","default","WebRTCModule","NativeModules","MediaDevices","EventTarget","enumerateDevices","Promise","resolve","getDisplayMedia","getUserMedia","constraints","proto","prototype","defineEventAttribute","_default","exports"],"sourceRoot":"../../src","sources":["MediaDevices.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA0C,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE1C,MAAM;EAAEG;AAAa,CAAC,GAAGC,0BAAa;AAMtC,MAAMC,YAAY,SAASC,4BAAW,CAAuB;EACzD;AACJ;AACA;AACA;EACIC,gBAAgBA,CAAA,EAAG;IACf,OAAO,IAAIC,OAAO,CAACC,OAAO,IAAIN,YAAY,CAACI,gBAAgB,CAACE,OAAO,CAAC,CAAC;EACzE;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACIC,eAAeA,CAAA,EAAG;IACd,OAAO,IAAAA,wBAAe,EAAC,CAAC;EAC5B;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,YAAYA,CAACC,WAAW,EAAE;IACtB,OAAO,IAAAD,qBAAY,EAACC,WAAW,CAAC;EACpC;AACJ;;AAEA;AACA;AACA;AACA,MAAMC,KAAK,GAAGR,YAAY,CAACS,SAAS;AAEpC,IAAAC,qCAAoB,EAACF,KAAK,EAAE,cAAc,CAAC;AAAC,IAAAG,QAAA,GAG7B,IAAIX,YAAY,CAAC,CAAC;AAAAY,OAAA,CAAAf,OAAA,GAAAc,QAAA"}
|