apache / apache/cordova-plugin-media
Detection of missing microphone access permission
- Dominant language
- JavaScript
- Stars
- 391
- Forks
- 762
- PR merge metrics
- No merged PRs in 30d
Description
# Feature Request
## Motivation Behind Feature
When using the plugin for recording some audio, the user probably denied accessing the microphone (by using the operation system's permission system). Currently there seems to be no explicit way to detect his. `onError` doesn't inform the developer about the denied permission request.
## Feature Description
When accessing the microphone, the user get's a permission request from by the OS. If the user denies the request, the `onError` observable should inform the user about the issue when trying to use the device's microphone.
## Workaround
To detect issues with recording the audio, it's possible to check the media's status after e.g. 1 second.
If there are some issues with starting the recording, the status stays at `MEDIA_NONE` (instead of switching to `MEDIA_RUNNING`).
```js
this.mediaObject.onStatusUpdate.subscribe(status => {
this.mediaObjectStatus = status;
});
this.mediaObject.startRecord();
// Check the media's status after 1 second.
setTimeout(() => {
if (this.mediaObjectStatus === this.media.MEDIA_NONE) {
alert('Recording failed. Please check the permissions for accessing the microphone');
}
}, 1000);
```
Contributor guide
Research direction
Start by tracing the microphone access path called by startRecord() and how failures reach the onError observable, then compare it with the MEDIA_NONE status path described in the issue. Done means a denied microphone permission produces an explicit onError notification while recording behavior remains correct across the supported mobile platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100