JPEG Screenshots

Configure Flutter session JPEG capture and manual native screen-frame capture.

Flutter uses the native Android and iOS screenshot implementations:

final options = createOptionsBuilder()
    .withSessionJpegCapture(
      const AnsightSessionJpegCaptureOptions(
        intervalMilliseconds: 2000,
        quality: 60,
        maxWidth: 480,
        mode: AnsightSessionJpegCaptureMode.screenshotAndVisualTree,
        captureKeyboardPresence: true,
      ),
    )
    .build();

Capture one frame:

await Ansight.instance.captureScreenFrame(
  options: const AnsightSessionJpegCaptureOptions(
    quality: 70,
    maxWidth: 720,
  ),
);

Studio may select host-side capture for a simulator or emulator. A physical iPhone or iPad uses in-app capture through the paired runtime. Disable periodic capture during performance-focused measurements unless visual evidence is required.

Visual-Tree and Keyboard Metadata

AnsightSessionJpegCaptureMode supports:

  • screenshotOnly, the default, for JPEG frames without an SDK visual-tree snapshot.
  • screenshotAndVisualTree to capture registered native and Flutter sources with each app-owned screenshot and correlate them through the screenshot timestamp.
  • screenshotWithVisualTreeOnTouch to capture visual trees on touch down and touch up instead of for every frame. Move and cancel events do not trigger a tree.

Install Flutter instrumentation or otherwise register a session visual-tree provider before selecting a tree mode. Touch-triggered mode also requires touch capture. Payloads follow the compact visual-tree v2 contract.

captureKeyboardPresence defaults to false. It records native keyboard presence only—not keyboard contents or dimensions—and remains useful with Studio-owned simulator/emulator screenshots.