Closed hjh006 closed 8 years ago
How did you solved this ?
@manish-1988 hello there , hope this can help you
(RTCVideoTrack *)createLocalVideoTrackBackCamera {
RTCVideoTrack *localVideoTrack = nil;
//AVCaptureDevicePositionBack
NSString *cameraID = nil;
for (AVCaptureDevice *captureDevice in
[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) {
if (captureDevice.position == AVCaptureDevicePositionBack) {
cameraID = [captureDevice localizedName];
break;
}
}
NSAssert(cameraID, @"Unable to get the back camera id");
RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:cameraID];
RTCMediaConstraints *mediaConstraints = [self defaultMediaStreamConstraints];
RTCVideoSource *videoSource = [_factory videoSourceWithCapturer:capturer constraints:mediaConstraints];
localVideoTrack = [_factory videoTrackWithID:@"ARDAMSv0" source:videoSource];
return localVideoTrack;
}
(RTCMediaConstraints *)defaultMediaStreamConstraints {
NSArray *mandatoryConstraints = @[
[[RTCPair alloc] initWithKey:@"maxWidth" value:@"1280"],
[[RTCPair alloc] initWithKey:@"minWidth" value:@"1280"],
[[RTCPair alloc] initWithKey:@"maxHeight" value:@"720"],
[[RTCPair alloc] initWithKey:@"minHeight" value:@"720"],
[[RTCPair alloc] initWithKey:@"maxFrameRate" value:@"30"],
[[RTCPair alloc] initWithKey:@"minFrameRate" value:@"15"]
];
RTCMediaConstraints* constraints =
[[RTCMediaConstraints alloc]
initWithMandatoryConstraints:mandatoryConstraints
optionalConstraints:nil];
return constraints;
}
How can I set up and change the resolution of local video? thx