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.
Files changed (270) hide show
  1. package/.github/workflows/android_ci.yml +5 -1
  2. package/.github/workflows/ios_ci.yml +4 -0
  3. package/ISSUE_TEMPLATE.md +27 -12
  4. package/README.md +22 -10
  5. package/android/build.gradle +3 -3
  6. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +0 -1
  7. package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +19 -14
  8. package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +1 -1
  9. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +53 -8
  10. package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +21 -21
  11. package/ios/RCTWebRTC/CaptureController.m +4 -0
  12. package/ios/RCTWebRTC/RCTConvert+WebRTC.m +7 -1
  13. package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
  14. package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +2 -2
  15. package/ios/RCTWebRTC/ScreenCapturer.m +4 -0
  16. package/ios/RCTWebRTC/SerializeUtils.m +12 -10
  17. package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +1 -1
  18. package/ios/RCTWebRTC/VideoCaptureController.h +2 -1
  19. package/ios/RCTWebRTC/VideoCaptureController.m +3 -0
  20. package/ios/RCTWebRTC/WebRTCModule+Permissions.m +10 -1
  21. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +1 -1
  22. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +42 -8
  23. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +29 -13
  24. package/ios/RCTWebRTC/WebRTCModule.m +3 -1
  25. package/ios/RCTWebRTC/WebRTCModuleOptions.h +1 -0
  26. package/ios/RCTWebRTC/WebRTCModuleOptions.m +1 -0
  27. package/ios/RCTWebRTC.xcodeproj/project.pbxproj +1 -0
  28. package/lib/commonjs/EventEmitter.js +4 -16
  29. package/lib/commonjs/EventEmitter.js.map +1 -1
  30. package/lib/commonjs/Logger.js +2 -26
  31. package/lib/commonjs/Logger.js.map +1 -1
  32. package/lib/commonjs/MediaDevices.js +8 -15
  33. package/lib/commonjs/MediaDevices.js.map +1 -1
  34. package/lib/commonjs/MediaStream.js +21 -44
  35. package/lib/commonjs/MediaStream.js.map +1 -1
  36. package/lib/commonjs/MediaStreamError.js +0 -11
  37. package/lib/commonjs/MediaStreamError.js.map +1 -1
  38. package/lib/commonjs/MediaStreamErrorEvent.js +0 -9
  39. package/lib/commonjs/MediaStreamErrorEvent.js.map +1 -1
  40. package/lib/commonjs/MediaStreamTrack.js +14 -69
  41. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  42. package/lib/commonjs/MediaStreamTrackEvent.js +11 -10
  43. package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
  44. package/lib/commonjs/MessageEvent.js +12 -10
  45. package/lib/commonjs/MessageEvent.js.map +1 -1
  46. package/lib/commonjs/Permissions.js +19 -29
  47. package/lib/commonjs/Permissions.js.map +1 -1
  48. package/lib/commonjs/RTCDataChannel.js +18 -77
  49. package/lib/commonjs/RTCDataChannel.js.map +1 -1
  50. package/lib/commonjs/RTCDataChannelEvent.js +11 -10
  51. package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
  52. package/lib/commonjs/RTCErrorEvent.js +2 -15
  53. package/lib/commonjs/RTCErrorEvent.js.map +1 -1
  54. package/lib/commonjs/RTCIceCandidate.js +0 -14
  55. package/lib/commonjs/RTCIceCandidate.js.map +1 -1
  56. package/lib/commonjs/RTCIceCandidateEvent.js +13 -13
  57. package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
  58. package/lib/commonjs/RTCPeerConnection.js +129 -239
  59. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  60. package/lib/commonjs/RTCRtcpParameters.js +0 -10
  61. package/lib/commonjs/RTCRtcpParameters.js.map +1 -1
  62. package/lib/commonjs/RTCRtpCapabilities.js +5 -22
  63. package/lib/commonjs/RTCRtpCapabilities.js.map +1 -1
  64. package/lib/commonjs/RTCRtpCodecCapability.js +0 -8
  65. package/lib/commonjs/RTCRtpCodecCapability.js.map +1 -1
  66. package/lib/commonjs/RTCRtpCodecParameters.js +0 -19
  67. package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
  68. package/lib/commonjs/RTCRtpEncodingParameters.js +4 -34
  69. package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
  70. package/lib/commonjs/RTCRtpHeaderExtension.js +0 -12
  71. package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -1
  72. package/lib/commonjs/RTCRtpParameters.js +2 -18
  73. package/lib/commonjs/RTCRtpParameters.js.map +1 -1
  74. package/lib/commonjs/RTCRtpReceiveParameters.js +0 -5
  75. package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
  76. package/lib/commonjs/RTCRtpReceiver.js +1 -26
  77. package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
  78. package/lib/commonjs/RTCRtpSendParameters.js +0 -22
  79. package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
  80. package/lib/commonjs/RTCRtpSender.js +1 -30
  81. package/lib/commonjs/RTCRtpSender.js.map +1 -1
  82. package/lib/commonjs/RTCRtpTransceiver.js +3 -36
  83. package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
  84. package/lib/commonjs/RTCSessionDescription.js +0 -13
  85. package/lib/commonjs/RTCSessionDescription.js.map +1 -1
  86. package/lib/commonjs/RTCTrackEvent.js +16 -14
  87. package/lib/commonjs/RTCTrackEvent.js.map +1 -1
  88. package/lib/commonjs/RTCUtil.js +9 -36
  89. package/lib/commonjs/RTCUtil.js.map +1 -1
  90. package/lib/commonjs/RTCView.js +6 -3
  91. package/lib/commonjs/RTCView.js.map +1 -1
  92. package/lib/commonjs/ScreenCapturePickerView.js +0 -3
  93. package/lib/commonjs/ScreenCapturePickerView.js.map +1 -1
  94. package/lib/commonjs/getDisplayMedia.js +0 -6
  95. package/lib/commonjs/getDisplayMedia.js.map +1 -1
  96. package/lib/commonjs/getUserMedia.js +7 -28
  97. package/lib/commonjs/getUserMedia.js.map +1 -1
  98. package/lib/commonjs/index.js +1 -26
  99. package/lib/commonjs/index.js.map +1 -1
  100. package/lib/module/EventEmitter.js +5 -12
  101. package/lib/module/EventEmitter.js.map +1 -1
  102. package/lib/module/Logger.js +2 -22
  103. package/lib/module/Logger.js.map +1 -1
  104. package/lib/module/MediaDevices.js +9 -9
  105. package/lib/module/MediaDevices.js.map +1 -1
  106. package/lib/module/MediaStream.js +24 -39
  107. package/lib/module/MediaStream.js.map +1 -1
  108. package/lib/module/MediaStreamError.js +0 -9
  109. package/lib/module/MediaStreamError.js.map +1 -1
  110. package/lib/module/MediaStreamErrorEvent.js +0 -7
  111. package/lib/module/MediaStreamErrorEvent.js.map +1 -1
  112. package/lib/module/MediaStreamTrack.js +14 -62
  113. package/lib/module/MediaStreamTrack.js.map +1 -1
  114. package/lib/module/MediaStreamTrackEvent.js +11 -8
  115. package/lib/module/MediaStreamTrackEvent.js.map +1 -1
  116. package/lib/module/MessageEvent.js +12 -8
  117. package/lib/module/MessageEvent.js.map +1 -1
  118. package/lib/module/Permissions.js +19 -26
  119. package/lib/module/Permissions.js.map +1 -1
  120. package/lib/module/RTCDataChannel.js +20 -67
  121. package/lib/module/RTCDataChannel.js.map +1 -1
  122. package/lib/module/RTCDataChannelEvent.js +11 -8
  123. package/lib/module/RTCDataChannelEvent.js.map +1 -1
  124. package/lib/module/RTCErrorEvent.js +2 -11
  125. package/lib/module/RTCErrorEvent.js.map +1 -1
  126. package/lib/module/RTCIceCandidate.js +0 -12
  127. package/lib/module/RTCIceCandidate.js.map +1 -1
  128. package/lib/module/RTCIceCandidateEvent.js +13 -11
  129. package/lib/module/RTCIceCandidateEvent.js.map +1 -1
  130. package/lib/module/RTCPeerConnection.js +131 -215
  131. package/lib/module/RTCPeerConnection.js.map +1 -1
  132. package/lib/module/RTCRtcpParameters.js +0 -8
  133. package/lib/module/RTCRtcpParameters.js.map +1 -1
  134. package/lib/module/RTCRtpCapabilities.js +5 -17
  135. package/lib/module/RTCRtpCapabilities.js.map +1 -1
  136. package/lib/module/RTCRtpCodecCapability.js +0 -6
  137. package/lib/module/RTCRtpCodecCapability.js.map +1 -1
  138. package/lib/module/RTCRtpCodecParameters.js +0 -17
  139. package/lib/module/RTCRtpCodecParameters.js.map +1 -1
  140. package/lib/module/RTCRtpEncodingParameters.js +4 -32
  141. package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
  142. package/lib/module/RTCRtpHeaderExtension.js +0 -10
  143. package/lib/module/RTCRtpHeaderExtension.js.map +1 -1
  144. package/lib/module/RTCRtpParameters.js +2 -12
  145. package/lib/module/RTCRtpParameters.js.map +1 -1
  146. package/lib/module/RTCRtpReceiveParameters.js +0 -1
  147. package/lib/module/RTCRtpReceiveParameters.js.map +1 -1
  148. package/lib/module/RTCRtpReceiver.js +1 -19
  149. package/lib/module/RTCRtpReceiver.js.map +1 -1
  150. package/lib/module/RTCRtpSendParameters.js +0 -18
  151. package/lib/module/RTCRtpSendParameters.js.map +1 -1
  152. package/lib/module/RTCRtpSender.js +1 -23
  153. package/lib/module/RTCRtpSender.js.map +1 -1
  154. package/lib/module/RTCRtpTransceiver.js +3 -32
  155. package/lib/module/RTCRtpTransceiver.js.map +1 -1
  156. package/lib/module/RTCSessionDescription.js +0 -11
  157. package/lib/module/RTCSessionDescription.js.map +1 -1
  158. package/lib/module/RTCTrackEvent.js +16 -12
  159. package/lib/module/RTCTrackEvent.js.map +1 -1
  160. package/lib/module/RTCUtil.js +9 -32
  161. package/lib/module/RTCUtil.js.map +1 -1
  162. package/lib/module/RTCView.js +1 -0
  163. package/lib/module/RTCView.js.map +1 -1
  164. package/lib/module/ScreenCapturePickerView.js.map +1 -1
  165. package/lib/module/getDisplayMedia.js.map +1 -1
  166. package/lib/module/getUserMedia.js +7 -18
  167. package/lib/module/getUserMedia.js.map +1 -1
  168. package/lib/module/index.js +2 -7
  169. package/lib/module/index.js.map +1 -1
  170. package/lib/typescript/EventEmitter.d.ts +3 -2
  171. package/lib/typescript/EventEmitter.d.ts.map +1 -0
  172. package/lib/typescript/Logger.d.ts +1 -0
  173. package/lib/typescript/Logger.d.ts.map +1 -0
  174. package/lib/typescript/MediaDevices.d.ts +6 -3
  175. package/lib/typescript/MediaDevices.d.ts.map +1 -0
  176. package/lib/typescript/MediaStream.d.ts +17 -7
  177. package/lib/typescript/MediaStream.d.ts.map +1 -0
  178. package/lib/typescript/MediaStreamError.d.ts +1 -0
  179. package/lib/typescript/MediaStreamError.d.ts.map +1 -0
  180. package/lib/typescript/MediaStreamErrorEvent.d.ts +1 -0
  181. package/lib/typescript/MediaStreamErrorEvent.d.ts.map +1 -0
  182. package/lib/typescript/MediaStreamTrack.d.ts +21 -6
  183. package/lib/typescript/MediaStreamTrack.d.ts.map +1 -0
  184. package/lib/typescript/MediaStreamTrackEvent.d.ts +17 -5
  185. package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -0
  186. package/lib/typescript/MessageEvent.d.ts +19 -6
  187. package/lib/typescript/MessageEvent.d.ts.map +1 -0
  188. package/lib/typescript/Permissions.d.ts +2 -1
  189. package/lib/typescript/Permissions.d.ts.map +1 -0
  190. package/lib/typescript/RTCDataChannel.d.ts +14 -4
  191. package/lib/typescript/RTCDataChannel.d.ts.map +1 -0
  192. package/lib/typescript/RTCDataChannelEvent.d.ts +17 -5
  193. package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -0
  194. package/lib/typescript/RTCErrorEvent.d.ts +5 -4
  195. package/lib/typescript/RTCErrorEvent.d.ts.map +1 -0
  196. package/lib/typescript/RTCIceCandidate.d.ts +8 -5
  197. package/lib/typescript/RTCIceCandidate.d.ts.map +1 -0
  198. package/lib/typescript/RTCIceCandidateEvent.d.ts +18 -3
  199. package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -0
  200. package/lib/typescript/RTCPeerConnection.d.ts +23 -8
  201. package/lib/typescript/RTCPeerConnection.d.ts.map +1 -0
  202. package/lib/typescript/RTCRtcpParameters.d.ts +1 -0
  203. package/lib/typescript/RTCRtcpParameters.d.ts.map +1 -0
  204. package/lib/typescript/RTCRtpCapabilities.d.ts +1 -0
  205. package/lib/typescript/RTCRtpCapabilities.d.ts.map +1 -0
  206. package/lib/typescript/RTCRtpCodecCapability.d.ts +1 -0
  207. package/lib/typescript/RTCRtpCodecCapability.d.ts.map +1 -0
  208. package/lib/typescript/RTCRtpCodecParameters.d.ts +1 -0
  209. package/lib/typescript/RTCRtpCodecParameters.d.ts.map +1 -0
  210. package/lib/typescript/RTCRtpEncodingParameters.d.ts +1 -0
  211. package/lib/typescript/RTCRtpEncodingParameters.d.ts.map +1 -0
  212. package/lib/typescript/RTCRtpHeaderExtension.d.ts +1 -0
  213. package/lib/typescript/RTCRtpHeaderExtension.d.ts.map +1 -0
  214. package/lib/typescript/RTCRtpParameters.d.ts +1 -0
  215. package/lib/typescript/RTCRtpParameters.d.ts.map +1 -0
  216. package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -0
  217. package/lib/typescript/RTCRtpReceiveParameters.d.ts.map +1 -0
  218. package/lib/typescript/RTCRtpReceiver.d.ts +1 -0
  219. package/lib/typescript/RTCRtpReceiver.d.ts.map +1 -0
  220. package/lib/typescript/RTCRtpSendParameters.d.ts +2 -1
  221. package/lib/typescript/RTCRtpSendParameters.d.ts.map +1 -0
  222. package/lib/typescript/RTCRtpSender.d.ts +1 -0
  223. package/lib/typescript/RTCRtpSender.d.ts.map +1 -0
  224. package/lib/typescript/RTCRtpTransceiver.d.ts +1 -0
  225. package/lib/typescript/RTCRtpTransceiver.d.ts.map +1 -0
  226. package/lib/typescript/RTCSessionDescription.d.ts +1 -0
  227. package/lib/typescript/RTCSessionDescription.d.ts.map +1 -0
  228. package/lib/typescript/RTCTrackEvent.d.ts +21 -6
  229. package/lib/typescript/RTCTrackEvent.d.ts.map +1 -0
  230. package/lib/typescript/RTCUtil.d.ts +1 -0
  231. package/lib/typescript/RTCUtil.d.ts.map +1 -0
  232. package/lib/typescript/RTCView.d.ts +1 -0
  233. package/lib/typescript/RTCView.d.ts.map +1 -0
  234. package/lib/typescript/ScreenCapturePickerView.d.ts +1 -0
  235. package/lib/typescript/ScreenCapturePickerView.d.ts.map +1 -0
  236. package/lib/typescript/getDisplayMedia.d.ts +1 -0
  237. package/lib/typescript/getDisplayMedia.d.ts.map +1 -0
  238. package/lib/typescript/getUserMedia.d.ts +1 -0
  239. package/lib/typescript/getUserMedia.d.ts.map +1 -0
  240. package/lib/typescript/index.d.ts +1 -0
  241. package/lib/typescript/index.d.ts.map +1 -0
  242. package/package.json +3 -5
  243. package/react-native-webrtc.podspec +1 -1
  244. package/src/MediaDevices.ts +13 -4
  245. package/src/MediaStream.ts +37 -13
  246. package/src/MediaStreamTrack.ts +28 -7
  247. package/src/MediaStreamTrackEvent.ts +18 -4
  248. package/src/MessageEvent.ts +19 -5
  249. package/src/RTCDataChannel.ts +22 -9
  250. package/src/RTCDataChannelEvent.ts +21 -4
  251. package/src/RTCErrorEvent.ts +3 -3
  252. package/src/RTCIceCandidate.ts +7 -1
  253. package/src/RTCIceCandidateEvent.ts +19 -4
  254. package/src/RTCPeerConnection.ts +61 -35
  255. package/src/RTCRtpTransceiver.ts +2 -2
  256. package/src/RTCTrackEvent.ts +25 -4
  257. package/src/index.ts +1 -2
  258. package/tools/format.sh +6 -0
  259. package/lib/commonjs/MediaStreamEvent.js +0 -23
  260. package/lib/commonjs/MediaStreamEvent.js.map +0 -1
  261. package/lib/commonjs/RTCEvent.js +0 -20
  262. package/lib/commonjs/RTCEvent.js.map +0 -1
  263. package/lib/module/MediaStreamEvent.js +0 -14
  264. package/lib/module/MediaStreamEvent.js.map +0 -1
  265. package/lib/module/RTCEvent.js +0 -11
  266. package/lib/module/RTCEvent.js.map +0 -1
  267. package/lib/typescript/MediaStreamEvent.d.ts +0 -8
  268. package/lib/typescript/RTCEvent.d.ts +0 -4
  269. package/src/MediaStreamEvent.ts +0 -11
  270. 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
@@ -2,8 +2,12 @@ name: iOS 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
  ios-compile:
package/ISSUE_TEMPLATE.md CHANGED
@@ -1,25 +1,40 @@
1
1
  <!--
2
- If you have a question then please ask it on our community Discourse: https://react-native-webrtc.discourse.group/
3
- otherwise if you wanted to report a bug then you are in the right place!
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
- #### Observed Behavior
11
+ ```javascript
13
12
 
13
+ console.log( 'Hello World' );
14
14
 
15
+ ```
15
16
 
16
- #### Steps to reproduce the issue
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
- #### Platform Information
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
- * **Plugin Version**:
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: | :heavy_check_mark: | - | :heavy_check_mark: | :heavy_check_mark: |
17
- | Screen Capture | :heavy_check_mark: | :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: | :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** - Sadly this module is not available in the [Expo Go](https://expo.dev/client) app by default due to including much needed native code. 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.
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. Those still in need of Plan B can use and old release.
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: [M106](https://github.com/jitsi/webrtc/tree/M106)
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)
@@ -5,12 +5,12 @@ def safeExtGet(prop, fallback) {
5
5
  }
6
6
 
7
7
  android {
8
- compileSdkVersion safeExtGet('compileSdkVersion', 23)
8
+ compileSdkVersion safeExtGet('compileSdkVersion', 24)
9
9
  buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
10
10
 
11
11
  defaultConfig {
12
- minSdkVersion safeExtGet('minSdkVersion', 19)
13
- targetSdkVersion safeExtGet('targetSdkVersion', 23)
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 orientatationListener;
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.orientatationListener = new OrientationEventListener(context) {
31
+ this.orientationListener = new OrientationEventListener(context) {
32
32
  @Override
33
33
  public void onOrientationChanged(int orientation) {
34
- try {
35
- DisplayMetrics displayMetrics = DisplayUtils.getDisplayMetrics((Activity) context);
36
- int width = displayMetrics.widthPixels;
37
- int height = displayMetrics.heightPixels;
38
- videoCapturer.changeCaptureFormat(width, height, DEFAULT_FPS);
39
- } catch (Exception ex) {
40
- // We ignore exceptions here. The video capturer runs on its own
41
- // thread and we cannot synchronize with it.
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.orientatationListener.canDetectOrientation()) {
47
- this.orientatationListener.enable();
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
- orientatationListener.disable();
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.INACTIVE;
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
- conf.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
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 void peerConnectionInit(ReadableMap configuration, int id) {
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
- PeerConnection peerConnection = getPeerConnection(id);
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
- try {
327
- ThreadUtils.submitToExecutor(() -> { videoTrack.removeSink(surfaceViewRenderer); }).get();
328
- } catch (Throwable tr) {
329
- // XXX If WebRTCModule#mediaStreamTrackRelease has already been
330
- // invoked on videoTrack, then it is no longer safe to call removeSink
331
- // on the instance, it will throw IllegalStateException.
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
- surfaceViewRendererInstances--;
528
+ return;
527
529
  }
528
530
 
529
- try {
530
- ThreadUtils.submitToExecutor(() -> { videoTrack.addSink(surfaceViewRenderer); }).get();
531
- } catch (Throwable tr) {
532
- // XXX If WebRTCModule#mediaStreamTrackRelease has already been
533
- // invoked on videoTrack, then it is no longer safe to call addSink
534
- // on the instance, it will throw IllegalStateException.
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
- surfaceViewRenderer.release();
539
- surfaceViewRendererInstances--;
540
- return;
541
- }
539
+ Log.e(TAG, "Failed to add renderer", tr);
540
+ }
541
+ });
542
542
 
543
543
  rendererAttached = true;
544
544
  }
@@ -1,3 +1,5 @@
1
+ #if !TARGET_OS_TV
2
+
1
3
  #import "CaptureController.h"
2
4
 
3
5
  @implementation CaptureController
@@ -11,3 +13,5 @@
11
13
  }
12
14
 
13
15
  @end
16
+
17
+ #endif
@@ -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
- config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
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;
@@ -1,3 +1,5 @@
1
+ #if TARGET_OS_IOS
2
+
1
3
  #import "ScreenCaptureController.h"
2
4
  #import "ScreenCapturer.h"
3
5
  #import "SocketConnection.h"
@@ -73,3 +75,5 @@ NSString *const kRTCAppGroupIdentifier = @"RTCAppGroupIdentifier";
73
75
  }
74
76
 
75
77
  @end
78
+
79
+ #endif
@@ -1,4 +1,4 @@
1
- #if !TARGET_OS_OSX
1
+ #if TARGET_OS_IOS
2
2
 
3
3
  #import <React/RCTUIManager.h>
4
4
  #import <ReplayKit/ReplayKit.h>
@@ -57,4 +57,4 @@ RCT_EXPORT_METHOD(show : (nonnull NSNumber *)reactTag) {
57
57
 
58
58
  @end
59
59
 
60
- #endif // !TARGET_OS_OSX
60
+ #endif
@@ -1,3 +1,5 @@
1
+ #if TARGET_OS_IOS
2
+
1
3
  #include <mach/mach_time.h>
2
4
 
3
5
  #import <ReplayKit/ReplayKit.h>
@@ -258,3 +260,5 @@ const NSUInteger kMaxReadLength = 10 * 1024;
258
260
  }
259
261
 
260
262
  @end
263
+
264
+ #endif
@@ -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
- if ([transceiver currentDirection:&currentDirection]) {
31
- NSMutableDictionary *transceiverUpdate = [NSMutableDictionary new];
32
- transceiverUpdate[@"transceiverId"] = transceiver.sender.senderId;
33
- transceiverUpdate[@"mid"] = transceiver.mid;
32
+ BOOL hasCurrentDirection = [transceiver currentDirection:&currentDirection];
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;
@@ -34,4 +34,4 @@ NS_ASSUME_NONNULL_BEGIN
34
34
 
35
35
  @end
36
36
 
37
- NS_ASSUME_NONNULL_END
37
+ NS_ASSUME_NONNULL_END
@@ -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
@@ -1,3 +1,4 @@
1
+ #if !TARGET_OS_TV
1
2
 
2
3
  #import "VideoCaptureController.h"
3
4
 
@@ -250,3 +251,5 @@
250
251
  }
251
252
 
252
253
  @end
254
+
255
+ #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
@@ -5,4 +5,4 @@
5
5
  - (RTCVideoTrack *)createVideoTrackWithCaptureController:
6
6
  (CaptureController * (^)(RTCVideoSource *))captureControllerCreator;
7
7
  - (NSArray *)createMediaStream:(NSArray<RTCMediaStreamTrack *> *)tracks;
8
- @end
8
+ @end