UNPKG

@observertc/observer-js

Version:

Server Side NodeJS Library for processing ObserveRTC Samples

56 lines (55 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObservedMediaSource = void 0; class ObservedMediaSource { timestamp; id; kind; _peerConnection; _visited = false; appData; trackIdentifier; audioLevel; totalAudioEnergy; totalSamplesDuration; echoReturnLoss; echoReturnLossEnhancement; width; height; frames; framesPerSecond; attachments; constructor(timestamp, id, kind, _peerConnection) { this.timestamp = timestamp; this.id = id; this.kind = kind; this._peerConnection = _peerConnection; } get visited() { const visited = this._visited; this._visited = false; return visited; } getPeerConnection() { return this._peerConnection; } getTrack() { return this._peerConnection.observedOutboundTracks.get(this.trackIdentifier ?? ''); } update(stats) { this._visited = true; this.timestamp = stats.timestamp; this.trackIdentifier = stats.trackIdentifier; this.audioLevel = stats.audioLevel; this.totalAudioEnergy = stats.totalAudioEnergy; this.totalSamplesDuration = stats.totalSamplesDuration; this.echoReturnLoss = stats.echoReturnLoss; this.echoReturnLossEnhancement = stats.echoReturnLossEnhancement; this.width = stats.width; this.height = stats.height; this.frames = stats.frames; this.framesPerSecond = stats.framesPerSecond; this.attachments = stats.attachments; } } exports.ObservedMediaSource = ObservedMediaSource;