update logic and rename function
This commit is contained in:
parent
08d177dac0
commit
067801acae
@ -8,7 +8,7 @@ import logger from '/imports/startup/client/logger';
|
||||
import { Session } from 'meteor/session';
|
||||
import browser from 'browser-detect';
|
||||
import {
|
||||
currentWebcamConnections,
|
||||
updateCurrentWebcamsConnection,
|
||||
getCurrentWebcams,
|
||||
deleteWebcamConnection,
|
||||
newWebcamConnection,
|
||||
@ -478,7 +478,7 @@ class VideoProvider extends Component {
|
||||
}
|
||||
delete this.webRtcPeers[id];
|
||||
deleteWebcamConnection(id);
|
||||
currentWebcamConnections(this.webRtcPeers);
|
||||
updateCurrentWebcamsConnection(this.webRtcPeers);
|
||||
} else {
|
||||
this.logger('warn', 'No WebRTC peer to stop (not an error)', { cameraId: id });
|
||||
}
|
||||
@ -561,7 +561,7 @@ class VideoProvider extends Component {
|
||||
this.webRtcPeers[id].peerConnection.oniceconnectionstatechange = this._getOnIceConnectionStateChangeCallback(id);
|
||||
}
|
||||
newWebcamConnection({ userId: id, peer: this.webRtcPeers[id] });
|
||||
currentWebcamConnections(this.webRtcPeers);
|
||||
updateCurrentWebcamsConnection(this.webRtcPeers);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ const WARNING_END_TIME = 60000;
|
||||
|
||||
let monitoringIntervalRef;
|
||||
|
||||
export const currentWebcamConnections = (webrtcConnections) => {
|
||||
export const updateCurrentWebcamsConnection = (connections) => {
|
||||
const doc = {
|
||||
timestamp: new Date().getTime(),
|
||||
event: NUMBER_OF_WEBCAMS_CHANGED,
|
||||
payload: Object.keys(webrtcConnections),
|
||||
payload: Object.keys(connections),
|
||||
};
|
||||
|
||||
NetworkInformationLocal.insert(doc);
|
||||
@ -110,14 +110,15 @@ export const startBandwidthMonitoring = () => {
|
||||
time: { $lt: dangerLowerBoundary, $gte: warningLowerBoundary },
|
||||
}).count();
|
||||
|
||||
if (warningZoneReceivers && !dangerZone) {
|
||||
if (!warningZoneReceivers) {
|
||||
makeCall('setUserEffectiveConnectionType', 'warning');
|
||||
}
|
||||
} else if (dangerZone) {
|
||||
|
||||
if (dangerZone) {
|
||||
if (!dangerZoneReceivers) {
|
||||
makeCall('setUserEffectiveConnectionType', 'danger');
|
||||
}
|
||||
} else if (warningZone) {
|
||||
if (!warningZoneReceivers) {
|
||||
makeCall('setUserEffectiveConnectionType', 'warning');
|
||||
}
|
||||
} else {
|
||||
makeCall('setUserEffectiveConnectionType', '');
|
||||
}
|
||||
@ -192,7 +193,7 @@ export const updateWebcamStats = (id, stats) => {
|
||||
|
||||
export default {
|
||||
NetworkInformationLocal,
|
||||
currentWebcamConnections,
|
||||
updateCurrentWebcamsConnection,
|
||||
deleteWebcamConnection,
|
||||
getCurrentWebcams,
|
||||
newWebcamConnection,
|
||||
|
Loading…
Reference in New Issue
Block a user