Merge branch 'html5-2x-screenshare' of github.com:Klauswk/bigbluebutton into html5-2x-screenshare
This commit is contained in:
commit
cacac6c9c6
1
bigbluebutton-html5/imports/api/2.0/screenshare/index.js
Normal file
1
bigbluebutton-html5/imports/api/2.0/screenshare/index.js
Normal file
@ -0,0 +1 @@
|
||||
export default new Mongo.Collection('screenshare');
|
@ -0,0 +1,14 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis2x';
|
||||
import handleBroadcastStartedVoice from './handlers/broadcastStartedVoice';
|
||||
import handleBroadcastStarted from './handlers/broadcastStarted';
|
||||
import handleBroadcastStoppedVoice from './handlers/broadcastStoppedVoice';
|
||||
import handleBroadcastStopped from './handlers/broadcastStopped';
|
||||
import handleStartedVoice from './handlers/startedVoice';
|
||||
import handleStoppedVoice from './handlers/stoppedVoice';
|
||||
|
||||
RedisPubSub.on('ScreenshareRtmpBroadcastStartedVoiceConfEvtMsg', handleBroadcastStartedVoice);
|
||||
RedisPubSub.on('ScreenshareRtmpBroadcastStartedEvtMsg', handleBroadcastStarted);
|
||||
RedisPubSub.on('ScreenshareRtmpBroadcastStoppedVoiceConfEvtMsg', handleBroadcastStoppedVoice);
|
||||
RedisPubSub.on('ScreenshareRtmpBroadcastStoppedEvtMsg', handleBroadcastStopped);
|
||||
RedisPubSub.on('ScreenshareStartedVoiceConfEvtMsg', handleStartedVoice);
|
||||
RedisPubSub.on('ScreenshareStoppedVoiceConfEvtMsg', handleStoppedVoice);
|
@ -0,0 +1,9 @@
|
||||
import { check } from 'meteor/check';
|
||||
import addBroadcast from '../modifiers/addBroadcast';
|
||||
|
||||
export default function handleBroadcastStartedVoice({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
check(body, Object);
|
||||
|
||||
return addBroadcast(meetingId, body);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export default function handleBroadcastStarted({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
return meetingId;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { check } from 'meteor/check';
|
||||
import clearBroadcast from '../modifiers/clearBroadcast';
|
||||
|
||||
export default function handleBroadcastStartedVoice({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
|
||||
const { screenshareConf } = body;
|
||||
|
||||
return clearBroadcast(meetingId, screenshareConf);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export default function handleBroadcastStopped({ header, body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
return meetingId;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { check } from 'meteor/check';
|
||||
import addVoiceUser from '../modifiers/addVoiceUser';
|
||||
|
||||
export default function handleStartedVoice({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
|
||||
const { screenshareConf } = body;
|
||||
|
||||
check(screenshareConf, String);
|
||||
|
||||
return addVoiceUser(meetingId, screenshareConf, body);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import { check } from 'meteor/check';
|
||||
import clearVoiceUser from '../modifiers/clearVoiceUser';
|
||||
|
||||
export default function handleStoppedVoice({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
|
||||
const { callerIdNum } = body;
|
||||
const { screenshareConf } = body;
|
||||
|
||||
check(callerIdNum, String);
|
||||
|
||||
return clearVoiceUser(meetingId, screenshareConf, callerIdNum);
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
import './eventHandlers';
|
||||
import './methods';
|
||||
import './publishers';
|
@ -0,0 +1,4 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
Meteor.methods({
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
import { check } from 'meteor/check';
|
||||
import flat from 'flat';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Screenshare from '/imports/api/2.0/screenshare';
|
||||
|
||||
export default function addBroadcast(meetingId, body) {
|
||||
check(meetingId, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
meetingId,
|
||||
broadcast: flat(body),
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding broadcast to collection: ${err}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted broadcast id=${body.screenshareConf}`);
|
||||
};
|
||||
|
||||
return Screenshare.upsert(selector, modifier, cb);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import { check } from 'meteor/check';
|
||||
import flat from 'flat';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Screenshare from '/imports/api/2.0/screenshare';
|
||||
|
||||
export default function addVoiceUser(meetingId, screenshareConf, body) {
|
||||
check(meetingId, String);
|
||||
check(screenshareConf, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
'broadcast.screenshareConf': screenshareConf,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$push: {
|
||||
'broadcast.voiceUsers': flat(body),
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding voiceUser to collection: ${err}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted voiceUser id=${body.callerIdNum}, name=${body.callerIdName}`);
|
||||
};
|
||||
|
||||
return Screenshare.upsert(selector, modifier, cb);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Screenshare from '/imports/api/2.0/screenshare';
|
||||
|
||||
export default function clearBroadcast(meetingId, screenshareConf) {
|
||||
if (meetingId && screenshareConf) {
|
||||
return Screenshare.remove({ meetingId, 'broadcast.screenshareConf': screenshareConf }, Logger.info(`Cleared Screenshare (${meetingId}) , (${screenshareConf})`));
|
||||
}
|
||||
|
||||
return Screenshare.remove({}, Logger.info('Cleared Screenshare (all)'));
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Screenshare from '/imports/api/2.0/screenshare';
|
||||
|
||||
export default function clearVoiceUser(meetingId, screenshareConf, callerIdNum) {
|
||||
check(meetingId, String);
|
||||
check(callerIdNum, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
'broadcast.screenshareConf': screenshareConf,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$pull: {
|
||||
'broadcast.voiceUsers': { callerIdNum },
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err) => {
|
||||
if (err) {
|
||||
return Logger.error(`Remove voiceUser to collection: ${err}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Remove voiceUser id=${callerIdNum}`);
|
||||
};
|
||||
|
||||
return Screenshare.update(selector, modifier, cb);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import Screenshare from '/imports/api/2.0/screenshare';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import mapToAcl from '/imports/startup/mapToAcl';
|
||||
|
||||
function screenshare(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
Logger.info(`Publishing Screenshare for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Screenshare.find({ meetingId });
|
||||
}
|
||||
|
||||
function publish(...args) {
|
||||
const boundScreenshare = screenshare.bind(this);
|
||||
return mapToAcl('subscriptions.screenshare', boundScreenshare)(args);
|
||||
}
|
||||
|
||||
Meteor.publish('screenshare', publish);
|
@ -22,6 +22,7 @@ import '/imports/api/2.0/presentations/server';
|
||||
import '/imports/api/2.0/slides/server';
|
||||
import '/imports/api/2.0/breakouts/server';
|
||||
import '/imports/api/2.0/chat/server';
|
||||
import '/imports/api/2.0/screenshare/server';
|
||||
|
||||
// Commons
|
||||
import '/imports/api/log-client/server';
|
||||
|
Loading…
Reference in New Issue
Block a user