2017-06-28 06:14:53 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Users from '/imports/api/users';
|
2017-09-25 23:39:56 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2018-02-16 03:42:50 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2018-10-24 01:18:09 +08:00
|
|
|
import Breakouts from '/imports/api/breakouts';
|
2018-02-16 03:42:50 +08:00
|
|
|
|
2018-11-01 23:03:16 +08:00
|
|
|
const processOutsideToggleRecording = (e) => {
|
2018-11-13 06:09:04 +08:00
|
|
|
switch (e.data) {
|
|
|
|
case 'c_record': {
|
|
|
|
makeCall('toggleRecording');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'c_recording_status': {
|
|
|
|
const recordingState = Meetings.findOne({ meetingId: Auth.meetingID }).recordProp.recording;
|
|
|
|
const recordingMessage = recordingState ? 'recordingStarted' : 'recordingStopped';
|
|
|
|
this.window.parent.postMessage({ response: recordingMessage }, '*');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
// console.log(e.data);
|
|
|
|
}
|
2018-11-01 23:03:16 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-11-13 06:09:04 +08:00
|
|
|
const connectRecordingObserver = () => {
|
|
|
|
// notify on load complete
|
|
|
|
this.window.parent.postMessage({ response: 'readyToConnect' }, '*');
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-12-21 02:06:01 +08:00
|
|
|
export default {
|
2018-11-13 06:09:04 +08:00
|
|
|
connectRecordingObserver: () => connectRecordingObserver(),
|
2017-11-24 01:20:27 +08:00
|
|
|
isUserPresenter: () => Users.findOne({ userId: Auth.userID }).presenter,
|
2018-02-16 03:42:50 +08:00
|
|
|
isUserModerator: () => Users.findOne({ userId: Auth.userID }).moderator,
|
2018-02-28 22:10:00 +08:00
|
|
|
recordSettingsList: () => Meetings.findOne({ meetingId: Auth.meetingID }).recordProp,
|
2018-10-24 01:18:09 +08:00
|
|
|
meetingIsBreakout: () => Meetings.findOne({ meetingId: Auth.meetingID }).meetingProp.isBreakout,
|
2018-10-30 03:29:45 +08:00
|
|
|
meetingName: () => Meetings.findOne({ meetingId: Auth.meetingID }).meetingProp.name,
|
2018-11-27 20:44:22 +08:00
|
|
|
users: () => Users.find({ connectionStatus: 'online' }).fetch(),
|
2018-10-24 01:18:09 +08:00
|
|
|
hasBreakoutRoom: () => Breakouts.find({ parentMeetingId: Auth.meetingID }).fetch().length > 0,
|
2018-02-21 02:23:35 +08:00
|
|
|
toggleRecording: () => makeCall('toggleRecording'),
|
2018-11-01 23:03:16 +08:00
|
|
|
processOutsideToggleRecording: arg => processOutsideToggleRecording(arg),
|
2018-10-24 01:18:09 +08:00
|
|
|
createBreakoutRoom: (numberOfRooms, durationInMinutes, freeJoin = true, record = false) => makeCall('createBreakoutRoom', numberOfRooms, durationInMinutes, freeJoin, record),
|
2016-12-21 02:06:01 +08:00
|
|
|
};
|