Skip to content

Commit

Permalink
Merge pull request #772 from jerry2013/patch-3
Browse files Browse the repository at this point in the history
actually request permission
  • Loading branch information
hthetiot authored May 12, 2023
2 parents 69a162f + 108d39f commit 24d2021
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/iosrtcPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,9 @@ class iosrtcPlugin : CDVPlugin {
switch AVCaptureDevice.authorizationStatus(for: AVMediaType.video) {
case AVAuthorizationStatus.notDetermined:
NSLog("PluginGetUserMedia#call() | video authorization: not determined")
AVCaptureDevice.requestAccess(for:.video) { granted in
status = granted
}
case AVAuthorizationStatus.restricted:
NSLog("PluginGetUserMedia#call() | video authorization: restricted")
case AVAuthorizationStatus.denied:
Expand All @@ -1239,13 +1242,16 @@ class iosrtcPlugin : CDVPlugin {
if audioRequested == true {
switch AVCaptureDevice.authorizationStatus(for: AVMediaType.audio) {
case AVAuthorizationStatus.notDetermined:
NSLog("PluginGetUserMedia#call() | video authorization: not determined")
NSLog("PluginGetUserMedia#call() | audio authorization: not determined")
AVCaptureDevice.requestAccess(for:.audio) { granted in
status = granted
}
case AVAuthorizationStatus.restricted:
NSLog("PluginGetUserMedia#call() | video authorization: restricted")
NSLog("PluginGetUserMedia#call() | audio authorization: restricted")
case AVAuthorizationStatus.denied:
NSLog("PluginGetUserMedia#call() | video authorization: denied")
NSLog("PluginGetUserMedia#call() | audio authorization: denied")
case AVAuthorizationStatus.authorized:
NSLog("PluginGetUserMedia#call() | video authorization: authorized")
NSLog("PluginGetUserMedia#call() | audio authorization: authorized")
status = true
}
}
Expand Down

0 comments on commit 24d2021

Please sign in to comment.