UNPKG

@observertc/observer-js

Version:

Server Side NodeJS Library for processing ObserveRTC Samples

61 lines (60 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObservedInboundTrack = void 0; const Detectors_1 = require("./detectors/Detectors"); class ObservedInboundTrack { timestamp; id; kind; _peerConnection; _inboundRtp; _mediaPlayout; detectors; calculatedScore = { weight: 1, value: undefined, }; appData; _visited = false; addedAt; removedAt; muted; attachments; constructor(timestamp, id, kind, _peerConnection, _inboundRtp, _mediaPlayout) { this.timestamp = timestamp; this.id = id; this.kind = kind; this._peerConnection = _peerConnection; this._inboundRtp = _inboundRtp; this._mediaPlayout = _mediaPlayout; 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; } getInboundRtp() { return this._inboundRtp; } getMediaPlayout() { return this._mediaPlayout; } getRemoteOutboundTrack() { return this._peerConnection.client.call.remoteTrackResolver?.resolveRemoteOutboundTrack(this); } update(stats) { this._visited = true; this.timestamp = stats.timestamp; this.calculatedScore.value = stats.score; this.attachments = stats.attachments; this.detectors.update(); } } exports.ObservedInboundTrack = ObservedInboundTrack;