bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/deskshare/service.js
2017-02-23 19:00:20 +00:00

48 lines
1.3 KiB
JavaScript
Executable File

import Deskshare from '/imports/api/deskshare';
import {vertoWatchVideo} from '/imports/api/verto';
import Auth from '/imports/ui/services/auth';
// when the meeting information has been updated check to see if it was
// desksharing. If it has changed either trigger a call to receive video
// and display it, or end the call and hide the video
function isVideoBroadcasting() {
const ds = Deskshare.findOne({});
if (ds == null || !ds.broadcasting) {
console.log('Deskshare broadcasting has ended');
return false;
} else {
console.log("DS isnt empty");
}
if (ds.broadcasting) {
console.log('Deskshare is now broadcasting');
if (ds.startedBy != Auth.userID) {
console.log('deskshare wasn\'t initiated by me');
return true;
} else {
console.log("ending DS");
return false;
}
} else {
console.log("DS int broadcasting");
return false;
}
}
// if remote deskshare has been ended disconnect and hide the video stream
function presenterDeskshareHasEnded() {
vertoExitVideo();
console.log("presenterDeskshareHasEnded");
};
// if remote deskshare has been started connect and display the video stream
function presenterDeskshareHasStarted() {
vertoWatchVideo();
console.log("presenterDeskshareHasStarted");
};
export {
isVideoBroadcasting, presenterDeskshareHasEnded, presenterDeskshareHasStarted,
};