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
|
@@ -2,8 +2,12 @@ name: Android CI
|
|
|
2
2
|
on:
|
|
3
3
|
push:
|
|
4
4
|
branches: [ master ]
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- '**.md'
|
|
5
7
|
pull_request:
|
|
6
8
|
branches: [ master ]
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- '**.md'
|
|
7
11
|
|
|
8
12
|
jobs:
|
|
9
13
|
android-compile:
|
|
@@ -26,4 +30,4 @@ jobs:
|
|
|
26
30
|
|
|
27
31
|
- name: Compile Android Example
|
|
28
32
|
run: ./gradlew assembleDebug
|
|
29
|
-
working-directory: ./examples/GumTestApp/android
|
|
33
|
+
working-directory: ./examples/GumTestApp/android
|
package/ISSUE_TEMPLATE.md
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
If you have
|
|
3
|
-
|
|
2
|
+
If you have any questions then please use our Community Discourse: https://react-native-webrtc.discourse.group/
|
|
3
|
+
Otherwise you are in the right place for reporting bugs.
|
|
4
4
|
|
|
5
5
|
Please include as much information as possible and make the issue title as descriptive as you can.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#### Expected Behavior
|
|
9
|
-
|
|
6
|
+
But most of all please take your time and explain to the best of your abilities.
|
|
10
7
|
|
|
8
|
+
Code samples can be very helpful but even more so if displayed correctly.
|
|
9
|
+
Here is an example of how you can use syntax highlighting.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
```javascript
|
|
13
12
|
|
|
13
|
+
console.log( 'Hello World' );
|
|
14
14
|
|
|
15
|
+
```
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
More info can be found over here.
|
|
18
|
+
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting
|
|
19
|
+
-->
|
|
17
20
|
|
|
21
|
+
#### Expected Behavior:
|
|
22
|
+
<!--
|
|
23
|
+
Explain what you expect to happen.
|
|
24
|
+
-->
|
|
18
25
|
|
|
26
|
+
#### Observed Behavior:
|
|
27
|
+
<!--
|
|
28
|
+
Explain what is actually happening.
|
|
29
|
+
-->
|
|
19
30
|
|
|
20
|
-
####
|
|
31
|
+
#### Steps to reproduce the issue:
|
|
32
|
+
<!--
|
|
33
|
+
Explain how the issue can be reproduced.
|
|
34
|
+
If we manage to reproduce the issue then it is more likely to be addressed in an update.
|
|
35
|
+
-->
|
|
21
36
|
|
|
37
|
+
#### Platform Information
|
|
22
38
|
* **React Native Version**:
|
|
23
|
-
* **
|
|
24
|
-
* **OS**: <!-- Android / iOS / macOS / Web / Expo -->
|
|
25
|
-
* **OS Version**:
|
|
39
|
+
* **WebRTC Module Version**:
|
|
40
|
+
* **Platform OS + Version**: <!-- Android / iOS / macOS / Web / Expo -->
|
package/README.md
CHANGED
|
@@ -10,13 +10,17 @@ 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: | :heavy_check_mark: |
|
|
16
|
-
| Data Channels | :heavy_check_mark: | :heavy_check_mark: |
|
|
17
|
-
| Screen Capture | :heavy_check_mark: | :heavy_check_mark: |
|
|
18
|
-
| Plan B | - | - | - | - | - | - |
|
|
19
|
-
| Unified Plan* | :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
|
+
|
|
22
|
+
> **macOS** - We don't currently actively support macOS at this time.
|
|
23
|
+
Support might return in the future.
|
|
20
24
|
|
|
21
25
|
> **Windows** - We don't currently support the [react-native-windows](https://github.com/microsoft/react-native-windows) platform at this time.
|
|
22
26
|
Anyone interested in getting the ball rolling? We're open to contributions.
|
|
@@ -24,16 +28,22 @@ Anyone interested in getting the ball rolling? We're open to contributions.
|
|
|
24
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.
|
|
25
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.
|
|
26
30
|
|
|
27
|
-
> **Expo** -
|
|
31
|
+
> **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default.
|
|
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.
|
|
28
33
|
|
|
29
|
-
> **Unified Plan** - As of version 106.0.0 Unified Plan is the only supported mode.
|
|
34
|
+
> **Unified Plan** - As of version 106.0.0 Unified Plan is the only supported mode.
|
|
35
|
+
Those still in need of Plan B will need to use an older release.
|
|
36
|
+
|
|
37
|
+
> **Simulcast** - As of version 111.0.0 Simulcast is now possible with ease.
|
|
38
|
+
Software encode/decode factories have been enabled by default.
|
|
30
39
|
|
|
31
40
|
## WebRTC Revision
|
|
32
41
|
|
|
33
|
-
* Currently used revision: [
|
|
42
|
+
* Currently used revision: [M111](https://github.com/jitsi/webrtc/tree/M111)
|
|
34
43
|
* Supported architectures
|
|
35
44
|
* Android: armeabi-v7a, arm64-v8a, x86, x86_64
|
|
36
45
|
* iOS: arm64, x86_64
|
|
46
|
+
* tvOS: arm64
|
|
37
47
|
* macOS: (temporarily disabled)
|
|
38
48
|
|
|
39
49
|
## Getting Started
|
|
@@ -43,11 +53,13 @@ Don't forget to follow platform guides below to cover any extra required steps.
|
|
|
43
53
|
|
|
44
54
|
**npm:** `npm install react-native-webrtc --save`
|
|
45
55
|
**yarn:** `yarn add react-native-webrtc`
|
|
56
|
+
**pnpm:** `pnpm install react-native-webrtc`
|
|
46
57
|
|
|
47
58
|
## Guides
|
|
48
59
|
|
|
49
60
|
- [Android Install](./Documentation/AndroidInstallation.md)
|
|
50
61
|
- [iOS Install](./Documentation/iOSInstallation.md)
|
|
62
|
+
- [tvOS Install](./Documentation/tvOSInstallation.md)
|
|
51
63
|
- [Basic Usage](./Documentation/BasicUsage.md)
|
|
52
64
|
- [Step by Step Call Guide](./Documentation/CallGuide.md)
|
|
53
65
|
- [Improving Call Reliability](./Documentation/ImprovingCallReliability.md)
|
package/android/build.gradle
CHANGED
|
@@ -5,12 +5,12 @@ def safeExtGet(prop, fallback) {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
android {
|
|
8
|
-
compileSdkVersion safeExtGet('compileSdkVersion',
|
|
8
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 24)
|
|
9
9
|
buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
|
|
10
10
|
|
|
11
11
|
defaultConfig {
|
|
12
|
-
minSdkVersion safeExtGet('minSdkVersion',
|
|
13
|
-
targetSdkVersion safeExtGet('targetSdkVersion',
|
|
12
|
+
minSdkVersion safeExtGet('minSdkVersion', 24)
|
|
13
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 24)
|
|
14
14
|
versionCode 1
|
|
15
15
|
versionName "1.0"
|
|
16
16
|
}
|
|
@@ -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) {
|
|
@@ -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();
|
|
@@ -173,12 +183,21 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
173
183
|
iceServersArray = map.getArray("iceServers");
|
|
174
184
|
}
|
|
175
185
|
List<PeerConnection.IceServer> iceServers = createIceServers(iceServersArray);
|
|
186
|
+
|
|
176
187
|
PeerConnection.RTCConfiguration conf = new PeerConnection.RTCConfiguration(iceServers);
|
|
188
|
+
conf.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
|
|
177
189
|
|
|
178
190
|
// Required for perfect negotiation.
|
|
179
191
|
conf.enableImplicitRollback = true;
|
|
180
192
|
|
|
181
|
-
|
|
193
|
+
// Enable GCM ciphers.
|
|
194
|
+
CryptoOptions cryptoOptions = CryptoOptions.builder()
|
|
195
|
+
.setEnableGcmCryptoSuites(true)
|
|
196
|
+
.setEnableAes128Sha1_32CryptoCipher(false)
|
|
197
|
+
.setEnableEncryptedRtpHeaderExtensions(false)
|
|
198
|
+
.setRequireFrameEncryption(false)
|
|
199
|
+
.createCryptoOptions();
|
|
200
|
+
conf.cryptoOptions = cryptoOptions;
|
|
182
201
|
|
|
183
202
|
if (map == null) {
|
|
184
203
|
return conf;
|
|
@@ -358,16 +377,20 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
358
377
|
}
|
|
359
378
|
|
|
360
379
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
361
|
-
public
|
|
380
|
+
public boolean peerConnectionInit(ReadableMap configuration, int id) {
|
|
362
381
|
PeerConnection.RTCConfiguration rtcConfiguration = parseRTCConfiguration(configuration);
|
|
363
382
|
|
|
364
383
|
try {
|
|
365
|
-
ThreadUtils
|
|
384
|
+
return (boolean) ThreadUtils
|
|
366
385
|
.submitToExecutor(() -> {
|
|
367
386
|
PeerConnectionObserver observer = new PeerConnectionObserver(this, id);
|
|
368
387
|
PeerConnection peerConnection = mFactory.createPeerConnection(rtcConfiguration, observer);
|
|
388
|
+
if (peerConnection == null) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
369
391
|
observer.setPeerConnection(peerConnection);
|
|
370
392
|
mPeerConnectionObservers.put(id, observer);
|
|
393
|
+
return true;
|
|
371
394
|
})
|
|
372
395
|
.get();
|
|
373
396
|
} catch (ExecutionException | InterruptedException e) {
|
|
@@ -836,13 +859,16 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
836
859
|
WritableArray transceiverUpdates = Arguments.createArray();
|
|
837
860
|
|
|
838
861
|
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
839
|
-
RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
|
|
840
|
-
if (direction == null) continue;
|
|
841
|
-
String directionSerialized = SerializeUtils.serializeDirection(direction);
|
|
842
862
|
WritableMap transceiverUpdate = Arguments.createMap();
|
|
863
|
+
|
|
864
|
+
RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
|
|
865
|
+
if (direction != null) {
|
|
866
|
+
String directionSerialized = SerializeUtils.serializeDirection(direction);
|
|
867
|
+
transceiverUpdate.putString("currentDirection", directionSerialized);
|
|
868
|
+
}
|
|
869
|
+
|
|
843
870
|
transceiverUpdate.putString("transceiverId", transceiver.getSender().id());
|
|
844
871
|
transceiverUpdate.putString("mid", transceiver.getMid());
|
|
845
|
-
transceiverUpdate.putString("currentDirection", directionSerialized);
|
|
846
872
|
transceiverUpdate.putBoolean("isStopped", transceiver.isStopped());
|
|
847
873
|
transceiverUpdate.putMap("senderRtpParameters",
|
|
848
874
|
SerializeUtils.serializeRtpParameters(transceiver.getSender().getParameters()));
|
|
@@ -873,7 +899,8 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
873
899
|
@ReactMethod
|
|
874
900
|
public void peerConnectionCreateOffer(int id, ReadableMap options, Promise promise) {
|
|
875
901
|
ThreadUtils.runOnExecutor(() -> {
|
|
876
|
-
|
|
902
|
+
PeerConnectionObserver pco = mPeerConnectionObservers.get(id);
|
|
903
|
+
PeerConnection peerConnection = pco.getPeerConnection();
|
|
877
904
|
|
|
878
905
|
if (peerConnection == null) {
|
|
879
906
|
Log.d(TAG, "peerConnectionCreateOffer() peerConnection is null");
|
|
@@ -881,6 +908,11 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
881
908
|
return;
|
|
882
909
|
}
|
|
883
910
|
|
|
911
|
+
List<String> receiversIds = new ArrayList<>();
|
|
912
|
+
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
913
|
+
receiversIds.add(transceiver.getReceiver().id());
|
|
914
|
+
}
|
|
915
|
+
|
|
884
916
|
final SdpObserver observer = new SdpObserver() {
|
|
885
917
|
@Override
|
|
886
918
|
public void onCreateFailure(String s) {
|
|
@@ -899,6 +931,19 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
|
|
|
899
931
|
params.putArray("transceiversInfo", getTransceiversInfo(peerConnection));
|
|
900
932
|
params.putMap("sdpInfo", sdpInfo);
|
|
901
933
|
|
|
934
|
+
WritableArray newTransceivers = Arguments.createArray();
|
|
935
|
+
for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
|
|
936
|
+
if (!receiversIds.contains(transceiver.getReceiver().id())) {
|
|
937
|
+
WritableMap newTransceiver = Arguments.createMap();
|
|
938
|
+
newTransceiver.putInt("transceiverOrder", pco.getNextTransceiverId());
|
|
939
|
+
newTransceiver.putMap(
|
|
940
|
+
"transceiver", SerializeUtils.serializeTransceiver(id, transceiver));
|
|
941
|
+
newTransceivers.pushMap(newTransceiver);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
params.putArray("newTransceivers", newTransceivers);
|
|
946
|
+
|
|
902
947
|
promise.resolve(params);
|
|
903
948
|
});
|
|
904
949
|
}
|
|
@@ -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
|
}
|
|
@@ -88,11 +88,17 @@
|
|
|
88
88
|
|
|
89
89
|
+ (nonnull RTCConfiguration *)RTCConfiguration:(id)json {
|
|
90
90
|
RTCConfiguration *config = [[RTCConfiguration alloc] init];
|
|
91
|
+
config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
|
|
91
92
|
|
|
92
93
|
// Required for perfect negotiation.
|
|
93
94
|
config.enableImplicitRollback = YES;
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
// Enable GCM ciphers.
|
|
97
|
+
RTCCryptoOptions *cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES
|
|
98
|
+
srtpEnableAes128Sha1_32CryptoCipher:NO
|
|
99
|
+
srtpEnableEncryptedRtpHeaderExtensions:NO
|
|
100
|
+
sframeRequireFrameEncryption:NO];
|
|
101
|
+
config.cryptoOptions = cryptoOptions;
|
|
96
102
|
|
|
97
103
|
if (!json) {
|
|
98
104
|
return config;
|
|
@@ -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;
|
|
@@ -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
|