react-native-webrtc 111.0.1 → 111.0.3
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/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/WebRTCModule.java +27 -5
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +21 -21
- package/ios/RCTWebRTC/SerializeUtils.m +12 -10
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +0 -3
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +19 -9
- 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 +2 -14
- package/lib/commonjs/MediaDevices.js.map +1 -1
- package/lib/commonjs/MediaStream.js +15 -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/MediaStreamEvent.js +0 -9
- package/lib/commonjs/MediaStreamEvent.js.map +1 -1
- package/lib/commonjs/MediaStreamTrack.js +6 -65
- package/lib/commonjs/MediaStreamTrack.js.map +1 -1
- package/lib/commonjs/MediaStreamTrackEvent.js +0 -9
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
- package/lib/commonjs/MessageEvent.js +0 -9
- 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 +8 -71
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCDataChannelEvent.js +0 -9
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +0 -12
- package/lib/commonjs/RTCErrorEvent.js.map +1 -1
- package/lib/commonjs/RTCEvent.js +0 -7
- package/lib/commonjs/RTCEvent.js.map +1 -1
- package/lib/commonjs/RTCIceCandidate.js +0 -14
- package/lib/commonjs/RTCIceCandidate.js.map +1 -1
- package/lib/commonjs/RTCIceCandidateEvent.js +1 -12
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +116 -221
- 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 +1 -15
- 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 +2 -7
- package/lib/module/MediaDevices.js.map +1 -1
- package/lib/module/MediaStream.js +15 -36
- 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/MediaStreamEvent.js +0 -7
- package/lib/module/MediaStreamEvent.js.map +1 -1
- package/lib/module/MediaStreamTrack.js +6 -58
- package/lib/module/MediaStreamTrack.js.map +1 -1
- package/lib/module/MediaStreamTrackEvent.js +0 -7
- package/lib/module/MediaStreamTrackEvent.js.map +1 -1
- package/lib/module/MessageEvent.js +0 -7
- 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 +8 -59
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCDataChannelEvent.js +0 -7
- package/lib/module/RTCDataChannelEvent.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +0 -9
- package/lib/module/RTCErrorEvent.js.map +1 -1
- package/lib/module/RTCEvent.js +0 -5
- package/lib/module/RTCEvent.js.map +1 -1
- package/lib/module/RTCIceCandidate.js +0 -12
- package/lib/module/RTCIceCandidate.js.map +1 -1
- package/lib/module/RTCIceCandidateEvent.js +1 -10
- package/lib/module/RTCIceCandidateEvent.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +116 -195
- 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 +1 -13
- 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 +1 -0
- package/lib/typescript/MediaDevices.d.ts.map +1 -0
- package/lib/typescript/MediaStream.d.ts +4 -2
- 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/MediaStreamEvent.d.ts +1 -0
- package/lib/typescript/MediaStreamEvent.d.ts.map +1 -0
- package/lib/typescript/MediaStreamTrack.d.ts +2 -1
- package/lib/typescript/MediaStreamTrack.d.ts.map +1 -0
- package/lib/typescript/MediaStreamTrackEvent.d.ts +1 -0
- package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -0
- package/lib/typescript/MessageEvent.d.ts +2 -1
- 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 +2 -1
- package/lib/typescript/RTCDataChannel.d.ts.map +1 -0
- package/lib/typescript/RTCDataChannelEvent.d.ts +1 -0
- package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -0
- package/lib/typescript/RTCErrorEvent.d.ts +2 -1
- package/lib/typescript/RTCErrorEvent.d.ts.map +1 -0
- package/lib/typescript/RTCEvent.d.ts +1 -0
- package/lib/typescript/RTCEvent.d.ts.map +1 -0
- package/lib/typescript/RTCIceCandidate.d.ts +1 -0
- package/lib/typescript/RTCIceCandidate.d.ts.map +1 -0
- package/lib/typescript/RTCIceCandidateEvent.d.ts +1 -0
- package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -0
- package/lib/typescript/RTCPeerConnection.d.ts +6 -5
- 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 +1 -0
- 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 +2 -4
- package/src/MediaStream.ts +17 -7
- package/src/RTCPeerConnection.ts +20 -1
- package/src/RTCRtpTransceiver.ts +2 -2
- package/src/index.ts +1 -2
|
@@ -321,7 +321,6 @@ class GetUserMediaImpl {
|
|
|
321
321
|
trackInfo.putBoolean("enabled", track.enabled());
|
|
322
322
|
trackInfo.putString("id", trackId);
|
|
323
323
|
trackInfo.putString("kind", track.kind());
|
|
324
|
-
trackInfo.putString("label", trackId);
|
|
325
324
|
trackInfo.putString("readyState", track.state().toString().toLowerCase());
|
|
326
325
|
trackInfo.putBoolean("remote", false);
|
|
327
326
|
|
|
@@ -21,30 +21,35 @@ public class ScreenCaptureController extends AbstractVideoCaptureController {
|
|
|
21
21
|
|
|
22
22
|
private final Intent mediaProjectionPermissionResultData;
|
|
23
23
|
|
|
24
|
-
private final OrientationEventListener
|
|
24
|
+
private final OrientationEventListener orientationListener;
|
|
25
25
|
|
|
26
26
|
public ScreenCaptureController(Context context, int width, int height, Intent mediaProjectionPermissionResultData) {
|
|
27
27
|
super(width, height, DEFAULT_FPS);
|
|
28
28
|
|
|
29
29
|
this.mediaProjectionPermissionResultData = mediaProjectionPermissionResultData;
|
|
30
30
|
|
|
31
|
-
this.
|
|
31
|
+
this.orientationListener = new OrientationEventListener(context) {
|
|
32
32
|
@Override
|
|
33
33
|
public void onOrientationChanged(int orientation) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
DisplayMetrics displayMetrics = DisplayUtils.getDisplayMetrics((Activity) context);
|
|
35
|
+
final int width = displayMetrics.widthPixels;
|
|
36
|
+
final int height = displayMetrics.heightPixels;
|
|
37
|
+
|
|
38
|
+
// Pivot to the executor thread because videoCapturer.changeCaptureFormat runs in the main
|
|
39
|
+
// thread and may deadlock.
|
|
40
|
+
ThreadUtils.runOnExecutor(() -> {
|
|
41
|
+
try {
|
|
42
|
+
videoCapturer.changeCaptureFormat(width, height, DEFAULT_FPS);
|
|
43
|
+
} catch (Exception ex) {
|
|
44
|
+
// We ignore exceptions here. The video capturer runs on its own
|
|
45
|
+
// thread and we cannot synchronize with it.
|
|
46
|
+
}
|
|
47
|
+
});
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
|
|
46
|
-
if (this.
|
|
47
|
-
this.
|
|
51
|
+
if (this.orientationListener.canDetectOrientation()) {
|
|
52
|
+
this.orientationListener.enable();
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -55,7 +60,7 @@ public class ScreenCaptureController extends AbstractVideoCaptureController {
|
|
|
55
60
|
@Override
|
|
56
61
|
public void onStop() {
|
|
57
62
|
Log.w(TAG, "Media projection stopped.");
|
|
58
|
-
|
|
63
|
+
orientationListener.disable();
|
|
59
64
|
stopCapture();
|
|
60
65
|
|
|
61
66
|
if (capturerEventsListener != null) {
|
|
@@ -845,13 +845,16 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
845
845
|
WritableArray transceiverUpdates = Arguments.createArray();
|
|
846
846
|
|
|
847
847
|
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
848
|
-
RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
|
|
849
|
-
if (direction == null) continue;
|
|
850
|
-
String directionSerialized = SerializeUtils.serializeDirection(direction);
|
|
851
848
|
WritableMap transceiverUpdate = Arguments.createMap();
|
|
849
|
+
|
|
850
|
+
RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
|
|
851
|
+
if (direction != null) {
|
|
852
|
+
String directionSerialized = SerializeUtils.serializeDirection(direction);
|
|
853
|
+
transceiverUpdate.putString("currentDirection", directionSerialized);
|
|
854
|
+
}
|
|
855
|
+
|
|
852
856
|
transceiverUpdate.putString("transceiverId", transceiver.getSender().id());
|
|
853
857
|
transceiverUpdate.putString("mid", transceiver.getMid());
|
|
854
|
-
transceiverUpdate.putString("currentDirection", directionSerialized);
|
|
855
858
|
transceiverUpdate.putBoolean("isStopped", transceiver.isStopped());
|
|
856
859
|
transceiverUpdate.putMap("senderRtpParameters",
|
|
857
860
|
SerializeUtils.serializeRtpParameters(transceiver.getSender().getParameters()));
|
|
@@ -882,7 +885,8 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
882
885
|
@ReactMethod
|
|
883
886
|
public void peerConnectionCreateOffer(int id, ReadableMap options, Promise promise) {
|
|
884
887
|
ThreadUtils.runOnExecutor(() -> {
|
|
885
|
-
|
|
888
|
+
PeerConnectionObserver pco = mPeerConnectionObservers.get(id);
|
|
889
|
+
PeerConnection peerConnection = pco.getPeerConnection();
|
|
886
890
|
|
|
887
891
|
if (peerConnection == null) {
|
|
888
892
|
Log.d(TAG, "peerConnectionCreateOffer() peerConnection is null");
|
|
@@ -890,6 +894,11 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
890
894
|
return;
|
|
891
895
|
}
|
|
892
896
|
|
|
897
|
+
List<String> receiversIds = new ArrayList<>();
|
|
898
|
+
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
899
|
+
receiversIds.add(transceiver.getReceiver().id());
|
|
900
|
+
}
|
|
901
|
+
|
|
893
902
|
final SdpObserver observer = new SdpObserver() {
|
|
894
903
|
@Override
|
|
895
904
|
public void onCreateFailure(String s) {
|
|
@@ -908,6 +917,19 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
908
917
|
params.putArray("transceiversInfo", getTransceiversInfo(peerConnection));
|
|
909
918
|
params.putMap("sdpInfo", sdpInfo);
|
|
910
919
|
|
|
920
|
+
WritableArray newTransceivers = Arguments.createArray();
|
|
921
|
+
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
922
|
+
if (!receiversIds.contains(transceiver.getReceiver().id())) {
|
|
923
|
+
WritableMap newTransceiver = Arguments.createMap();
|
|
924
|
+
newTransceiver.putInt("transceiverOrder", pco.getNextTransceiverId());
|
|
925
|
+
newTransceiver.putMap(
|
|
926
|
+
"transceiver", SerializeUtils.serializeTransceiver(id, transceiver));
|
|
927
|
+
newTransceivers.pushMap(newTransceiver);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
params.putArray("newTransceivers", newTransceivers);
|
|
932
|
+
|
|
911
933
|
promise.resolve(params);
|
|
912
934
|
});
|
|
913
935
|
}
|
|
@@ -323,13 +323,15 @@ public class WebRTCView extends ViewGroup {
|
|
|
323
323
|
private void removeRendererFromVideoTrack() {
|
|
324
324
|
if (rendererAttached) {
|
|
325
325
|
if (videoTrack != null) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
ThreadUtils.runOnExecutor(() -> {
|
|
327
|
+
try {
|
|
328
|
+
videoTrack.removeSink(surfaceViewRenderer);
|
|
329
|
+
} catch (Throwable tr) {
|
|
330
|
+
// XXX If WebRTCModule#mediaStreamTrackRelease has already been
|
|
331
|
+
// invoked on videoTrack, then it is no longer safe to call removeSink
|
|
332
|
+
// on the instance, it will throw IllegalStateException.
|
|
333
|
+
}
|
|
334
|
+
});
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
surfaceViewRenderer.release();
|
|
@@ -518,27 +520,25 @@ public class WebRTCView extends ViewGroup {
|
|
|
518
520
|
}
|
|
519
521
|
|
|
520
522
|
try {
|
|
521
|
-
surfaceViewRendererInstances++;
|
|
522
523
|
surfaceViewRenderer.init(sharedContext, rendererEvents);
|
|
524
|
+
surfaceViewRendererInstances++;
|
|
523
525
|
} catch (Exception e) {
|
|
524
526
|
Logging.e(
|
|
525
527
|
TAG, "Failed to initialize surfaceViewRenderer on instance " + surfaceViewRendererInstances, e);
|
|
526
|
-
|
|
528
|
+
return;
|
|
527
529
|
}
|
|
528
530
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
Log.e(TAG, "Failed to add renderer", tr);
|
|
531
|
+
ThreadUtils.runOnExecutor(() -> {
|
|
532
|
+
try {
|
|
533
|
+
videoTrack.addSink(surfaceViewRenderer);
|
|
534
|
+
} catch (Throwable tr) {
|
|
535
|
+
// XXX If WebRTCModule#mediaStreamTrackRelease has already been
|
|
536
|
+
// invoked on videoTrack, then it is no longer safe to call addSink
|
|
537
|
+
// on the instance, it will throw IllegalStateException.
|
|
537
538
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
539
|
+
Log.e(TAG, "Failed to add renderer", tr);
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
542
|
|
|
543
543
|
rendererAttached = true;
|
|
544
544
|
}
|
|
@@ -26,20 +26,22 @@
|
|
|
26
26
|
NSMutableArray *transceiverUpdates = [NSMutableArray new];
|
|
27
27
|
|
|
28
28
|
for (RTCRtpTransceiver *transceiver in peerConnection.transceivers) {
|
|
29
|
+
NSMutableDictionary *transceiverUpdate = [NSMutableDictionary new];
|
|
30
|
+
|
|
29
31
|
RTCRtpTransceiverDirection currentDirection;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
transceiverUpdate[@"transceiverId"] = transceiver.sender.senderId;
|
|
33
|
-
transceiverUpdate[@"mid"] = transceiver.mid;
|
|
32
|
+
BOOL hasCurrentDirection = [transceiver currentDirection:¤tDirection];
|
|
33
|
+
if (hasCurrentDirection) {
|
|
34
34
|
NSString *currentDirectionSerialized = [SerializeUtils serializeDirection:currentDirection];
|
|
35
35
|
transceiverUpdate[@"currentDirection"] = currentDirectionSerialized;
|
|
36
|
-
transceiverUpdate[@"isStopped"] = [NSNumber numberWithBool:transceiver.isStopped];
|
|
37
|
-
transceiverUpdate[@"senderRtpParameters"] = [SerializeUtils parametersToJSON:transceiver.sender.parameters];
|
|
38
|
-
transceiverUpdate[@"receiverRtpParameters"] =
|
|
39
|
-
[SerializeUtils parametersToJSON:transceiver.receiver.parameters];
|
|
40
|
-
|
|
41
|
-
[transceiverUpdates addObject:transceiverUpdate];
|
|
42
36
|
}
|
|
37
|
+
|
|
38
|
+
transceiverUpdate[@"transceiverId"] = transceiver.sender.senderId;
|
|
39
|
+
transceiverUpdate[@"mid"] = transceiver.mid;
|
|
40
|
+
transceiverUpdate[@"isStopped"] = [NSNumber numberWithBool:transceiver.isStopped];
|
|
41
|
+
transceiverUpdate[@"senderRtpParameters"] = [SerializeUtils parametersToJSON:transceiver.sender.parameters];
|
|
42
|
+
transceiverUpdate[@"receiverRtpParameters"] = [SerializeUtils parametersToJSON:transceiver.receiver.parameters];
|
|
43
|
+
|
|
44
|
+
[transceiverUpdates addObject:transceiverUpdate];
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
return transceiverUpdates;
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
@"enabled" : @(track.isEnabled),
|
|
84
84
|
@"id" : trackId,
|
|
85
85
|
@"kind" : track.kind,
|
|
86
|
-
@"label" : trackId,
|
|
87
86
|
@"readyState" : @"live",
|
|
88
87
|
@"remote" : @(NO),
|
|
89
88
|
@"settings" : settings
|
|
@@ -155,7 +154,6 @@ RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
|
155
154
|
@"enabled" : @(videoTrack.isEnabled),
|
|
156
155
|
@"id" : videoTrack.trackId,
|
|
157
156
|
@"kind" : videoTrack.kind,
|
|
158
|
-
@"label" : videoTrack.trackId,
|
|
159
157
|
@"readyState" : @"live",
|
|
160
158
|
@"remote" : @(NO)
|
|
161
159
|
};
|
|
@@ -225,7 +223,6 @@ RCT_EXPORT_METHOD(getUserMedia
|
|
|
225
223
|
@"enabled" : @(track.isEnabled),
|
|
226
224
|
@"id" : trackId,
|
|
227
225
|
@"kind" : track.kind,
|
|
228
|
-
@"label" : trackId,
|
|
229
226
|
@"readyState" : @"live",
|
|
230
227
|
@"remote" : @(NO),
|
|
231
228
|
@"settings" : settings
|
|
@@ -120,18 +120,31 @@ RCT_EXPORT_METHOD(peerConnectionCreateOffer
|
|
|
120
120
|
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:options
|
|
121
121
|
optionalConstraints:nil];
|
|
122
122
|
|
|
123
|
+
NSMutableArray *receiversIds = [NSMutableArray new];
|
|
124
|
+
for (RTCRtpTransceiver *transceiver in peerConnection.transceivers) {
|
|
125
|
+
[receiversIds addObject:transceiver.receiver.receiverId];
|
|
126
|
+
}
|
|
127
|
+
|
|
123
128
|
RTCCreateSessionDescriptionCompletionHandler handler = ^(RTCSessionDescription *desc, NSError *error) {
|
|
124
129
|
dispatch_async(self.workerQueue, ^{
|
|
125
130
|
if (error) {
|
|
126
131
|
reject(@"E_OPERATION_ERROR", error.localizedDescription, nil);
|
|
127
132
|
} else {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
NSMutableArray *newTransceivers = [NSMutableArray new];
|
|
134
|
+
for (RTCRtpTransceiver *transceiver in peerConnection.transceivers) {
|
|
135
|
+
if (![receiversIds containsObject:transceiver.receiver.receiverId]) {
|
|
136
|
+
NSMutableDictionary *newTransceiver = [NSMutableDictionary new];
|
|
137
|
+
newTransceiver[@"transceiverOrder"] = [NSNumber numberWithInt:_transceiverNextId++];
|
|
138
|
+
newTransceiver[@"transceiver"] =
|
|
139
|
+
[SerializeUtils transceiverToJSONWithPeerConnectionId:objectID transceiver:transceiver];
|
|
140
|
+
[newTransceivers addObject:newTransceiver];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
131
143
|
id data = @{
|
|
132
|
-
@"sdpInfo" :
|
|
144
|
+
@"sdpInfo" : @{@"type" : [RTCSessionDescription stringForType:desc.type], @"sdp" : desc.sdp},
|
|
133
145
|
@"transceiversInfo" :
|
|
134
|
-
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection]
|
|
146
|
+
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection],
|
|
147
|
+
@"newTransceivers" : newTransceivers
|
|
135
148
|
};
|
|
136
149
|
resolve(data);
|
|
137
150
|
}
|
|
@@ -160,11 +173,8 @@ RCT_EXPORT_METHOD(peerConnectionCreateAnswer
|
|
|
160
173
|
if (error) {
|
|
161
174
|
reject(@"E_OPERATION_ERROR", error.localizedDescription, nil);
|
|
162
175
|
} else {
|
|
163
|
-
NSMutableDictionary *sdpInfo = [NSMutableDictionary new];
|
|
164
|
-
sdpInfo[@"type"] = [RTCSessionDescription stringForType:desc.type];
|
|
165
|
-
sdpInfo[@"sdp"] = desc.sdp;
|
|
166
176
|
id data = @{
|
|
167
|
-
@"sdpInfo" :
|
|
177
|
+
@"sdpInfo" : @{@"type" : [RTCSessionDescription stringForType:desc.type], @"sdp" : desc.sdp},
|
|
168
178
|
@"transceiversInfo" :
|
|
169
179
|
[SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection]
|
|
170
180
|
};
|
|
@@ -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,22 +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
15
|
const MEDIA_DEVICES_EVENTS = ['devicechange'];
|
|
22
|
-
|
|
23
16
|
class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDIA_DEVICES_EVENTS) {
|
|
24
17
|
/**
|
|
25
18
|
* W3C "Media Capture and Streams" compatible {@code enumerateDevices}
|
|
@@ -28,17 +21,17 @@ class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDI
|
|
|
28
21
|
enumerateDevices() {
|
|
29
22
|
return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));
|
|
30
23
|
}
|
|
24
|
+
|
|
31
25
|
/**
|
|
32
26
|
* W3C "Screen Capture" compatible {@code getDisplayMedia} implementation.
|
|
33
27
|
* See: https://w3c.github.io/mediacapture-screen-share/
|
|
34
28
|
*
|
|
35
29
|
* @returns {Promise}
|
|
36
30
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
31
|
getDisplayMedia() {
|
|
40
32
|
return (0, _getDisplayMedia.default)();
|
|
41
33
|
}
|
|
34
|
+
|
|
42
35
|
/**
|
|
43
36
|
* W3C "Media Capture and Streams" compatible {@code getUserMedia}
|
|
44
37
|
* implementation.
|
|
@@ -47,15 +40,10 @@ class MediaDevices extends (0, _eventTargetShim.defineCustomEventTarget)(...MEDI
|
|
|
47
40
|
* @param {*} constraints
|
|
48
41
|
* @returns {Promise}
|
|
49
42
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
43
|
getUserMedia(constraints) {
|
|
53
44
|
return (0, _getUserMedia.default)(constraints);
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
var _default = new MediaDevices();
|
|
59
|
-
|
|
60
48
|
exports.default = _default;
|
|
61
49
|
//# sourceMappingURL=MediaDevices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_eventTargetShim","require","_reactNative","_getDisplayMedia","_interopRequireDefault","_getUserMedia","obj","__esModule","default","WebRTCModule","NativeModules","MEDIA_DEVICES_EVENTS","MediaDevices","defineCustomEventTarget","enumerateDevices","Promise","resolve","getDisplayMedia","getUserMedia","constraints","_default","exports"],"sourceRoot":"../../src","sources":["MediaDevices.ts"],"mappings":";;;;;;AACA,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;AAEtC,MAAMC,oBAAoB,GAAG,CAAE,cAAc,CAAE;AAE/C,MAAMC,YAAY,SAAS,IAAAC,wCAAuB,EAAC,GAAGF,oBAAoB,CAAC,CAAC;EACxE;AACJ;AACA;AACA;EACIG,gBAAgBA,CAAA,EAAG;IACf,OAAO,IAAIC,OAAO,CAACC,OAAO,IAAIP,YAAY,CAACK,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;AAAC,IAAAC,QAAA,GAEc,IAAIR,YAAY,CAAC,CAAC;AAAAS,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
|