Wakgood
Wakgood

Reputation: 11

How does agora RTC detect user push Stop Sharing button on Chrome?

I want to unpublish user's published shared screen when the publisher presses the Stop Sharing button on Chrome. For remote users, the shared stream is removed, but for local user it remains as a black screen. How can I detect the Stop Sharing for local user and removed stream accordingly?

I tried considering onended and oninactive functions, but I am not sure if it is working for agora RTC.

Upvotes: 0

Views: 372

Answers (1)

Wakgood
Wakgood

Reputation: 11

I just figured out how to do it!

stream.on('track-ended', () => {
    unpublishScreen(); // literally a function that unpublishes the video
}); // stream is a video object published by agora rtc

Upvotes: 0

Related Questions