2016-05-27 04:01:49 +08:00
|
|
|
import Deskshare from '/imports/api/deskshare';
|
2016-07-23 03:20:00 +08:00
|
|
|
import {createVertoUserName, watchVertoVideo} from '/imports/api/verto';
|
2016-06-02 21:46:35 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2016-05-28 00:17:16 +08:00
|
|
|
import {getVoiceBridge} from '/imports/api/phone';
|
2016-05-07 04:15:47 +08:00
|
|
|
|
|
|
|
// 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 videoIsBroadcasting() {
|
|
|
|
const ds = Deskshare.findOne({});
|
|
|
|
if (ds == null || !ds.broadcasting) {
|
|
|
|
console.log('Deskshare broadcasting has ended');
|
|
|
|
presenterDeskshareHasEnded();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ds.broadcasting) {
|
|
|
|
console.log('Deskshare is now broadcasting');
|
2016-07-11 21:45:24 +08:00
|
|
|
if (ds.startedBy != Auth.userID) {
|
2016-05-07 04:15:47 +08:00
|
|
|
console.log('deskshare wasn\'t initiated by me');
|
|
|
|
presenterDeskshareHasStarted();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
presenterDeskshareHasEnded();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if remote deskshare has been ended disconnect and hide the video stream
|
|
|
|
function presenterDeskshareHasEnded() {
|
|
|
|
// exitVoiceCall();
|
|
|
|
};
|
|
|
|
|
|
|
|
// if remote deskshare has been started connect and display the video stream
|
|
|
|
function presenterDeskshareHasStarted() {
|
2016-06-22 01:38:28 +08:00
|
|
|
vertoWatchVideo();
|
2016-05-07 04:15:47 +08:00
|
|
|
};
|
|
|
|
|
2016-05-31 01:21:30 +08:00
|
|
|
export {
|
|
|
|
videoIsBroadcasting, presenterDeskshareHasEnded, presenterDeskshareHasStarted
|
2016-05-07 04:15:47 +08:00
|
|
|
};
|