001ab9554c
Video streams can be sorted by voice floor activity in the client according to FreeSWITCH´s floor events. The feature works together with pagination, essentially giving an Last-N like experience while not disrupting too much Made video stream sorting extensible in a way. The sorting modes for pagination and unbounded can be configured in settings.yml and new sorting modes can be added to the stream sorting util under video-provider. Inline docs explain how to do that Changed how the stream ID attribute from video-streams collection was passed to downstream components; we had an array map that was executed every change just to map stream to cameraId, which is bizarre. So I changed the cameraId usage in downstream components to be conformat with the collection attributes and shaved off the map where it wasnt needed Add better selectors to video-list-item container´s VoiceUser fetch
51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
import Logger from '/imports/startup/server/logger';
|
|
import VideoStreams from '/imports/api/video-streams';
|
|
import { check } from 'meteor/check';
|
|
import {
|
|
getDeviceId,
|
|
getUserName,
|
|
} from '/imports/api/video-streams/server/helpers';
|
|
import VoiceUsers from '/imports/api/voice-users/';
|
|
|
|
const BASE_FLOOR_TIME = "0";
|
|
|
|
export default function sharedWebcam(meetingId, userId, stream) {
|
|
check(meetingId, String);
|
|
check(userId, String);
|
|
check(stream, String);
|
|
|
|
const deviceId = getDeviceId(stream);
|
|
const name = getUserName(userId);
|
|
const vu = VoiceUsers.findOne(
|
|
{ meetingId, intId: userId },
|
|
{ fields: { floor: 1, lastFloorTime: 1 }}
|
|
) || {};
|
|
const floor = vu.floor || false;
|
|
const lastFloorTime = vu.lastFloorTime || BASE_FLOOR_TIME;
|
|
|
|
const selector = {
|
|
meetingId,
|
|
userId,
|
|
deviceId,
|
|
};
|
|
|
|
const modifier = {
|
|
$set: {
|
|
stream,
|
|
name,
|
|
lastFloorTime,
|
|
floor,
|
|
},
|
|
};
|
|
|
|
try {
|
|
const { insertedId } = VideoStreams.upsert(selector, modifier);
|
|
|
|
if (insertedId) {
|
|
Logger.info(`Updated stream=${stream} meeting=${meetingId}`);
|
|
}
|
|
} catch (err) {
|
|
Logger.error(`Error setting stream: ${err}`);
|
|
}
|
|
}
|