how to get microphone permission when button is clicked in extension popup

navigator.mediaDevices.getUserMedia({
                                audio: {
                                    echoCancellation: !0,
                                    channelCount: 1,
                                    sampleRate: {
                                        ideal: e
                                    },
                                    sampleSize: i
                                }
                            })

it return promise value Rejected and promise status DOM:Shutdown

Record current tab in chrome using chrome extension and getUserMedia()

I am trying to make a Chrome extension to record user activity in the current tab.

I found out that I can use getUserMedia() on the front, and chrome.desktopCapture in my background script.

However, when I try to use chrome.desktopCapture.chooseDesktopMedia([‘tab’], onApproved), I get prompted for the tab I want to share. However, I would like to skip this step and share my current tab without the prompt.

I know that this can be done, because in the Screencastify Chrome extension, you can do that. The first option is to record the current tab and no popups are displayed.

What is the correct way to handle native cancelling of getUserMedia screenshare?

I am using screenshare with getUserMedia for a web application I am developing.

I am currently using Chrome with a Chrome extension using the API below to achieve the functionality, but the functionality is also possible in Firefox and may become natively available(I believe it was possible in the past) via getDisplayMedia or other means in the future.
https://developer.chrome.com/extensions/desktopCapture

During screenshare, a native dialog is shown at the bottom of the browser to stop the screenshare. I would like for a way to handle this event, but I am unaware of a common, standard way to achieve this. Is there an appropriate way to do this(preferably in all APIs), or should I achieve this by track events?

Video capture only selected area via Chrome Extension

I’m trying to write an Chrome Extension which allows user to select an area on screen and then captures video of that area only.
I read everything about chrome.desktopCapture API and about getUserMedia(), but I can’t find an option for it, it seems like it allows only capturing of whole screen.
Is there any alternate way to do this via Chrome Extension?
Basically, input from user is coordinates of top left angle and the dimension of area will always be the same.