Skip to content

Commit

Permalink
Merge pull request #11730 from prlanzarin/u23-clcxb
Browse files Browse the repository at this point in the history
screenshare: check if the user is still presenter after gDM resolves
  • Loading branch information
antobinary committed Mar 24, 2021
2 parents a950c9a + 1e19909 commit 8e251ef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bigbluebutton-html5/imports/ui/components/screenshare/service.js
Expand Up @@ -88,6 +88,16 @@ const attachLocalPreviewStream = (mediaElement) => {
}
}

const stopStreamTracks = (stream) => {
if (stream && typeof stream.getTracks === 'function') {
stream.getTracks().forEach(track => {
if (typeof track.stop === 'function') {
track.stop();
}
});
}
}

const screenshareHasStarted = () => {
// Presenter's screen preview is local, so skip
if (!UserListService.amIPresenter()) {
Expand All @@ -105,6 +115,7 @@ const shareScreen = async (onFail) => {

try {
const stream = await BridgeService.getScreenStream();
if(!UserListService.isUserPresenter(Auth.userID)) return stopStreamTracks(stream);
await KurentoBridge.share(stream, onFail);
setSharingScreen(true);
} catch (error) {
Expand Down

0 comments on commit 8e251ef

Please sign in to comment.