[Question] Capturing external screen-share cancel event
kNoAPP opened this issue · comments
During screen-share, many browsers (including Chrome) open a secondary dialog box that includes a "Stop sharing" button. When this button is pressed, how do I capture the stop-share event so that I can update the UI accordingly and/or invoke LiveKit's unpublish/dispose operations? My "Stop sharing" button inside the Flutter app that invokes LiveKit's SDK is working great. When I trigger a stop-share from the Flutter app (and LiveKit SDK), it works just fine.
However, stop-sharing triggered from this external Chrome button doesn't unpublish the video/audio track automatically. I am left with a black box local to the sharer and remote-participants see the share-screen freeze. The TrackUnsubscribedEvent
and TrackUnpublishedEvent
are NOT called for remote participants even when ConnectOptions(autoSubscribe: true)
. So how do I handle this button?
good find, we may need to emit a ScreenCaptureStopedEvent
by listening to screenVideoTrack.ended
Your fix works perfectly in my app, thank you!