startStats method

Future<bool> startStats(
  1. String callId,
  2. String peerId,
  3. RTCPeerConnection pc, {
  4. CallQualityCallback? onCallQualityChange,
})

Starts WebRTC statistics reporting for the given call and peer connection.

This only starts if debug mode is enabled. callId The ID of the call. peerId The ID of the peer. pc The RTCPeerConnection to monitor. Returns a Future that completes with true if stats reporting started, false otherwise.

Implementation

Future<bool> startStats(
  String callId,
  String peerId,
  RTCPeerConnection pc, {
  CallQualityCallback? onCallQualityChange,
}) async {
  if (!_debug) {
    GlobalLogger().d(
      'Peer :: Stats manager will NOT start; debug mode not enabled.',
    );
    return false;
  }
  _statsManager = WebRTCStatsReporter(
    _socket,
    pc,
    callId,
    peerId,
    _txClient.isDebug(),
    onCallQualityChange: onCallQualityChange,
  );
  await _statsManager?.startStatsReporting();
  GlobalLogger().d('Peer :: Stats Manager started for callId=$callId');
  return true;
}