runPreCallTest static method

Future<PreCallTestResult> runPreCallTest(
  1. PreCallTestOptions options, {
  2. void onStatsChange(
    1. PreCallNetworkQuality stats
    )?,
})

Tests the camera, the microphone and the network before joining — the web SDK's runPreCallTest. Needs no room; it must run before createRoom, which afterwards refuses a new test with ERROR_PRECALL_AFTER_INIT.

Creating a room does not stop a test that is already running: its loopback publish and the camera it opened keep going alongside the room. Stop it yourself with stopPreCallTest before you call createRoom.

The whole test runs in the native core: validation, the media check, a loopback publish/subscribe for samplingDuration, and the scoring. onStatsChange receives the latest network quality while it samples.

Completes with the PreCallTestResult (also when stopped, with aborted: true) or fails with a PreCallTestException. Only one test runs at a time.

final result = await VideoSDK.runPreCallTest(
  PreCallTestOptions(token: token, videoTrack: cameraTrack),
  onStatsChange: (stats) => print(stats.uplink.quality),
);

Implementation

static Future<PreCallTestResult> runPreCallTest(
  PreCallTestOptions options, {
  void Function(PreCallNetworkQuality stats)? onStatsChange,
}) =>
    startPreCallTest(options, onStatsChange: onStatsChange);