react-native-webrtc 111.0.2 → 111.0.4

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 (260) hide show
  1. package/README.md +13 -10
  2. package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +18 -0
  3. package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +1 -1
  4. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +13 -26
  5. package/ios/RCTWebRTC/CaptureController.m +4 -0
  6. package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
  7. package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +2 -2
  8. package/ios/RCTWebRTC/ScreenCapturer.m +4 -0
  9. package/ios/RCTWebRTC/SerializeUtils.m +12 -10
  10. package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +1 -1
  11. package/ios/RCTWebRTC/VideoCaptureController.h +2 -1
  12. package/ios/RCTWebRTC/VideoCaptureController.m +3 -0
  13. package/ios/RCTWebRTC/WebRTCModule+Permissions.m +10 -1
  14. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +1 -1
  15. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +40 -3
  16. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +30 -19
  17. package/ios/RCTWebRTC/WebRTCModule.m +3 -1
  18. package/ios/RCTWebRTC/WebRTCModuleOptions.h +1 -0
  19. package/ios/RCTWebRTC/WebRTCModuleOptions.m +1 -0
  20. package/ios/RCTWebRTC.xcodeproj/project.pbxproj +1 -0
  21. package/lib/commonjs/EventEmitter.js +4 -16
  22. package/lib/commonjs/EventEmitter.js.map +1 -1
  23. package/lib/commonjs/Logger.js +2 -26
  24. package/lib/commonjs/Logger.js.map +1 -1
  25. package/lib/commonjs/MediaDevices.js +2 -14
  26. package/lib/commonjs/MediaDevices.js.map +1 -1
  27. package/lib/commonjs/MediaStream.js +8 -45
  28. package/lib/commonjs/MediaStream.js.map +1 -1
  29. package/lib/commonjs/MediaStreamError.js +0 -11
  30. package/lib/commonjs/MediaStreamError.js.map +1 -1
  31. package/lib/commonjs/MediaStreamErrorEvent.js +0 -9
  32. package/lib/commonjs/MediaStreamErrorEvent.js.map +1 -1
  33. package/lib/commonjs/MediaStreamEvent.js +0 -9
  34. package/lib/commonjs/MediaStreamEvent.js.map +1 -1
  35. package/lib/commonjs/MediaStreamTrack.js +6 -65
  36. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  37. package/lib/commonjs/MediaStreamTrackEvent.js +11 -10
  38. package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
  39. package/lib/commonjs/MessageEvent.js +12 -10
  40. package/lib/commonjs/MessageEvent.js.map +1 -1
  41. package/lib/commonjs/Permissions.js +19 -29
  42. package/lib/commonjs/Permissions.js.map +1 -1
  43. package/lib/commonjs/RTCDataChannel.js +8 -78
  44. package/lib/commonjs/RTCDataChannel.js.map +1 -1
  45. package/lib/commonjs/RTCDataChannelEvent.js +11 -10
  46. package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
  47. package/lib/commonjs/RTCErrorEvent.js +2 -15
  48. package/lib/commonjs/RTCErrorEvent.js.map +1 -1
  49. package/lib/commonjs/RTCEvent.js +13 -10
  50. package/lib/commonjs/RTCEvent.js.map +1 -1
  51. package/lib/commonjs/RTCIceCandidate.js +0 -14
  52. package/lib/commonjs/RTCIceCandidate.js.map +1 -1
  53. package/lib/commonjs/RTCIceCandidateEvent.js +13 -13
  54. package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
  55. package/lib/commonjs/RTCPeerConnection.js +175 -255
  56. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  57. package/lib/commonjs/RTCRtcpParameters.js +0 -10
  58. package/lib/commonjs/RTCRtcpParameters.js.map +1 -1
  59. package/lib/commonjs/RTCRtpCapabilities.js +5 -22
  60. package/lib/commonjs/RTCRtpCapabilities.js.map +1 -1
  61. package/lib/commonjs/RTCRtpCodecCapability.js +0 -8
  62. package/lib/commonjs/RTCRtpCodecCapability.js.map +1 -1
  63. package/lib/commonjs/RTCRtpCodecParameters.js +0 -19
  64. package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
  65. package/lib/commonjs/RTCRtpEncodingParameters.js +4 -34
  66. package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
  67. package/lib/commonjs/RTCRtpHeaderExtension.js +0 -12
  68. package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -1
  69. package/lib/commonjs/RTCRtpParameters.js +2 -18
  70. package/lib/commonjs/RTCRtpParameters.js.map +1 -1
  71. package/lib/commonjs/RTCRtpReceiveParameters.js +0 -5
  72. package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
  73. package/lib/commonjs/RTCRtpReceiver.js +1 -26
  74. package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
  75. package/lib/commonjs/RTCRtpSendParameters.js +0 -22
  76. package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
  77. package/lib/commonjs/RTCRtpSender.js +1 -30
  78. package/lib/commonjs/RTCRtpSender.js.map +1 -1
  79. package/lib/commonjs/RTCRtpTransceiver.js +3 -38
  80. package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
  81. package/lib/commonjs/RTCSessionDescription.js +0 -13
  82. package/lib/commonjs/RTCSessionDescription.js.map +1 -1
  83. package/lib/commonjs/RTCTrackEvent.js +16 -14
  84. package/lib/commonjs/RTCTrackEvent.js.map +1 -1
  85. package/lib/commonjs/RTCUtil.js +9 -36
  86. package/lib/commonjs/RTCUtil.js.map +1 -1
  87. package/lib/commonjs/RTCView.js +6 -3
  88. package/lib/commonjs/RTCView.js.map +1 -1
  89. package/lib/commonjs/ScreenCapturePickerView.js +0 -3
  90. package/lib/commonjs/ScreenCapturePickerView.js.map +1 -1
  91. package/lib/commonjs/getDisplayMedia.js +0 -6
  92. package/lib/commonjs/getDisplayMedia.js.map +1 -1
  93. package/lib/commonjs/getUserMedia.js +7 -28
  94. package/lib/commonjs/getUserMedia.js.map +1 -1
  95. package/lib/commonjs/index.js +1 -26
  96. package/lib/commonjs/index.js.map +1 -1
  97. package/lib/module/EventEmitter.js +5 -12
  98. package/lib/module/EventEmitter.js.map +1 -1
  99. package/lib/module/Logger.js +2 -22
  100. package/lib/module/Logger.js.map +1 -1
  101. package/lib/module/MediaDevices.js +2 -7
  102. package/lib/module/MediaDevices.js.map +1 -1
  103. package/lib/module/MediaStream.js +9 -38
  104. package/lib/module/MediaStream.js.map +1 -1
  105. package/lib/module/MediaStreamError.js +0 -9
  106. package/lib/module/MediaStreamError.js.map +1 -1
  107. package/lib/module/MediaStreamErrorEvent.js +0 -7
  108. package/lib/module/MediaStreamErrorEvent.js.map +1 -1
  109. package/lib/module/MediaStreamEvent.js +0 -7
  110. package/lib/module/MediaStreamEvent.js.map +1 -1
  111. package/lib/module/MediaStreamTrack.js +6 -58
  112. package/lib/module/MediaStreamTrack.js.map +1 -1
  113. package/lib/module/MediaStreamTrackEvent.js +11 -8
  114. package/lib/module/MediaStreamTrackEvent.js.map +1 -1
  115. package/lib/module/MessageEvent.js +12 -8
  116. package/lib/module/MessageEvent.js.map +1 -1
  117. package/lib/module/Permissions.js +19 -26
  118. package/lib/module/Permissions.js.map +1 -1
  119. package/lib/module/RTCDataChannel.js +9 -67
  120. package/lib/module/RTCDataChannel.js.map +1 -1
  121. package/lib/module/RTCDataChannelEvent.js +11 -8
  122. package/lib/module/RTCDataChannelEvent.js.map +1 -1
  123. package/lib/module/RTCErrorEvent.js +2 -11
  124. package/lib/module/RTCErrorEvent.js.map +1 -1
  125. package/lib/module/RTCEvent.js +13 -7
  126. package/lib/module/RTCEvent.js.map +1 -1
  127. package/lib/module/RTCIceCandidate.js +0 -12
  128. package/lib/module/RTCIceCandidate.js.map +1 -1
  129. package/lib/module/RTCIceCandidateEvent.js +13 -11
  130. package/lib/module/RTCIceCandidateEvent.js.map +1 -1
  131. package/lib/module/RTCPeerConnection.js +176 -230
  132. package/lib/module/RTCPeerConnection.js.map +1 -1
  133. package/lib/module/RTCRtcpParameters.js +0 -8
  134. package/lib/module/RTCRtcpParameters.js.map +1 -1
  135. package/lib/module/RTCRtpCapabilities.js +5 -17
  136. package/lib/module/RTCRtpCapabilities.js.map +1 -1
  137. package/lib/module/RTCRtpCodecCapability.js +0 -6
  138. package/lib/module/RTCRtpCodecCapability.js.map +1 -1
  139. package/lib/module/RTCRtpCodecParameters.js +0 -17
  140. package/lib/module/RTCRtpCodecParameters.js.map +1 -1
  141. package/lib/module/RTCRtpEncodingParameters.js +4 -32
  142. package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
  143. package/lib/module/RTCRtpHeaderExtension.js +0 -10
  144. package/lib/module/RTCRtpHeaderExtension.js.map +1 -1
  145. package/lib/module/RTCRtpParameters.js +2 -12
  146. package/lib/module/RTCRtpParameters.js.map +1 -1
  147. package/lib/module/RTCRtpReceiveParameters.js +0 -1
  148. package/lib/module/RTCRtpReceiveParameters.js.map +1 -1
  149. package/lib/module/RTCRtpReceiver.js +1 -19
  150. package/lib/module/RTCRtpReceiver.js.map +1 -1
  151. package/lib/module/RTCRtpSendParameters.js +0 -18
  152. package/lib/module/RTCRtpSendParameters.js.map +1 -1
  153. package/lib/module/RTCRtpSender.js +1 -23
  154. package/lib/module/RTCRtpSender.js.map +1 -1
  155. package/lib/module/RTCRtpTransceiver.js +3 -34
  156. package/lib/module/RTCRtpTransceiver.js.map +1 -1
  157. package/lib/module/RTCSessionDescription.js +0 -11
  158. package/lib/module/RTCSessionDescription.js.map +1 -1
  159. package/lib/module/RTCTrackEvent.js +16 -12
  160. package/lib/module/RTCTrackEvent.js.map +1 -1
  161. package/lib/module/RTCUtil.js +9 -32
  162. package/lib/module/RTCUtil.js.map +1 -1
  163. package/lib/module/RTCView.js +1 -0
  164. package/lib/module/RTCView.js.map +1 -1
  165. package/lib/module/ScreenCapturePickerView.js.map +1 -1
  166. package/lib/module/getDisplayMedia.js.map +1 -1
  167. package/lib/module/getUserMedia.js +7 -18
  168. package/lib/module/getUserMedia.js.map +1 -1
  169. package/lib/module/index.js +2 -7
  170. package/lib/module/index.js.map +1 -1
  171. package/lib/typescript/EventEmitter.d.ts +3 -2
  172. package/lib/typescript/EventEmitter.d.ts.map +1 -0
  173. package/lib/typescript/Logger.d.ts +1 -0
  174. package/lib/typescript/Logger.d.ts.map +1 -0
  175. package/lib/typescript/MediaDevices.d.ts +1 -0
  176. package/lib/typescript/MediaDevices.d.ts.map +1 -0
  177. package/lib/typescript/MediaStream.d.ts +15 -4
  178. package/lib/typescript/MediaStream.d.ts.map +1 -0
  179. package/lib/typescript/MediaStreamError.d.ts +1 -0
  180. package/lib/typescript/MediaStreamError.d.ts.map +1 -0
  181. package/lib/typescript/MediaStreamErrorEvent.d.ts +1 -0
  182. package/lib/typescript/MediaStreamErrorEvent.d.ts.map +1 -0
  183. package/lib/typescript/MediaStreamEvent.d.ts +1 -0
  184. package/lib/typescript/MediaStreamEvent.d.ts.map +1 -0
  185. package/lib/typescript/MediaStreamTrack.d.ts +2 -1
  186. package/lib/typescript/MediaStreamTrack.d.ts.map +1 -0
  187. package/lib/typescript/MediaStreamTrackEvent.d.ts +17 -5
  188. package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -0
  189. package/lib/typescript/MessageEvent.d.ts +19 -6
  190. package/lib/typescript/MessageEvent.d.ts.map +1 -0
  191. package/lib/typescript/Permissions.d.ts +2 -1
  192. package/lib/typescript/Permissions.d.ts.map +1 -0
  193. package/lib/typescript/RTCDataChannel.d.ts +14 -4
  194. package/lib/typescript/RTCDataChannel.d.ts.map +1 -0
  195. package/lib/typescript/RTCDataChannelEvent.d.ts +17 -5
  196. package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -0
  197. package/lib/typescript/RTCErrorEvent.d.ts +5 -4
  198. package/lib/typescript/RTCErrorEvent.d.ts.map +1 -0
  199. package/lib/typescript/RTCEvent.d.ts +13 -3
  200. package/lib/typescript/RTCEvent.d.ts.map +1 -0
  201. package/lib/typescript/RTCIceCandidate.d.ts +8 -5
  202. package/lib/typescript/RTCIceCandidate.d.ts.map +1 -0
  203. package/lib/typescript/RTCIceCandidateEvent.d.ts +18 -3
  204. package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -0
  205. package/lib/typescript/RTCPeerConnection.d.ts +34 -10
  206. package/lib/typescript/RTCPeerConnection.d.ts.map +1 -0
  207. package/lib/typescript/RTCRtcpParameters.d.ts +1 -0
  208. package/lib/typescript/RTCRtcpParameters.d.ts.map +1 -0
  209. package/lib/typescript/RTCRtpCapabilities.d.ts +1 -0
  210. package/lib/typescript/RTCRtpCapabilities.d.ts.map +1 -0
  211. package/lib/typescript/RTCRtpCodecCapability.d.ts +1 -0
  212. package/lib/typescript/RTCRtpCodecCapability.d.ts.map +1 -0
  213. package/lib/typescript/RTCRtpCodecParameters.d.ts +1 -0
  214. package/lib/typescript/RTCRtpCodecParameters.d.ts.map +1 -0
  215. package/lib/typescript/RTCRtpEncodingParameters.d.ts +1 -0
  216. package/lib/typescript/RTCRtpEncodingParameters.d.ts.map +1 -0
  217. package/lib/typescript/RTCRtpHeaderExtension.d.ts +1 -0
  218. package/lib/typescript/RTCRtpHeaderExtension.d.ts.map +1 -0
  219. package/lib/typescript/RTCRtpParameters.d.ts +1 -0
  220. package/lib/typescript/RTCRtpParameters.d.ts.map +1 -0
  221. package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -0
  222. package/lib/typescript/RTCRtpReceiveParameters.d.ts.map +1 -0
  223. package/lib/typescript/RTCRtpReceiver.d.ts +1 -0
  224. package/lib/typescript/RTCRtpReceiver.d.ts.map +1 -0
  225. package/lib/typescript/RTCRtpSendParameters.d.ts +2 -1
  226. package/lib/typescript/RTCRtpSendParameters.d.ts.map +1 -0
  227. package/lib/typescript/RTCRtpSender.d.ts +1 -0
  228. package/lib/typescript/RTCRtpSender.d.ts.map +1 -0
  229. package/lib/typescript/RTCRtpTransceiver.d.ts +1 -0
  230. package/lib/typescript/RTCRtpTransceiver.d.ts.map +1 -0
  231. package/lib/typescript/RTCSessionDescription.d.ts +1 -0
  232. package/lib/typescript/RTCSessionDescription.d.ts.map +1 -0
  233. package/lib/typescript/RTCTrackEvent.d.ts +21 -6
  234. package/lib/typescript/RTCTrackEvent.d.ts.map +1 -0
  235. package/lib/typescript/RTCUtil.d.ts +1 -0
  236. package/lib/typescript/RTCUtil.d.ts.map +1 -0
  237. package/lib/typescript/RTCView.d.ts +1 -0
  238. package/lib/typescript/RTCView.d.ts.map +1 -0
  239. package/lib/typescript/ScreenCapturePickerView.d.ts +1 -0
  240. package/lib/typescript/ScreenCapturePickerView.d.ts.map +1 -0
  241. package/lib/typescript/getDisplayMedia.d.ts +1 -0
  242. package/lib/typescript/getDisplayMedia.d.ts.map +1 -0
  243. package/lib/typescript/getUserMedia.d.ts +1 -0
  244. package/lib/typescript/getUserMedia.d.ts.map +1 -0
  245. package/lib/typescript/index.d.ts +1 -0
  246. package/lib/typescript/index.d.ts.map +1 -0
  247. package/package.json +2 -4
  248. package/react-native-webrtc.podspec +1 -1
  249. package/src/MediaStream.ts +14 -4
  250. package/src/MediaStreamTrackEvent.ts +18 -4
  251. package/src/MessageEvent.ts +19 -5
  252. package/src/RTCDataChannel.ts +10 -8
  253. package/src/RTCDataChannelEvent.ts +21 -4
  254. package/src/RTCErrorEvent.ts +3 -3
  255. package/src/RTCEvent.ts +18 -4
  256. package/src/RTCIceCandidate.ts +7 -1
  257. package/src/RTCIceCandidateEvent.ts +19 -4
  258. package/src/RTCPeerConnection.ts +114 -52
  259. package/src/RTCTrackEvent.ts +25 -4
  260. package/src/index.ts +1 -2
package/README.md CHANGED
@@ -10,14 +10,14 @@ A WebRTC module for React Native.
10
10
 
11
11
  ## Feature Overview
12
12
 
13
- | | Android | iOS | macOS* | Windows* | Web* | Expo* |
14
- | :-: | :-------: | :---: | :-----: | :--------: | :----: | :-----: |
15
- | Audio/Video | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
16
- | Data Channels | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
17
- | Screen Capture | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
18
- | Plan B | - | - | - | - | - | - |
19
- | Unified Plan* | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
20
- | Simulcast* | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
13
+ | | Android | iOS | tvOS | macOS* | Windows* | Web* | Expo* |
14
+ | :- | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
15
+ | Audio/Video | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: |
16
+ | Data Channels | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
17
+ | Screen Capture | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
18
+ | Plan B | - | - | - | - | - | - | - |
19
+ | Unified Plan* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
20
+ | Simulcast* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: |
21
21
 
22
22
  > **macOS** - We don't currently actively support macOS at this time.
23
23
  Support might return in the future.
@@ -25,9 +25,10 @@ Support might return in the future.
25
25
  > **Windows** - We don't currently support the [react-native-windows](https://github.com/microsoft/react-native-windows) platform at this time.
26
26
  Anyone interested in getting the ball rolling? We're open to contributions.
27
27
 
28
- > **Web** - The [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for [react-native-web](https://github.com/necolas/react-native-web) support. 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.
28
+ > **Web** - The [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for [react-native-web](https://github.com/necolas/react-native-web) support.
29
+ Which will allow you to use [(almost)](https://github.com/react-native-webrtc/react-native-webrtc-web-shim/tree/main#setup) the exact same code in your [react-native-web](https://github.com/necolas/react-native-web) project as you would with [react-native](https://reactnative.dev/) directly.
29
30
 
30
- > **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default.
31
+ > **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default.
31
32
  However you can get things working via the [expo-dev-client](https://docs.expo.dev/development/getting-started/) library and out-of-tree [config-plugins/react-native-webrtc](https://github.com/expo/config-plugins/tree/master/packages/react-native-webrtc) package.
32
33
 
33
34
  > **Unified Plan** - As of version 106.0.0 Unified Plan is the only supported mode.
@@ -42,6 +43,7 @@ Software encode/decode factories have been enabled by default.
42
43
  * Supported architectures
43
44
  * Android: armeabi-v7a, arm64-v8a, x86, x86_64
44
45
  * iOS: arm64, x86_64
46
+ * tvOS: arm64
45
47
  * macOS: (temporarily disabled)
46
48
 
47
49
  ## Getting Started
@@ -57,6 +59,7 @@ Don't forget to follow platform guides below to cover any extra required steps.
57
59
 
58
60
  - [Android Install](./Documentation/AndroidInstallation.md)
59
61
  - [iOS Install](./Documentation/iOSInstallation.md)
62
+ - [tvOS Install](./Documentation/tvOSInstallation.md)
60
63
  - [Basic Usage](./Documentation/BasicUsage.md)
61
64
  - [Step by Step Call Guide](./Documentation/CallGuide.md)
62
65
  - [Improving Call Reliability](./Documentation/ImprovingCallReliability.md)
@@ -502,9 +502,27 @@ class PeerConnectionObserver implements PeerConnection.Observer {
502
502
  @Override
503
503
  public void onSignalingChange(PeerConnection.SignalingState signalingState) {
504
504
  ThreadUtils.runOnExecutor(() -> {
505
+ WritableMap newLocalSdpMap = Arguments.createMap();
506
+ WritableMap newRemoteSdpMap = Arguments.createMap();
507
+ SessionDescription newLocalSdp = peerConnection.getLocalDescription();
508
+ SessionDescription newRemoteSdp = peerConnection.getRemoteDescription();
509
+
510
+ if (newLocalSdp != null) {
511
+ newLocalSdpMap.putString("type", newLocalSdp.type.canonicalForm());
512
+ newLocalSdpMap.putString("sdp", newLocalSdp.description);
513
+ }
514
+
515
+ if (newRemoteSdp != null) {
516
+ newRemoteSdpMap.putString("type", newRemoteSdp.type.canonicalForm());
517
+ newRemoteSdpMap.putString("sdp", newRemoteSdp.description);
518
+ }
519
+
505
520
  WritableMap params = Arguments.createMap();
506
521
  params.putInt("pcId", id);
507
522
  params.putString("signalingState", signalingStateString(signalingState));
523
+ params.putMap("localSdp", newLocalSdpMap);
524
+ params.putMap("remoteSdp", newRemoteSdpMap);
525
+
508
526
  webRTCModule.sendEvent("peerConnectionSignalingStateChanged", params);
509
527
  });
510
528
  }
@@ -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
 
@@ -367,16 +367,20 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
367
367
  }
368
368
 
369
369
  @ReactMethod(isBlockingSynchronousMethod = true)
370
- public void peerConnectionInit(ReadableMap configuration, int id) {
370
+ public boolean peerConnectionInit(ReadableMap configuration, int id) {
371
371
  PeerConnection.RTCConfiguration rtcConfiguration = parseRTCConfiguration(configuration);
372
372
 
373
373
  try {
374
- ThreadUtils
374
+ return (boolean) ThreadUtils
375
375
  .submitToExecutor(() -> {
376
376
  PeerConnectionObserver observer = new PeerConnectionObserver(this, id);
377
377
  PeerConnection peerConnection = mFactory.createPeerConnection(rtcConfiguration, observer);
378
+ if (peerConnection == null) {
379
+ return false;
380
+ }
378
381
  observer.setPeerConnection(peerConnection);
379
382
  mPeerConnectionObservers.put(id, observer);
383
+ return true;
380
384
  })
381
385
  .get();
382
386
  } catch (ExecutionException | InterruptedException e) {
@@ -845,13 +849,16 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
845
849
  WritableArray transceiverUpdates = Arguments.createArray();
846
850
 
847
851
  for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
848
- RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
849
- if (direction == null) continue;
850
- String directionSerialized = SerializeUtils.serializeDirection(direction);
851
852
  WritableMap transceiverUpdate = Arguments.createMap();
853
+
854
+ RtpTransceiver.RtpTransceiverDirection direction = transceiver.getCurrentDirection();
855
+ if (direction != null) {
856
+ String directionSerialized = SerializeUtils.serializeDirection(direction);
857
+ transceiverUpdate.putString("currentDirection", directionSerialized);
858
+ }
859
+
852
860
  transceiverUpdate.putString("transceiverId", transceiver.getSender().id());
853
861
  transceiverUpdate.putString("mid", transceiver.getMid());
854
- transceiverUpdate.putString("currentDirection", directionSerialized);
855
862
  transceiverUpdate.putBoolean("isStopped", transceiver.isStopped());
856
863
  transceiverUpdate.putMap("senderRtpParameters",
857
864
  SerializeUtils.serializeRtpParameters(transceiver.getSender().getParameters()));
@@ -1003,17 +1010,7 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
1003
1010
  @Override
1004
1011
  public void onSetSuccess() {
1005
1012
  ThreadUtils.runOnExecutor(() -> {
1006
- WritableMap newSdpMap = Arguments.createMap();
1007
1013
  WritableMap params = Arguments.createMap();
1008
-
1009
- SessionDescription newSdp = peerConnection.getLocalDescription();
1010
- // Can happen when doing a rollback.
1011
- if (newSdp != null) {
1012
- newSdpMap.putString("type", newSdp.type.canonicalForm());
1013
- newSdpMap.putString("sdp", newSdp.description);
1014
- }
1015
-
1016
- params.putMap("sdpInfo", newSdpMap);
1017
1014
  params.putArray("transceiversInfo", getTransceiversInfo(peerConnection));
1018
1015
 
1019
1016
  promise.resolve(params);
@@ -1068,18 +1065,8 @@ public class WebRTCModule extends ReactContextBaseJavaModule {
1068
1065
  @Override
1069
1066
  public void onSetSuccess() {
1070
1067
  ThreadUtils.runOnExecutor(() -> {
1071
- WritableMap newSdpMap = Arguments.createMap();
1072
1068
  WritableMap params = Arguments.createMap();
1073
-
1074
- SessionDescription newSdp = peerConnection.getRemoteDescription();
1075
- // Be defensive for the rollback cases.
1076
- if (newSdp != null) {
1077
- newSdpMap.putString("type", newSdp.type.canonicalForm());
1078
- newSdpMap.putString("sdp", newSdp.description);
1079
- }
1080
-
1081
1069
  params.putArray("transceiversInfo", getTransceiversInfo(peerConnection));
1082
- params.putMap("sdpInfo", newSdpMap);
1083
1070
 
1084
1071
  WritableArray newTransceivers = Arguments.createArray();
1085
1072
  for (RtpTransceiver transceiver : peerConnection.getTransceivers()) {
@@ -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
@@ -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
@@ -29,12 +29,15 @@
29
29
  RTCAudioTrack *audioTrack = [self.peerConnectionFactory audioTrackWithTrackId:trackId];
30
30
  return audioTrack;
31
31
  }
32
-
33
32
  /**
34
33
  * Initializes a new {@link RTCVideoTrack} with the given capture controller
35
34
  */
36
35
  - (RTCVideoTrack *)createVideoTrackWithCaptureController:
37
36
  (CaptureController * (^)(RTCVideoSource *))captureControllerCreator {
37
+ #if TARGET_OS_TV
38
+ return nil;
39
+ #else
40
+
38
41
  RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
39
42
 
40
43
  NSString *trackUUID = [[NSUUID UUID] UUIDString];
@@ -45,14 +48,17 @@
45
48
  [captureController startCapture];
46
49
 
47
50
  return videoTrack;
51
+ #endif
48
52
  }
49
-
50
53
  /**
51
54
  * Initializes a new {@link RTCMediaTrack} with the given tracks.
52
55
  *
53
56
  * @return An array with the mediaStreamId in index 0, and track infos in index 1.
54
57
  */
55
58
  - (NSArray *)createMediaStream:(NSArray<RTCMediaStreamTrack *> *)tracks {
59
+ #if TARGET_OS_TV
60
+ return nil;
61
+ #else
56
62
  NSString *mediaStreamId = [[NSUUID UUID] UUIDString];
57
63
  RTCMediaStream *mediaStream = [self.peerConnectionFactory mediaStreamWithStreamId:mediaStreamId];
58
64
  NSMutableArray<NSDictionary *> *trackInfos = [NSMutableArray array];
@@ -91,12 +97,16 @@
91
97
 
92
98
  self.localStreams[mediaStreamId] = mediaStream;
93
99
  return @[ mediaStreamId, trackInfos ];
100
+ #endif
94
101
  }
95
102
 
96
103
  /**
97
104
  * Initializes a new {@link RTCVideoTrack} which satisfies the given constraints.
98
105
  */
99
106
  - (RTCVideoTrack *)createVideoTrack:(NSDictionary *)constraints {
107
+ #if TARGET_OS_TV
108
+ return nil;
109
+ #else
100
110
  RTCVideoSource *videoSource = [self.peerConnectionFactory videoSource];
101
111
 
102
112
  NSString *trackUUID = [[NSUUID UUID] UUIDString];
@@ -111,10 +121,11 @@
111
121
  #endif
112
122
 
113
123
  return videoTrack;
124
+ #endif
114
125
  }
115
126
 
116
127
  - (RTCVideoTrack *)createScreenCaptureVideoTrack {
117
- #if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX
128
+ #if TARGET_IPHONE_SIMULATOR || TARGET_OS_OSX || TARGET_OS_TV
118
129
  return nil;
119
130
  #endif
120
131
 
@@ -136,6 +147,11 @@
136
147
  }
137
148
 
138
149
  RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject) {
150
+ #if TARGET_OS_TV
151
+ reject(@"unsupported_platform", @"tvOS is not supported", nil);
152
+ return;
153
+ #else
154
+
139
155
  RTCVideoTrack *videoTrack = [self createScreenCaptureVideoTrack];
140
156
 
141
157
  if (videoTrack == nil) {
@@ -160,6 +176,7 @@ RCT_EXPORT_METHOD(getDisplayMedia : (RCTPromiseResolveBlock)resolve rejecter : (
160
176
 
161
177
  self.localStreams[mediaStreamId] = mediaStream;
162
178
  resolve(@{@"streamId" : mediaStreamId, @"track" : trackInfo});
179
+ #endif
163
180
  }
164
181
 
165
182
  /**
@@ -173,6 +190,10 @@ RCT_EXPORT_METHOD(getUserMedia
173
190
  : (NSDictionary *)constraints successCallback
174
191
  : (RCTResponseSenderBlock)successCallback errorCallback
175
192
  : (RCTResponseSenderBlock)errorCallback) {
193
+ #if TARGET_OS_TV
194
+ errorCallback(@[ @"PlatformNotSupported", @"getUserMedia is not supported on tvOS." ]);
195
+ return;
196
+ #else
176
197
  RTCAudioTrack *audioTrack = nil;
177
198
  RTCVideoTrack *videoTrack = nil;
178
199
 
@@ -231,11 +252,15 @@ RCT_EXPORT_METHOD(getUserMedia
231
252
 
232
253
  self.localStreams[mediaStreamId] = mediaStream;
233
254
  successCallback(@[ mediaStreamId, tracks ]);
255
+ #endif
234
256
  }
235
257
 
236
258
  #pragma mark - Other stream related APIs
237
259
 
238
260
  RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
261
+ #if TARGET_OS_TV
262
+ callback(@[]);
263
+ #else
239
264
  NSMutableArray *devices = [NSMutableArray array];
240
265
  AVCaptureDeviceDiscoverySession *videoevicesSession =
241
266
  [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
@@ -277,6 +302,7 @@ RCT_EXPORT_METHOD(enumerateDevices : (RCTResponseSenderBlock)callback) {
277
302
  }];
278
303
  }
279
304
  callback(@[ devices ]);
305
+ #endif
280
306
  }
281
307
 
282
308
  RCT_EXPORT_METHOD(mediaStreamCreate : (nonnull NSString *)streamID) {
@@ -334,12 +360,17 @@ RCT_EXPORT_METHOD(mediaStreamRelease : (nonnull NSString *)streamID) {
334
360
  }
335
361
 
336
362
  RCT_EXPORT_METHOD(mediaStreamTrackRelease : (nonnull NSString *)trackID) {
363
+ #if TARGET_OS_TV
364
+ return;
365
+ #else
366
+
337
367
  RTCMediaStreamTrack *track = self.localTracks[trackID];
338
368
  if (track) {
339
369
  track.isEnabled = NO;
340
370
  [track.captureController stopCapture];
341
371
  [self.localTracks removeObjectForKey:trackID];
342
372
  }
373
+ #endif
343
374
  }
344
375
 
345
376
  RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnull NSString *)trackID : (BOOL)enabled) {
@@ -349,6 +380,7 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
349
380
  }
350
381
 
351
382
  track.isEnabled = enabled;
383
+ #if !TARGET_OS_TV
352
384
  if (track.captureController) { // It could be a remote track!
353
385
  if (enabled) {
354
386
  [track.captureController startCapture];
@@ -356,14 +388,19 @@ RCT_EXPORT_METHOD(mediaStreamTrackSetEnabled : (nonnull NSNumber *)pcId : (nonnu
356
388
  [track.captureController stopCapture];
357
389
  }
358
390
  }
391
+ #endif
359
392
  }
360
393
 
361
394
  RCT_EXPORT_METHOD(mediaStreamTrackSwitchCamera : (nonnull NSString *)trackID) {
395
+ #if TARGET_OS_TV
396
+ return;
397
+ #else
362
398
  RTCMediaStreamTrack *track = self.localTracks[trackID];
363
399
  if (track) {
364
400
  RTCVideoTrack *videoTrack = (RTCVideoTrack *)track;
365
401
  [(VideoCaptureController *)videoTrack.captureController switchCamera];
366
402
  }
403
+ #endif
367
404
  }
368
405
 
369
406
  RCT_EXPORT_METHOD(mediaStreamTrackSetVolume : (nonnull NSNumber *)pcId : (nonnull NSString *)trackID : (double)volume) {
@@ -76,13 +76,19 @@ int _transceiverNextId = 0;
76
76
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(peerConnectionInit
77
77
  : (RTCConfiguration *)configuration objectID
78
78
  : (nonnull NSNumber *)objectID) {
79
+ __block BOOL ret = YES;
80
+
79
81
  dispatch_sync(self.workerQueue, ^{
80
- NSDictionary *optionalConstraints = @{@"DtlsSrtpKeyAgreement" : @"true"};
81
- RTCMediaConstraints *constraints =
82
- [[RTCMediaConstraints alloc] initWithMandatoryConstraints:nil optionalConstraints:optionalConstraints];
82
+ RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:nil
83
+ optionalConstraints:nil];
83
84
  RTCPeerConnection *peerConnection = [self.peerConnectionFactory peerConnectionWithConfiguration:configuration
84
85
  constraints:constraints
85
86
  delegate:self];
87
+ if (peerConnection == nil) {
88
+ ret = NO;
89
+ return;
90
+ }
91
+
86
92
  peerConnection.dataChannels = [NSMutableDictionary new];
87
93
  peerConnection.reactTag = objectID;
88
94
  peerConnection.remoteStreams = [NSMutableDictionary new];
@@ -93,7 +99,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(peerConnectionInit
93
99
  self.peerConnections[objectID] = peerConnection;
94
100
  });
95
101
 
96
- return nil;
102
+ return @(ret);
97
103
  }
98
104
 
99
105
  RCT_EXPORT_METHOD(peerConnectionSetConfiguration
@@ -202,14 +208,7 @@ RCT_EXPORT_METHOD(peerConnectionSetLocalDescription
202
208
  if (error) {
203
209
  reject(@"E_OPERATION_ERROR", error.localizedDescription, nil);
204
210
  } else {
205
- NSMutableDictionary *sdpInfo = [NSMutableDictionary new];
206
- RTCSessionDescription *localDesc = peerConnection.localDescription;
207
- if (localDesc) {
208
- sdpInfo[@"type"] = [RTCSessionDescription stringForType:localDesc.type];
209
- sdpInfo[@"sdp"] = localDesc.sdp;
210
- }
211
211
  id data = @{
212
- @"sdpInfo" : sdpInfo,
213
212
  @"transceiversInfo" :
214
213
  [SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection]
215
214
  };
@@ -257,14 +256,7 @@ RCT_EXPORT_METHOD(peerConnectionSetRemoteDescription
257
256
  }
258
257
  }
259
258
 
260
- NSMutableDictionary *sdpInfo = [NSMutableDictionary new];
261
- RTCSessionDescription *remoteDesc = peerConnection.remoteDescription;
262
- if (remoteDesc) {
263
- sdpInfo[@"type"] = [RTCSessionDescription stringForType:remoteDesc.type];
264
- sdpInfo[@"sdp"] = remoteDesc.sdp;
265
- }
266
259
  id data = @{
267
- @"sdpInfo" : sdpInfo,
268
260
  @"transceiversInfo" :
269
261
  [SerializeUtils constructTransceiversInfoArrayWithPeerConnection:peerConnection],
270
262
  @"newTransceivers" : newTransceivers
@@ -732,10 +724,29 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(peerConnectionRemoveTrack
732
724
 
733
725
  - (void)peerConnection:(RTCPeerConnection *)peerConnection didChangeSignalingState:(RTCSignalingState)newState {
734
726
  dispatch_async(self.workerQueue, ^{
727
+ id newLocalSdp = @{};
728
+ id newRemoteSdp = @{};
729
+
730
+ if (peerConnection.localDescription) {
731
+ newLocalSdp = @{
732
+ @"type" : [RTCSessionDescription stringForType:peerConnection.localDescription.type],
733
+ @"sdp" : peerConnection.localDescription.sdp
734
+ };
735
+ }
736
+
737
+ if (peerConnection.remoteDescription) {
738
+ newRemoteSdp = @{
739
+ @"type" : [RTCSessionDescription stringForType:peerConnection.remoteDescription.type],
740
+ @"sdp" : peerConnection.remoteDescription.sdp
741
+ };
742
+ }
743
+
735
744
  [self sendEventWithName:kEventPeerConnectionSignalingStateChanged
736
745
  body:@{
737
746
  @"pcId" : peerConnection.reactTag,
738
- @"signalingState" : [self stringForSignalingState:newState]
747
+ @"signalingState" : [self stringForSignalingState:newState],
748
+ @"localSdp" : newLocalSdp,
749
+ @"remoteSdp" : newRemoteSdp
739
750
  }];
740
751
  });
741
752
  }
@@ -40,6 +40,7 @@
40
40
  self = [super init];
41
41
  if (self) {
42
42
  WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
43
+ id<RTCAudioDevice> audioDevice = options.audioDevice;
43
44
  id<RTCVideoDecoderFactory> decoderFactory = options.videoDecoderFactory;
44
45
  id<RTCVideoEncoderFactory> encoderFactory = options.videoEncoderFactory;
45
46
  NSDictionary *fieldTrials = options.fieldTrials;
@@ -69,7 +70,8 @@
69
70
  RCTLogInfo(@"Using video decoder factory: %@", NSStringFromClass([decoderFactory class]));
70
71
 
71
72
  _peerConnectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
72
- decoderFactory:decoderFactory];
73
+ decoderFactory:decoderFactory
74
+ audioDevice:audioDevice];
73
75
 
74
76
  _peerConnections = [NSMutableDictionary new];
75
77
  _localStreams = [NSMutableDictionary new];
@@ -7,6 +7,7 @@ NS_ASSUME_NONNULL_BEGIN
7
7
 
8
8
  @property(nonatomic, strong, nullable) id<RTCVideoDecoderFactory> videoDecoderFactory;
9
9
  @property(nonatomic, strong, nullable) id<RTCVideoEncoderFactory> videoEncoderFactory;
10
+ @property(nonatomic, strong, nullable) id<RTCAudioDevice> audioDevice;
10
11
  @property(nonatomic, strong, nullable) NSDictionary *fieldTrials;
11
12
  @property(nonatomic, assign) RTCLoggingSeverity loggingSeverity;
12
13
 
@@ -17,6 +17,7 @@
17
17
 
18
18
  - (instancetype)init {
19
19
  if (self = [super init]) {
20
+ self.audioDevice = nil;
20
21
  self.fieldTrials = nil;
21
22
  self.videoEncoderFactory = nil;
22
23
  self.videoDecoderFactory = nil;
@@ -196,6 +196,7 @@
196
196
  35A222171CB493700015FD5C /* Project object */ = {
197
197
  isa = PBXProject;
198
198
  attributes = {
199
+ LastSwiftUpdateCheck = 1420;
199
200
  LastUpgradeCheck = 0720;
200
201
  TargetAttributes = {
201
202
  35A2221E1CB493700015FD5C = {