react-native-webrtc 106.0.4 → 106.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 (92) hide show
  1. package/.clang-format +11 -0
  2. package/.github/workflows/android_ci.yml +29 -0
  3. package/.github/workflows/ci.yml +1 -1
  4. package/.github/workflows/ios_ci.yml +50 -0
  5. package/LICENSE +2 -1
  6. package/android/src/main/java/com/oney/WebRTCModule/AbstractVideoCaptureController.java +11 -1
  7. package/android/src/main/java/com/oney/WebRTCModule/CameraCaptureController.java +7 -15
  8. package/android/src/main/java/com/oney/WebRTCModule/CameraEventsHandler.java +4 -13
  9. package/android/src/main/java/com/oney/WebRTCModule/DataChannelWrapper.java +12 -16
  10. package/android/src/main/java/com/oney/WebRTCModule/DisplayUtils.java +1 -1
  11. package/android/src/main/java/com/oney/WebRTCModule/EglUtils.java +1 -1
  12. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +37 -47
  13. package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +123 -116
  14. package/android/src/main/java/com/oney/WebRTCModule/RTCVideoViewManager.java +60 -61
  15. package/android/src/main/java/com/oney/WebRTCModule/ReactBridgeUtil.java +1 -2
  16. package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +12 -9
  17. package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +116 -121
  18. package/android/src/main/java/com/oney/WebRTCModule/StringUtils.java +8 -14
  19. package/android/src/main/java/com/oney/WebRTCModule/ThreadUtils.java +1 -2
  20. package/android/src/main/java/com/oney/WebRTCModule/TrackCapturerEventsEmitter.java +34 -0
  21. package/android/src/main/java/com/oney/WebRTCModule/VideoTrackAdapter.java +5 -9
  22. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +383 -378
  23. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModulePackage.java +4 -10
  24. package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +74 -98
  25. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/ProcessorProvider.java +10 -9
  26. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +2 -6
  27. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessorFactoryInterface.java +4 -5
  28. package/ios/RCTWebRTC/CaptureController.h +4 -8
  29. package/ios/RCTWebRTC/CaptureController.m +0 -7
  30. package/ios/RCTWebRTC/CapturerEventsDelegate.h +12 -0
  31. package/ios/RCTWebRTC/DataChannelWrapper.h +9 -13
  32. package/ios/RCTWebRTC/DataChannelWrapper.m +4 -5
  33. package/ios/RCTWebRTC/RCTConvert+WebRTC.h +2 -2
  34. package/ios/RCTWebRTC/RCTConvert+WebRTC.m +166 -171
  35. package/ios/RCTWebRTC/RTCMediaStreamTrack+React.h +1 -1
  36. package/ios/RCTWebRTC/RTCMediaStreamTrack+React.m +1 -1
  37. package/ios/RCTWebRTC/RTCVideoViewManager.h +0 -8
  38. package/ios/RCTWebRTC/RTCVideoViewManager.m +207 -239
  39. package/ios/RCTWebRTC/ScreenCaptureController.h +3 -9
  40. package/ios/RCTWebRTC/ScreenCaptureController.m +20 -15
  41. package/ios/RCTWebRTC/ScreenCapturePickerViewManager.h +0 -7
  42. package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +26 -34
  43. package/ios/RCTWebRTC/ScreenCapturer.h +4 -8
  44. package/ios/RCTWebRTC/ScreenCapturer.m +57 -55
  45. package/ios/RCTWebRTC/SerializeUtils.h +16 -16
  46. package/ios/RCTWebRTC/SerializeUtils.m +98 -99
  47. package/ios/RCTWebRTC/SocketConnection.h +1 -8
  48. package/ios/RCTWebRTC/SocketConnection.m +31 -38
  49. package/ios/RCTWebRTC/TrackCapturerEventsEmitter.h +14 -0
  50. package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +37 -0
  51. package/ios/RCTWebRTC/VideoCaptureController.h +6 -7
  52. package/ios/RCTWebRTC/VideoCaptureController.m +54 -53
  53. package/ios/RCTWebRTC/WebRTCModule+Permissions.m +14 -13
  54. package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.h +3 -3
  55. package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.m +105 -100
  56. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +8 -0
  57. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +218 -173
  58. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.h +7 -14
  59. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +625 -595
  60. package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +128 -139
  61. package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.h +4 -5
  62. package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.m +26 -35
  63. package/ios/RCTWebRTC/WebRTCModule.h +14 -20
  64. package/ios/RCTWebRTC/WebRTCModule.m +69 -83
  65. package/ios/RCTWebRTC.xcodeproj/project.pbxproj +10 -1
  66. package/ios/RCTWebRTC.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  67. package/lib/commonjs/EventEmitter.js +1 -1
  68. package/lib/commonjs/EventEmitter.js.map +1 -1
  69. package/lib/commonjs/MediaStreamTrack.js +25 -0
  70. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  71. package/lib/commonjs/RTCPeerConnection.js +169 -162
  72. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  73. package/lib/commonjs/RTCRtpTransceiver.js +1 -1
  74. package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
  75. package/lib/module/EventEmitter.js +1 -1
  76. package/lib/module/EventEmitter.js.map +1 -1
  77. package/lib/module/MediaStreamTrack.js +21 -0
  78. package/lib/module/MediaStreamTrack.js.map +1 -1
  79. package/lib/module/RTCPeerConnection.js +169 -162
  80. package/lib/module/RTCPeerConnection.js.map +1 -1
  81. package/lib/module/RTCRtpTransceiver.js +1 -1
  82. package/lib/module/RTCRtpTransceiver.js.map +1 -1
  83. package/lib/typescript/MediaStreamTrack.d.ts +1 -0
  84. package/lib/typescript/RTCPeerConnection.d.ts +5 -4
  85. package/package.json +3 -2
  86. package/src/EventEmitter.ts +1 -0
  87. package/src/MediaStreamTrack.ts +23 -0
  88. package/src/RTCPeerConnection.ts +168 -174
  89. package/src/RTCRtpTransceiver.ts +1 -1
  90. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  91. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  92. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -1,210 +1,205 @@
1
- #import "RCTConvert+WebRTC.h"
2
1
  #import <React/RCTLog.h>
3
2
  #import <WebRTC/RTCDataChannelConfiguration.h>
4
3
  #import <WebRTC/RTCIceServer.h>
5
4
  #import <WebRTC/RTCSessionDescription.h>
5
+ #import "RCTConvert+WebRTC.h"
6
6
 
7
7
  @implementation RCTConvert (WebRTC)
8
8
 
9
- + (RTCSessionDescription *)RTCSessionDescription:(id)json
10
- {
11
- if (!json) {
12
- return nil;
13
- }
9
+ + (RTCSessionDescription *)RTCSessionDescription:(id)json {
10
+ if (!json) {
11
+ return nil;
12
+ }
14
13
 
15
- if (![json isKindOfClass:[NSDictionary class]]) {
16
- RCTLogConvertError(json, @"must be an object");
17
- return nil;
18
- }
14
+ if (![json isKindOfClass:[NSDictionary class]]) {
15
+ RCTLogConvertError(json, @"must be an object");
16
+ return nil;
17
+ }
19
18
 
20
- if (json[@"sdp"] == nil) {
21
- RCTLogConvertError(json, @".sdp must not be null");
22
- return nil;
23
- }
19
+ if (json[@"sdp"] == nil) {
20
+ RCTLogConvertError(json, @".sdp must not be null");
21
+ return nil;
22
+ }
24
23
 
25
- NSString *sdp = json[@"sdp"];
26
- RTCSdpType sdpType = [RTCSessionDescription typeForString:json[@"type"]];
24
+ NSString *sdp = json[@"sdp"];
25
+ RTCSdpType sdpType = [RTCSessionDescription typeForString:json[@"type"]];
27
26
 
28
- return [[RTCSessionDescription alloc] initWithType:sdpType sdp:sdp];
27
+ return [[RTCSessionDescription alloc] initWithType:sdpType sdp:sdp];
29
28
  }
30
29
 
31
- + (RTCIceCandidate *)RTCIceCandidate:(id)json
32
- {
33
- if (!json) {
34
- RCTLogConvertError(json, @"must not be null");
35
- return nil;
36
- }
30
+ + (RTCIceCandidate *)RTCIceCandidate:(id)json {
31
+ if (!json) {
32
+ RCTLogConvertError(json, @"must not be null");
33
+ return nil;
34
+ }
37
35
 
38
- if (![json isKindOfClass:[NSDictionary class]]) {
39
- RCTLogConvertError(json, @"must be an object");
40
- return nil;
41
- }
36
+ if (![json isKindOfClass:[NSDictionary class]]) {
37
+ RCTLogConvertError(json, @"must be an object");
38
+ return nil;
39
+ }
42
40
 
43
- if (json[@"candidate"] == nil) {
44
- RCTLogConvertError(json, @".candidate must not be null");
45
- return nil;
46
- }
47
-
48
- if (json[@"sdpMid"] == nil) {
49
- RCTLogConvertError(json, @".sdpMid must not be null");
50
- return nil;
51
- }
41
+ if (json[@"candidate"] == nil) {
42
+ RCTLogConvertError(json, @".candidate must not be null");
43
+ return nil;
44
+ }
52
45
 
53
- if (json[@"sdpMLineIndex"] == nil) {
54
- RCTLogConvertError(json, @".sdpMLineIndex must not be null");
55
- return nil;
56
- }
46
+ if (json[@"sdpMid"] == nil) {
47
+ RCTLogConvertError(json, @".sdpMid must not be null");
48
+ return nil;
49
+ }
57
50
 
58
- NSString *sdp = json[@"candidate"];
59
- RCTLogTrace(@"%@ <- candidate", sdp);
60
- int sdpMLineIndex = [RCTConvert int:json[@"sdpMLineIndex"]];
61
- NSString *sdpMid = json[@"sdpMid"];
51
+ if (json[@"sdpMLineIndex"] == nil) {
52
+ RCTLogConvertError(json, @".sdpMLineIndex must not be null");
53
+ return nil;
54
+ }
62
55
 
56
+ NSString *sdp = json[@"candidate"];
57
+ RCTLogTrace(@"%@ <- candidate", sdp);
58
+ int sdpMLineIndex = [RCTConvert int:json[@"sdpMLineIndex"]];
59
+ NSString *sdpMid = json[@"sdpMid"];
63
60
 
64
- return [[RTCIceCandidate alloc] initWithSdp:sdp sdpMLineIndex:sdpMLineIndex sdpMid:sdpMid];
61
+ return [[RTCIceCandidate alloc] initWithSdp:sdp sdpMLineIndex:sdpMLineIndex sdpMid:sdpMid];
65
62
  }
66
63
 
67
- + (RTCIceServer *)RTCIceServer:(id)json
68
- {
69
- if (!json) {
70
- RCTLogConvertError(json, @"a valid iceServer value");
71
- return nil;
72
- }
64
+ + (RTCIceServer *)RTCIceServer:(id)json {
65
+ if (!json) {
66
+ RCTLogConvertError(json, @"a valid iceServer value");
67
+ return nil;
68
+ }
73
69
 
74
- if (![json isKindOfClass:[NSDictionary class]]) {
75
- RCTLogConvertError(json, @"must be an object");
76
- return nil;
77
- }
78
-
79
- NSArray<NSString *> *urls;
80
- if ([json[@"urls"] isKindOfClass:[NSString class]]) {
81
- urls = @[json[@"urls"]];
82
- } else {
83
- urls = [RCTConvert NSArray:json[@"urls"]];
84
- }
85
-
86
- if (json[@"username"] != nil || json[@"credential"] != nil) {
87
- return [[RTCIceServer alloc]initWithURLStrings:urls
88
- username:json[@"username"]
89
- credential:json[@"credential"]];
90
- }
91
-
92
- return [[RTCIceServer alloc] initWithURLStrings:urls];
70
+ if (![json isKindOfClass:[NSDictionary class]]) {
71
+ RCTLogConvertError(json, @"must be an object");
72
+ return nil;
73
+ }
74
+
75
+ NSArray<NSString *> *urls;
76
+ if ([json[@"urls"] isKindOfClass:[NSString class]]) {
77
+ urls = @[ json[@"urls"] ];
78
+ } else {
79
+ urls = [RCTConvert NSArray:json[@"urls"]];
80
+ }
81
+
82
+ if (json[@"username"] != nil || json[@"credential"] != nil) {
83
+ return [[RTCIceServer alloc] initWithURLStrings:urls username:json[@"username"] credential:json[@"credential"]];
84
+ }
85
+
86
+ return [[RTCIceServer alloc] initWithURLStrings:urls];
93
87
  }
94
88
 
95
- + (nonnull RTCConfiguration *)RTCConfiguration:(id)json
96
- {
97
- RTCConfiguration *config = [[RTCConfiguration alloc] init];
89
+ + (nonnull RTCConfiguration *)RTCConfiguration:(id)json {
90
+ RTCConfiguration *config = [[RTCConfiguration alloc] init];
98
91
 
99
- // Required for perfect negotiation.
100
- config.enableImplicitRollback = YES;
92
+ // Required for perfect negotiation.
93
+ config.enableImplicitRollback = YES;
101
94
 
102
- config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
95
+ config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
103
96
 
104
- if (!json) {
105
- return config;
106
- }
97
+ if (!json) {
98
+ return config;
99
+ }
107
100
 
108
- if (![json isKindOfClass:[NSDictionary class]]) {
109
- RCTLogConvertError(json, @"must be an object");
110
- return config;
111
- }
112
-
113
- if (json[@"audioJitterBufferMaxPackets"] != nil && [json[@"audioJitterBufferMaxPackets"] isKindOfClass:[NSNumber class]]) {
114
- config.audioJitterBufferMaxPackets = [RCTConvert int:json[@"audioJitterBufferMaxPackets"]];
115
- }
116
-
117
- if (json[@"bundlePolicy"] != nil && [json[@"bundlePolicy"] isKindOfClass:[NSString class]]) {
118
- NSString *bundlePolicy = json[@"bundlePolicy"];
119
- if ([bundlePolicy isEqualToString:@"balanced"]) {
120
- config.bundlePolicy = RTCBundlePolicyBalanced;
121
- } else if ([bundlePolicy isEqualToString:@"max-compat"]) {
122
- config.bundlePolicy = RTCBundlePolicyMaxCompat;
123
- } else if ([bundlePolicy isEqualToString:@"max-bundle"]) {
124
- config.bundlePolicy = RTCBundlePolicyMaxBundle;
125
- }
126
- }
127
-
128
- if (json[@"iceBackupCandidatePairPingInterval"] != nil && [json[@"iceBackupCandidatePairPingInterval"] isKindOfClass:[NSNumber class]]) {
129
- config.iceBackupCandidatePairPingInterval = [RCTConvert int:json[@"iceBackupCandidatePairPingInterval"]];
130
- }
131
-
132
- if (json[@"iceConnectionReceivingTimeout"] != nil && [json[@"iceConnectionReceivingTimeout"] isKindOfClass:[NSNumber class]]) {
133
- config.iceConnectionReceivingTimeout = [RCTConvert int:json[@"iceConnectionReceivingTimeout"]];
134
- }
135
-
136
- if (json[@"iceServers"] != nil && [json[@"iceServers"] isKindOfClass:[NSArray class]]) {
137
- NSMutableArray<RTCIceServer *> *iceServers = [NSMutableArray new];
138
- for (id server in json[@"iceServers"]) {
139
- RTCIceServer *convert = [RCTConvert RTCIceServer:server];
140
- if (convert != nil) {
141
- [iceServers addObject:convert];
142
- }
143
- }
144
- config.iceServers = iceServers;
145
- }
146
-
147
- if (json[@"iceTransportPolicy"] != nil && [json[@"iceTransportPolicy"] isKindOfClass:[NSString class]]) {
148
- NSString *iceTransportPolicy = json[@"iceTransportPolicy"];
149
- if ([iceTransportPolicy isEqualToString:@"all"]) {
150
- config.iceTransportPolicy = RTCIceTransportPolicyAll;
151
- } else if ([iceTransportPolicy isEqualToString:@"none"]) {
152
- config.iceTransportPolicy = RTCIceTransportPolicyNone;
153
- } else if ([iceTransportPolicy isEqualToString:@"nohost"]) {
154
- config.iceTransportPolicy = RTCIceTransportPolicyNoHost;
155
- } else if ([iceTransportPolicy isEqualToString:@"relay"]) {
156
- config.iceTransportPolicy = RTCIceTransportPolicyRelay;
157
- }
158
- }
159
-
160
- if (json[@"rtcpMuxPolicy"] != nil && [json[@"rtcpMuxPolicy"] isKindOfClass:[NSString class]]) {
161
- NSString *rtcpMuxPolicy = json[@"rtcpMuxPolicy"];
162
- if ([rtcpMuxPolicy isEqualToString:@"negotiate"]) {
163
- config.rtcpMuxPolicy = RTCRtcpMuxPolicyNegotiate;
164
- } else if ([rtcpMuxPolicy isEqualToString:@"require"]) {
165
- config.rtcpMuxPolicy = RTCRtcpMuxPolicyRequire;
166
- }
167
- }
168
-
169
- if (json[@"tcpCandidatePolicy"] != nil && [json[@"tcpCandidatePolicy"] isKindOfClass:[NSString class]]) {
170
- NSString *tcpCandidatePolicy = json[@"tcpCandidatePolicy"];
171
- if ([tcpCandidatePolicy isEqualToString:@"enabled"]) {
172
- config.tcpCandidatePolicy = RTCTcpCandidatePolicyEnabled;
173
- } else if ([tcpCandidatePolicy isEqualToString:@"disabled"]) {
174
- config.tcpCandidatePolicy = RTCTcpCandidatePolicyDisabled;
175
- }
176
- }
177
-
178
- return config;
179
- }
101
+ if (![json isKindOfClass:[NSDictionary class]]) {
102
+ RCTLogConvertError(json, @"must be an object");
103
+ return config;
104
+ }
180
105
 
181
- + (RTCDataChannelConfiguration *)RTCDataChannelConfiguration:(id)json
182
- {
183
- if (!json) {
184
- return nil;
185
- }
186
- if ([json isKindOfClass:[NSDictionary class]]) {
187
- RTCDataChannelConfiguration *init = [RTCDataChannelConfiguration new];
106
+ if (json[@"audioJitterBufferMaxPackets"] != nil &&
107
+ [json[@"audioJitterBufferMaxPackets"] isKindOfClass:[NSNumber class]]) {
108
+ config.audioJitterBufferMaxPackets = [RCTConvert int:json[@"audioJitterBufferMaxPackets"]];
109
+ }
110
+
111
+ if (json[@"bundlePolicy"] != nil && [json[@"bundlePolicy"] isKindOfClass:[NSString class]]) {
112
+ NSString *bundlePolicy = json[@"bundlePolicy"];
113
+ if ([bundlePolicy isEqualToString:@"balanced"]) {
114
+ config.bundlePolicy = RTCBundlePolicyBalanced;
115
+ } else if ([bundlePolicy isEqualToString:@"max-compat"]) {
116
+ config.bundlePolicy = RTCBundlePolicyMaxCompat;
117
+ } else if ([bundlePolicy isEqualToString:@"max-bundle"]) {
118
+ config.bundlePolicy = RTCBundlePolicyMaxBundle;
119
+ }
120
+ }
188
121
 
189
- if (json[@"id"]) {
190
- [init setChannelId:[RCTConvert int:json[@"id"]]];
122
+ if (json[@"iceBackupCandidatePairPingInterval"] != nil &&
123
+ [json[@"iceBackupCandidatePairPingInterval"] isKindOfClass:[NSNumber class]]) {
124
+ config.iceBackupCandidatePairPingInterval = [RCTConvert int:json[@"iceBackupCandidatePairPingInterval"]];
191
125
  }
192
126
 
193
- if (json[@"ordered"]) {
194
- init.isOrdered = [RCTConvert BOOL:json[@"ordered"]];
127
+ if (json[@"iceConnectionReceivingTimeout"] != nil &&
128
+ [json[@"iceConnectionReceivingTimeout"] isKindOfClass:[NSNumber class]]) {
129
+ config.iceConnectionReceivingTimeout = [RCTConvert int:json[@"iceConnectionReceivingTimeout"]];
195
130
  }
196
- if (json[@"maxRetransmits"]) {
197
- init.maxRetransmits = [RCTConvert int:json[@"maxRetransmits"]];
131
+
132
+ if (json[@"iceServers"] != nil && [json[@"iceServers"] isKindOfClass:[NSArray class]]) {
133
+ NSMutableArray<RTCIceServer *> *iceServers = [NSMutableArray new];
134
+ for (id server in json[@"iceServers"]) {
135
+ RTCIceServer *convert = [RCTConvert RTCIceServer:server];
136
+ if (convert != nil) {
137
+ [iceServers addObject:convert];
138
+ }
139
+ }
140
+ config.iceServers = iceServers;
141
+ }
142
+
143
+ if (json[@"iceTransportPolicy"] != nil && [json[@"iceTransportPolicy"] isKindOfClass:[NSString class]]) {
144
+ NSString *iceTransportPolicy = json[@"iceTransportPolicy"];
145
+ if ([iceTransportPolicy isEqualToString:@"all"]) {
146
+ config.iceTransportPolicy = RTCIceTransportPolicyAll;
147
+ } else if ([iceTransportPolicy isEqualToString:@"none"]) {
148
+ config.iceTransportPolicy = RTCIceTransportPolicyNone;
149
+ } else if ([iceTransportPolicy isEqualToString:@"nohost"]) {
150
+ config.iceTransportPolicy = RTCIceTransportPolicyNoHost;
151
+ } else if ([iceTransportPolicy isEqualToString:@"relay"]) {
152
+ config.iceTransportPolicy = RTCIceTransportPolicyRelay;
153
+ }
154
+ }
155
+
156
+ if (json[@"rtcpMuxPolicy"] != nil && [json[@"rtcpMuxPolicy"] isKindOfClass:[NSString class]]) {
157
+ NSString *rtcpMuxPolicy = json[@"rtcpMuxPolicy"];
158
+ if ([rtcpMuxPolicy isEqualToString:@"negotiate"]) {
159
+ config.rtcpMuxPolicy = RTCRtcpMuxPolicyNegotiate;
160
+ } else if ([rtcpMuxPolicy isEqualToString:@"require"]) {
161
+ config.rtcpMuxPolicy = RTCRtcpMuxPolicyRequire;
162
+ }
163
+ }
164
+
165
+ if (json[@"tcpCandidatePolicy"] != nil && [json[@"tcpCandidatePolicy"] isKindOfClass:[NSString class]]) {
166
+ NSString *tcpCandidatePolicy = json[@"tcpCandidatePolicy"];
167
+ if ([tcpCandidatePolicy isEqualToString:@"enabled"]) {
168
+ config.tcpCandidatePolicy = RTCTcpCandidatePolicyEnabled;
169
+ } else if ([tcpCandidatePolicy isEqualToString:@"disabled"]) {
170
+ config.tcpCandidatePolicy = RTCTcpCandidatePolicyDisabled;
171
+ }
198
172
  }
199
- if (json[@"negotiated"]) {
200
- init.isNegotiated = [RCTConvert NSInteger:json[@"negotiated"]];
173
+
174
+ return config;
175
+ }
176
+
177
+ + (RTCDataChannelConfiguration *)RTCDataChannelConfiguration:(id)json {
178
+ if (!json) {
179
+ return nil;
201
180
  }
202
- if (json[@"protocol"]) {
203
- init.protocol = [RCTConvert NSString:json[@"protocol"]];
181
+ if ([json isKindOfClass:[NSDictionary class]]) {
182
+ RTCDataChannelConfiguration *init = [RTCDataChannelConfiguration new];
183
+
184
+ if (json[@"id"]) {
185
+ [init setChannelId:[RCTConvert int:json[@"id"]]];
186
+ }
187
+
188
+ if (json[@"ordered"]) {
189
+ init.isOrdered = [RCTConvert BOOL:json[@"ordered"]];
190
+ }
191
+ if (json[@"maxRetransmits"]) {
192
+ init.maxRetransmits = [RCTConvert int:json[@"maxRetransmits"]];
193
+ }
194
+ if (json[@"negotiated"]) {
195
+ init.isNegotiated = [RCTConvert NSInteger:json[@"negotiated"]];
196
+ }
197
+ if (json[@"protocol"]) {
198
+ init.protocol = [RCTConvert NSString:json[@"protocol"]];
199
+ }
200
+ return init;
204
201
  }
205
- return init;
206
- }
207
- return nil;
202
+ return nil;
208
203
  }
209
204
 
210
205
  @end
@@ -5,6 +5,6 @@
5
5
 
6
6
  @interface RTCMediaStreamTrack (React)
7
7
 
8
- @property (strong, nonatomic) CaptureController *captureController;
8
+ @property(strong, nonatomic) CaptureController *captureController;
9
9
 
10
10
  @end
@@ -1,7 +1,7 @@
1
1
  #import <objc/runtime.h>
2
2
 
3
- #import "RTCMediaStreamTrack+React.h"
4
3
  #import "CaptureController.h"
4
+ #import "RTCMediaStreamTrack+React.h"
5
5
 
6
6
  @implementation RTCMediaStreamTrack (React)
7
7
 
@@ -1,11 +1,3 @@
1
- //
2
- // RTCVideoViewManager.h
3
- // TestReact
4
- //
5
- // Created by one on 2015/9/25.
6
- // Copyright © 2015年 Facebook. All rights reserved.
7
- //
8
-
9
1
  #import <Foundation/Foundation.h>
10
2
  #import <React/RCTViewManager.h>
11
3