twilio-video
Version:
Twilio Video JavaScript Library
53 lines • 1.89 kB
JavaScript
;
const RemoteTrackStats = require('./remotetrackstats');
/**
* Statistics for a {@link VideoTrack}.
* @extends RemoteTrackStats
* @property {?VideoTrack#Dimensions} dimensions - Received video resolution
* @property {?number} frameRate - Received video frame rate
* @property {?number} freezeCount - Total number of video freezes experienced by this receiver
*/
class RemoteVideoTrackStats extends RemoteTrackStats {
/**
* @param {string} trackId - {@link VideoTrack} ID
* @param {StandardizedTrackStatsReport} statsReport
*/
constructor(trackId, statsReport) {
super(trackId, statsReport);
let dimensions = null;
if (typeof statsReport.frameWidthReceived === 'number' &&
typeof statsReport.frameHeightReceived === 'number') {
dimensions = {};
Object.defineProperties(dimensions, {
width: {
value: statsReport.frameWidthReceived,
enumerable: true
},
height: {
value: statsReport.frameHeightReceived,
enumerable: true
}
});
}
Object.defineProperties(this, {
dimensions: {
value: dimensions,
enumerable: true
},
frameRate: {
value: typeof statsReport.frameRateReceived === 'number'
? statsReport.frameRateReceived
: null,
enumerable: true
},
freezeCount: {
value: typeof statsReport.freezeCount === 'number'
? statsReport.freezeCount
: null,
enumerable: true
}
});
}
}
module.exports = RemoteVideoTrackStats;
//# sourceMappingURL=remotevideotrackstats.js.map