Detecting press on "stop screen sharing"

This commit is contained in:
David Négrier 2020-08-20 22:23:38 +02:00
parent 1162439479
commit dc36af19bc

View File

@ -186,6 +186,14 @@ export class MediaManager {
return this._startScreenCapture() return this._startScreenCapture()
.then((stream: MediaStream) => { .then((stream: MediaStream) => {
this.localScreenCapture = stream; this.localScreenCapture = stream;
// If stream ends (for instance if user clicks the stop screen sharing button in the browser), let's close the view
for (const track of stream.getTracks()) {
track.onended = () => {
this.disableScreenSharing();
};
}
return stream; return stream;
}) })
.catch((err: unknown) => { .catch((err: unknown) => {