getStats method

  1. @override
Future<List<StatsReport>> getStats([
  1. MediaStreamTrack? track
])
override

Implementation

@override
Future<List<StatsReport>> getStats([MediaStreamTrack? track]) async {
  var stats;
  if (track != null) {
    var jsTrack = (track as MediaStreamTrackWeb).jsTrack;
    stats = await jsutil.promiseToFuture<dynamic>(
        jsutil.callMethod(_jsPc, 'getStats', [jsTrack]));
  } else {
    stats = await _jsPc.getStats();
  }

  var report = <StatsReport>[];
  stats.forEach((key, value) {
    report.add(
        StatsReport(value['id'], value['type'], value['timestamp'], value));
  });
  return report;
}