protected override void IOSRequestAccess(Action <AuthorizationStatus> callback)
 {
     ISN_AVCaptureDevice.RequestAccess(ISN_AVMediaType.Video, (status) => {
         if (status == ISN_AVAuthorizationStatus.Authorized)
         {
             callback.Invoke(AuthorizationStatus.Granted);
         }
         else
         {
             callback.Invoke(AuthorizationStatus.Denied);
         }
     });
 }
Пример #2
0
        //--------------------------------------
        // Public Methods
        //--------------------------------------

        /// <summary>
        /// Presents a view controller modally.
        ///
        /// If you configured the view controller to use <see cref="ISN_UIImagePickerControllerSourceType.Camera"/>,
        /// the <see cref="ISN_AVMediaType.Video"/> permission will be checked automatically,
        /// before presenting view controller. You can always do this yourself using the
        /// <see cref="ISN_AVCaptureDevice.RequestAccess"/>
        /// </summary>
        /// <param name="callback">Callback.</param>
        public void Present(Action <ISN_UIPickerControllerResult> callback)
        {
            //Need to make sure we have a permission for that
            if (m_request.m_sourceType == ISN_UIImagePickerControllerSourceType.Camera)
            {
                ISN_AVCaptureDevice.RequestAccess(ISN_AVMediaType.Video, (status) => {
                    if (status == ISN_AVAuthorizationStatus.Authorized)
                    {
                        StartPresenting(callback);
                    }
                    else
                    {
                        var error  = new SA_Error(1, "AVMediaType.Video Permission is missing");
                        var result = new ISN_UIPickerControllerResult(error);
                        callback.Invoke(result);
                    }
                });
            }
            else
            {
                StartPresenting(callback);
            }
        }