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

54 lines
1.6 KiB
JavaScript
Raw Normal View History

import Screenshare from '/imports/api/screenshare';
import KurentoBridge from '/imports/api/screenshare/client/bridge';
import Settings from '/imports/ui/services/settings';
// when the meeting information has been updated check to see if it was
// screensharing. If it has changed either trigger a call to receive video
// and display it, or end the call and hide the video
const isVideoBroadcasting = () => {
const ds = Screenshare.findOne({});
2017-07-26 04:56:40 +08:00
if (!ds) {
return false;
}
2019-03-09 03:41:19 +08:00
return !!ds.screenshare.stream;
};
// if remote screenshare has been ended disconnect and hide the video stream
const presenterScreenshareHasEnded = () => {
// references a function in the global namespace inside kurento-extension.js
// that we load dynamically
KurentoBridge.kurentoExitVideo();
2019-03-09 03:41:19 +08:00
};
// if remote screenshare has been started connect and display the video stream
const presenterScreenshareHasStarted = () => {
// references a function in the global namespace inside kurento-extension.js
// that we load dynamically
KurentoBridge.kurentoWatchVideo();
2019-03-09 03:41:19 +08:00
};
const shareScreen = (onFail) => {
KurentoBridge.kurentoShareScreen(onFail);
2019-03-09 03:41:19 +08:00
};
2017-09-13 04:47:06 +08:00
const screenShareEndAlert = () => new Audio(`${Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename}/resources/sounds/ScreenshareOff.mp3`).play();
const unshareScreen = () => {
KurentoBridge.kurentoExitScreenShare();
screenShareEndAlert();
2019-03-09 03:41:19 +08:00
};
const dataSavingSetting = () => Settings.dataSaving.viewScreenshare;
export {
2019-03-09 03:41:19 +08:00
isVideoBroadcasting,
presenterScreenshareHasEnded,
presenterScreenshareHasStarted,
shareScreen,
screenShareEndAlert,
unshareScreen,
dataSavingSetting,
};