Skip to content

Commit

Permalink
[camera][ios] Video mirroring feature addition (expo#7016)
Browse files Browse the repository at this point in the history
* add setVideoMirrored property

* add docs

* update changelog

* rename setVideoMirrored to mirror
  • Loading branch information
cruzach committed Feb 14, 2020
1 parent 0ec3c9c commit f6dcc0d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions build/Camera.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export declare type RecordingOptions = {
maxFileSize?: number;
quality?: number | string;
mute?: boolean;
mirror?: boolean;
};
export declare type CapturedPicture = {
width: number;
Expand Down
2 changes: 1 addition & 1 deletion build/Camera.types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ios/EXCamera/EXCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ - (void)record:(NSDictionary *)options resolve:(UMPromiseResolveBlock)resolve re
}
[connection setVideoOrientation:[EXCameraUtils videoOrientationForDeviceOrientation:[[UIDevice currentDevice] orientation]]];

bool canBeMirrored = connection.isVideoMirroringSupported;
bool shouldBeMirrored = options[@"mirror"] && [options[@"mirror"] boolValue];
if (canBeMirrored && shouldBeMirrored) {
[connection setVideoMirrored:shouldBeMirrored];
}

UM_WEAKIFY(self);
dispatch_async(self.sessionQueue, ^{
UM_STRONGIFY(self);
Expand Down
1 change: 1 addition & 0 deletions src/Camera.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type RecordingOptions = {
maxFileSize?: number;
quality?: number | string;
mute?: boolean;
mirror?: boolean;
};

export type CapturedPicture = {
Expand Down

0 comments on commit f6dcc0d

Please sign in to comment.