setPermissionRequestHandler

external fun setPermissionRequestHandler(handler: (webContents: WebContents, permission: SessionSetPermissionRequestHandlerHandlerPermission, callback: (permissionGranted: Boolean) -> Unit, details: Any) -> Unit?)(source)

Sets the handler which can be used to respond to permission requests for the session. Calling callback(true) will allow the permission and callback(false) will reject it. To clear the handler, call setPermissionRequestHandler(null). Please note that you must also implement setPermissionCheckHandler to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.

Both media and display-capture requests carry a MediaAccessPermissionRequest as details. A media request is for camera and/or microphone devices, while a display-capture request is for the screen, a window or a tab (whether made through getDisplayMedia or through getUserMedia with chromeMediaSource constraints). Applications that allow camera and microphone access but want to control screen sharing separately should handle the two permissions individually: