# "Screen Share Stopped" Event in Chrome

**URL:** https://discourse.lynckia.com/t/screen-share-stopped-event-in-chrome/58
**Category:** Uncategorized
**Created:** [April 7, 2014, 9:13pm UTC](https://discourse.lynckia.com/t/screen-share-stopped-event-in-chrome/58 "2014-04-07T21:13:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan\_Warden](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Jonathan\_Warden](https://discourse.lynckia.com/u/Jonathan_Warden)
#### Post date: [April 7, 2014, 9:13pm UTC](https://discourse.lynckia.com/t/screen-share-stopped-event-in-chrome/58/1 "2014-04-07T21:13:05Z")

</div>

I’d like my online classroom application to react when the users presses  
the “Stop Sharing” button in the floating window that Chrome displays when  
a user is sharing their screen.

Right now, when the user presses this button, it looks to all the  
suscribers like the stream is still open, it just stops updating. I would  
instead like to update the UI for both the publisher ("you have stopped  
sharing your screen. Click here to start again…) and the subscribers.

Is there an event I can listen on the Room or Stream object? Or some other  
way to make this happen?

---

<div class="post-metadata">

### Author: ![yasser](https://avatars.discourse-cdn.com/v4/letter/y/5f9b8f/32.png) [@yasser](https://discourse.lynckia.com/u/yasser)
#### Post date: [August 1, 2018, 9:59am UTC](https://discourse.lynckia.com/t/screen-share-stopped-event-in-chrome/58/2 "2018-08-01T09:59:31Z")

</div>

You have to listen to the stream ended event on the screenStream

when your screenStream receives the event access-accepted, it gets the stream stream property on which you can listen to events

screenStream.addEventListener(“access-accepted”, () =\> {  
…  
screenStream.stream.getVideoTracks()[0].addEventListener(‘ended’, () =\>{  
//do whatever you want here and unpublish the stream  
room.unpublish(screenStream);  
});  
});
