2017-10-12 10:00:28 +08:00
|
|
|
import Screenshare from '/imports/api/screenshare';
|
|
|
|
import VertoBridge from '/imports/api/screenshare/client/bridge';
|
2017-11-11 11:41:37 +08:00
|
|
|
import KurentoBridge from '/imports/api/screenshare/client/bridge';
|
2017-07-25 03:29:34 +08:00
|
|
|
import PresentationService from '/imports/ui/components/presentation/service';
|
|
|
|
|
|
|
|
// 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
|
2017-11-06 23:39:55 +08:00
|
|
|
const isVideoBroadcasting = () => {
|
2017-07-25 03:29:34 +08:00
|
|
|
const ds = Screenshare.findOne({});
|
|
|
|
|
2017-07-26 04:56:40 +08:00
|
|
|
if (!ds) {
|
|
|
|
return false;
|
|
|
|
}
|
2017-09-09 01:00:00 +08:00
|
|
|
|
2017-11-06 23:39:55 +08:00
|
|
|
// TODO commented out isPresenter to enable screen viewing to the presenter
|
|
|
|
return ds.screenshare.stream; // && !PresentationService.isPresenter();
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// if remote screenshare has been ended disconnect and hide the video stream
|
2017-11-06 23:39:55 +08:00
|
|
|
const presenterScreenshareHasEnded = () => {
|
2017-09-09 01:00:00 +08:00
|
|
|
// references a function in the global namespace inside kurento-extension.js
|
2017-07-25 03:29:34 +08:00
|
|
|
// that we load dynamically
|
2017-09-09 01:00:00 +08:00
|
|
|
KurentoBridge.kurentoExitVideo();
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// if remote screenshare has been started connect and display the video stream
|
2017-11-06 23:39:55 +08:00
|
|
|
const presenterScreenshareHasStarted = () => {
|
2017-09-09 01:00:00 +08:00
|
|
|
// references a function in the global namespace inside kurento-extension.js
|
2017-07-25 03:29:34 +08:00
|
|
|
// that we load dynamically
|
2017-09-09 01:00:00 +08:00
|
|
|
//VertoBridge.vertoWatchVideo();
|
|
|
|
KurentoBridge.kurentoWatchVideo();
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
|
|
|
|
2017-09-13 04:47:06 +08:00
|
|
|
const shareScreen = () => {
|
|
|
|
KurentoBridge.kurentoShareScreen();
|
|
|
|
}
|
|
|
|
|
2017-11-06 23:39:55 +08:00
|
|
|
const unshareScreen = () => {
|
|
|
|
KurentoBridge.kurentoExitScreenShare();
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
2017-11-06 23:39:55 +08:00
|
|
|
isVideoBroadcasting, presenterScreenshareHasEnded, presenterScreenshareHasStarted, shareScreen, unshareScreen,
|
2017-07-25 03:29:34 +08:00
|
|
|
};
|