Constructor
new RTCStatsMoment()
Create a RTCStatsMoment.
- See:
-
- example application https://github.com/skyway-lab/connection-status-viewer-example
Example
import { RTCStatsMoment } from 'rtcstats-wrapper';
const moment = new RTCStatsMoment();
const report = await pc.getStats();
moment.update(report);
moment.report();
//=> {
// "send": {
// "video": { ... },
// "audio": { ... },
// },
// "receive": {
// "video": { ... },
// "audio": { ... },
// },
// "candidatePair": { ... }
//}
Methods
report() → {MomentaryReport}
Calculate the momentary value based on the updated value. MomentaryReport does not have attribute that can not be obtained.
Returns:
- Type:
-
MomentaryReport
Example
import { RTCStatsMoment } from 'rtcstats-wrapper';
const moment = new RTCStatsMoment();
const receiver = pc.getReceivers().find(sender => sender.kind === "video");
const report = receiver.getStats();
moment.update(report);
moment.report();
//=> {
// "send": {
// "video": { ... },
// }
//}
update(report)
Update the report.
Parameters:
Name | Type | Description |
---|---|---|
report |
RTCStatsReport
|
original stats report from |
Example
import { RTCStatsMoment } from 'rtcstats-wrapper';
const moment = new RTCStatsMoment();
const id = setInterval(() => {
const report = await pc.getStats();
moment.update(report);
}, INTERVAL);