@observertc/observer-js
Version:
Server Side NodeJS Library for processing ObserveRTC Samples
66 lines (65 loc) • 1.75 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObservedOutboundTrack = void 0;
const Detectors_1 = require("./detectors/Detectors");
class ObservedOutboundTrack {
timestamp;
id;
kind;
_peerConnection;
_outboundRtps;
_mediaSource;
detectors;
_visited = false;
appData;
report;
calculatedScore = {
weight: 1,
value: undefined,
};
addedAt;
removedAt;
muted;
attachments;
constructor(timestamp, id, kind, _peerConnection, _outboundRtps, _mediaSource) {
this.timestamp = timestamp;
this.id = id;
this.kind = kind;
this._peerConnection = _peerConnection;
this._outboundRtps = _outboundRtps;
this._mediaSource = _mediaSource;
this.report = {
trackId: this.id,
kind: this.kind,
};
this.detectors = new Detectors_1.Detectors();
}
get score() {
return this.calculatedScore.value;
}
get visited() {
const visited = this._visited;
this._visited = false;
return visited;
}
getPeerConnection() {
return this._peerConnection;
}
getOutboundRtps() {
return this._outboundRtps;
}
getMediaSource() {
return this._mediaSource;
}
getRemoteInboundTracks() {
return this._peerConnection.client.call.remoteTrackResolver?.resolveRemoteInboundTracks(this);
}
update(stats) {
this._visited = true;
this.timestamp = stats.timestamp;
this.calculatedScore.value = stats.score;
this.attachments = stats.attachments;
this.detectors.update();
}
}
exports.ObservedOutboundTrack = ObservedOutboundTrack;