Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1720 from SimonErm/feature/addVideoOrientationOption
Browse files Browse the repository at this point in the history
add video orientation option
  • Loading branch information
jgfidelis committed Sep 6, 2018
2 parents d4b4ee1 + ee92cab commit ace99ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ios/RN/RNCamera.m
Expand Up @@ -471,8 +471,14 @@ - (void)record:(NSDictionary *)options resolve:(RCTPromiseResolveBlock)resolve r
[connection setPreferredVideoStabilizationMode:self.videoStabilizationMode];
}
}
[connection setVideoOrientation:[RNCameraUtils videoOrientationForDeviceOrientation:[[UIDevice currentDevice] orientation]]];

int orientation;
if ([options[@"orientation"] integerValue]) {
orientation = [options[@"orientation"] integerValue];
} else {
orientation = [RNCameraUtils videoOrientationForDeviceOrientation:[[UIDevice currentDevice] orientation]];
}
[connection setVideoOrientation:orientation];

if (options[@"codec"]) {
if (@available(iOS 10, *)) {
AVVideoCodecType videoCodecType = options[@"codec"];
Expand Down
4 changes: 4 additions & 0 deletions src/RNCamera.js
Expand Up @@ -66,6 +66,7 @@ type TrackedTextFeature = {
type RecordingOptions = {
maxDuration?: number,
maxFileSize?: number,
orientation?: Orientation,
quality?: number | string,
codec?: string,
mute?: boolean,
Expand Down Expand Up @@ -287,6 +288,9 @@ export default class Camera extends React.Component<PropsType, StateType> {
} else if (typeof options.quality === 'string') {
options.quality = Camera.Constants.VideoQuality[options.quality];
}
if (typeof options.orientation=== 'string') {
options.orientation = CameraManager.Orientation[options.orientation];
}
return await CameraManager.record(options, this._cameraHandle);
}

Expand Down

0 comments on commit ace99ff

Please sign in to comment.