Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing the stop sharing, hide window on chrome desktop capture

Whenever we use chrome desktop capture to record our screen from a chrome extension, we get the following window at the bottom. It provides option to stop screen sharing or hide screen sharing Stop/Hide Screen sharing

I am developing an extension to start and stop desktop recording. I want this window to disappear when the user clicks on "Stop" button of my extension. What is the way to do it?

I have tried passing the request id to this API chrome.desktopCapture.cancelChooseDesktopMedia(pending_request_id), but that did not seem to work.

like image 368
Abhinit Modi Avatar asked Dec 19 '22 19:12

Abhinit Modi


1 Answers

to hide the chrome stop sharing bar, all you need to do is stop the related mediastream( i.e by stopping all it's mediatracks), e.g you could assign the action to any element's onclick:

element.onclick = () => screenStream.getTracks().forEach(track => track.stop())
like image 57
mido Avatar answered Dec 28 '22 08:12

mido