Media Actions
os.getMediaPermission(options: MediaPermissionOptions): Promise<any>
Gets permission from user to access audio and/or video streams from the device.
Returns a promise that resolves if the user grants the specified media permission(s). If the user blocks permission or has previously blocked permission or any other problem occurs, an error will be thrown.
The first parameter is a MediaPermissionOptions and is the options that should be used for requesting media permissions. At least one of
audio
orvideo
must be set totrue
.Examples
Get permission for the device's microphone.try {
await os.getMediaPermission({ audio: true });
} catch (e) {
console.error('Could not get permission for microphone:', e);
}Get permission for the device's microphone and camera.try {
await os.getMediaPermission({ audio: true, video: true });
} catch (e) {
console.error('Could not get permission for microphone and/or camera:', e);
}