bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/deskshare/service.js

55 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-05-27 04:01:49 +08:00
import Deskshare from '/imports/api/deskshare';
2016-05-28 00:17:16 +08:00
import {conferenceUsername, joinVertoAudio, watchVertoVideo} from '/imports/api/verto';
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');
if (ds.startedBy != Auth.getUser()) {
2016-05-07 04:15:47 +08:00
console.log('deskshare wasn\'t initiated by me');
presenterDeskshareHasStarted();
return true;
} else {
presenterDeskshareHasEnded();
return false;
}
}
}
2016-05-27 04:03:45 +08:00
function watchDeskshare(options) {
2016-05-28 00:17:16 +08:00
const extension = options.extension || getVoiceBridge();
const conferenceUsername = createVertoUserName();
2016-05-07 04:15:47 +08:00
conferenceIdNumber = '1009';
2016-05-27 04:03:45 +08:00
watchVertoVideo({ extension, conferenceUsername, conferenceIdNumber,
2016-05-28 00:34:03 +08:00
watchOnly: true, });
2016-05-07 04:15:47 +08:00
}
// 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() {
const voiceBridge = Deskshare.findOne().deskshare.voiceBridge;
2016-05-27 04:03:45 +08:00
watchDeskshare({
watchOnly: true,
extension: voiceBridge,
});
2016-05-07 04:15:47 +08:00
};
export { videoIsBroadcasting, watchDeskshare, presenterDeskshareHasEnded,
presenterDeskshareHasStarted
};