summaryrefslogtreecommitdiff
path: root/platform/iphone/camera_ios.mm
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2019-07-06 15:48:51 +1000
committerBastiaan Olij <mux213@gmail.com>2019-07-06 15:48:51 +1000
commit776dc935711198b020869aa8b2b4a540cfb30df5 (patch)
tree433ba352f08461088c565820f3619555d141317a /platform/iphone/camera_ios.mm
parentd897131ac555de84afe9ca6845abf87c26957895 (diff)
Add microphone privilege settings support back into export and add privilege exist check to camera server for iOS
Diffstat (limited to 'platform/iphone/camera_ios.mm')
-rw-r--r--platform/iphone/camera_ios.mm16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/iphone/camera_ios.mm b/platform/iphone/camera_ios.mm
index 5a54eaee9b..029ce6debf 100644
--- a/platform/iphone/camera_ios.mm
+++ b/platform/iphone/camera_ios.mm
@@ -397,6 +397,22 @@ void CameraIOS::update_feeds() {
};
CameraIOS::CameraIOS() {
+ // check if we have our usage description
+ NSString *usage_desc = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSCameraUsageDescription"];
+ if (usage_desc == NULL) {
+ // don't initialise if we don't get anything
+ print_line("No NSCameraUsageDescription key in pList, no access to cameras.");
+ return;
+ } else if (usage_desc.length == 0) {
+ // don't initialise if we don't get anything
+ print_line("Empty NSCameraUsageDescription key in pList, no access to cameras.");
+ return;
+ }
+
+ // now we'll request access.
+ // If this is the first time the user will be prompted with the string (iOS will read it).
+ // Once a decision is made it is returned. If the user wants to change it later on they
+ // need to go into setting.
print_line("Requesting Camera permissions");
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo