How to listen for "Stop sharing" click in Chrome DesktopCapture API
I solved this issue by assigning an EventHandler on the videoTrack's onended
property:
// somebody clicked on "Stop sharing"
stream.getVideoTracks()[0].onended = function () {
// doWhatYouNeedToDo();
};
As far as my edit goes (noticing a closing window): it also fires the event.
Now we have oninactive, You can use like this
stream.oninactive = () => {}