Skip to content

Commit

Permalink
Merge pull request #12700 from prlanzarin/u24-gum-store
Browse files Browse the repository at this point in the history
Webcams: reduce number of gUM calls, refactor in video-preview, fix #9053
  • Loading branch information
pedrobmarin committed Jul 5, 2021
2 parents f1d8853 + d8dae1e commit 6264cac
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 197 deletions.
15 changes: 3 additions & 12 deletions bigbluebutton-html5/imports/ui/components/screenshare/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import Meetings from '/imports/api/meetings';
import Auth from '/imports/ui/services/auth';
import UserListService from '/imports/ui/components/user-list/service';
import AudioService from '/imports/ui/components/audio/service';
import {Meteor} from "meteor/meteor";
import { Meteor } from "meteor/meteor";
import MediaStreamUtils from '/imports/utils/media-stream-utils';

const SCREENSHARE_MEDIA_ELEMENT_NAME = 'screenshareVideo';

Expand Down Expand Up @@ -88,16 +89,6 @@ 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 @@ -115,7 +106,7 @@ const shareScreen = async (onFail) => {

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

0 comments on commit 6264cac

Please sign in to comment.