2019-09-06 02:29:30 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-09-07 00:50:31 +08:00
|
|
|
import VideoStreams from '/imports/api/video-streams';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2019-09-06 02:29:30 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
function videoStreams() {
|
|
|
|
if (!this.userId) {
|
|
|
|
return VideoStreams.find({ meetingId: '' });
|
|
|
|
}
|
|
|
|
const { meetingId } = extractCredentials(this.userId);
|
2019-09-06 02:29:30 +08:00
|
|
|
|
|
|
|
Logger.debug(`video users of meeting id=${meetingId}`);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
2019-09-07 00:50:31 +08:00
|
|
|
return VideoStreams.find(selector);
|
2019-09-06 02:29:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function publish(...args) {
|
2019-09-07 00:50:31 +08:00
|
|
|
const boundVideoStreams = videoStreams.bind(this);
|
|
|
|
return boundVideoStreams(...args);
|
2019-09-06 02:29:30 +08:00
|
|
|
}
|
|
|
|
|
2019-09-07 00:50:31 +08:00
|
|
|
Meteor.publish('video-streams', publish);
|