-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathreact-native-webrtc+1.75.3.patch
70 lines (62 loc) · 2.97 KB
/
react-native-webrtc+1.75.3.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/node_modules/react-native-webrtc/RTCUtil.js b/node_modules/react-native-webrtc/RTCUtil.js
index 8beb4f0..7adda7b 100644
--- a/node_modules/react-native-webrtc/RTCUtil.js
+++ b/node_modules/react-native-webrtc/RTCUtil.js
@@ -72,7 +72,8 @@ function normalizeMediaConstraints(constraints, mediaType) {
facingMode: extractString(constraints, 'facingMode'),
frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),
height: extractNumber(constraints.mandatory, 'minHeight'),
- width: extractNumber(constraints.mandatory, 'minWidth')
+ width: extractNumber(constraints.mandatory, 'minWidth'),
+ ar: !!constraints.ar,
};
} else {
// New style.
@@ -81,7 +82,8 @@ function normalizeMediaConstraints(constraints, mediaType) {
facingMode: extractString(constraints, 'facingMode'),
frameRate: extractNumber(constraints, 'frameRate'),
height: extractNumber(constraints, 'height'),
- width: extractNumber(constraints, 'width')
+ width: extractNumber(constraints, 'width'),
+ ar: !!constraints.ar,
};
}
diff --git a/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m b/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m
index 06063dd..02c9137 100644
--- a/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m
+++ b/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m
@@ -16,6 +16,11 @@
@implementation WebRTCModule (RTCMediaStream)
+static RTCVideoSource *_arVideSource = nil;
++ (RTCVideoSource *)arVideoSource {
+ return _arVideSource;
+}
+
#pragma mark - getUserMedia
/**
@@ -40,6 +45,10 @@ - (RTCVideoTrack *)createVideoTrack:(NSDictionary *)constraints {
NSString *trackUUID = [[NSUUID UUID] UUIDString];
RTCVideoTrack *videoTrack = [self.peerConnectionFactory videoTrackWithSource:videoSource trackId:trackUUID];
+
+ if ([constraints[@"video"][@"ar"] boolValue]) {
+ _arVideSource = videoSource;
+ } else {
#if !TARGET_IPHONE_SIMULATOR
RTCCameraVideoCapturer *videoCapturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:videoSource];
VideoCaptureController *videoCaptureController
@@ -48,6 +57,7 @@ - (RTCVideoTrack *)createVideoTrack:(NSDictionary *)constraints {
videoTrack.videoCaptureController = videoCaptureController;
[videoCaptureController startCapture];
#endif
+ }
return videoTrack;
}
diff --git a/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule.h b/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule.h
index ec0c14b..a6624de 100644
--- a/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule.h
+++ b/node_modules/react-native-webrtc/ios/RCTWebRTC/WebRTCModule.h
@@ -34,4 +34,6 @@
- (RTCMediaStream*)streamForReactTag:(NSString*)reactTag;
++ (RTCVideoSource *)arVideoSource;
+
@end