2016-05-17 02:05:44 +08:00
|
|
|
import Users from '/imports/api/users';
|
2016-05-13 01:43:59 +08:00
|
|
|
|
|
|
|
// when new lock settings including disableMic are set,
|
|
|
|
// all viewers that are in the audio bridge with a mic should be muted and locked
|
|
|
|
export function handleLockingMic(meetingId, newSettings) {
|
2016-05-16 22:35:59 +08:00
|
|
|
// send mute requests for the viewer users joined with mic
|
|
|
|
let i, results, userObject;
|
|
|
|
userObjects = Users.find({
|
|
|
|
meetingId: meetingId,
|
|
|
|
'user.role': 'VIEWER',
|
|
|
|
'user.listenOnly': false,
|
|
|
|
'user.locked': true,
|
|
|
|
'user.voiceUser.joined': true,
|
|
|
|
'user.voiceUser.muted': false,
|
|
|
|
}).fetch();
|
2016-05-13 01:43:59 +08:00
|
|
|
|
2016-05-16 22:35:59 +08:00
|
|
|
_userObjects_length = userObjects.length;
|
|
|
|
results = [];
|
|
|
|
for (i = 0; i < _userObjects_length; i++) {
|
|
|
|
userObject = userObjects[i];
|
|
|
|
results.push(Meteor.call('muteUser', meetingId, userObject.userId, userObject.userId,
|
|
|
|
userObject.authToken, true)); //true for muted
|
|
|
|
}
|
2016-05-13 01:43:59 +08:00
|
|
|
|
2016-05-16 22:35:59 +08:00
|
|
|
return results;
|
2016-05-13 01:43:59 +08:00
|
|
|
};
|