Touch Input
Capture app-local touch input with the Ansight .NET SDK so the local host player can replay taps, drags, long presses, and cancelled gestures alongside screenshots and telemetry.
Touch input capture records where a user touches inside the app window while Ansight is active. The resident host stores those records with the session so replay, timelines, heatmaps, and CLI touch inspection can line up user input with screenshots, telemetry, logs, and visual-tree evidence.
Touch capture is enabled by default by Options.Default, an empty Options.CreateBuilder().Build(), and the all-in-one setup. Keep it enabled only in local development, QA, or other controlled builds where input replay is useful.
Configure Touch Capture
The all-in-one setup needs no extra call.
Standard .NET apps:
using Ansight;
var options = Options.CreateBuilder()
.WithAnsightSdk()
.Build();
Runtime.InitializeAndActivate(options);
.NET MAUI apps:
using Ansight.Maui;
builder.UseAnsight<App>();
For core-only setup, an empty builder also uses the default touch options. Call WithTouchCapture(...) when you want to customize them:
using Ansight;
var options = Options.CreateBuilder()
.WithTouchCapture()
.Build();
Runtime.InitializeAndActivate(options);
WithTouchCapture() starts the platform capture session when Runtime.Activate() runs and stops it when Runtime.Deactivate() runs.
What Gets Captured
Each touch record includes:
- action: down, move, up, or cancel
- pointer id, pointer index, and pointer count
- app-window coordinates
- surface width, height, and scale when available
- normalized coordinates when surface dimensions are known
- UTC capture timestamp
Captured touches are streamed as input-capture records over an open host connection. They are not added to IDataSink, and they are separate from metric samples and Runtime.Event(...) timeline events.
Move Event Throttling
Move capture can be noisy during scrolling, dragging, and multi-touch gestures. The default settings keep move events useful without recording every platform callback:
var options = Options.CreateBuilder()
.WithTouchCapture(
captureMoveEvents: true,
captureCancelEvents: true,
moveCaptureDistanceThreshold: 4,
moveCaptureFramesPerSecond: 15)
.Build();
| Option | Meaning | Default |
|---|---|---|
captureMoveEvents | Include move events in addition to down/up events. | true |
captureCancelEvents | Include platform cancellation events. | true |
moveCaptureDistanceThreshold | Minimum movement in logical display units before another move event is captured for a pointer. Use 0 to disable distance filtering. | 4 |
moveCaptureFramesPerSecond | Maximum move event cadence per pointer. Use 0 to disable FPS filtering. | 15 |
To capture only taps and release points:
var options = Options.CreateBuilder()
.WithTouchCapture(captureMoveEvents: false)
.Build();
Disable touch capture explicitly with WithoutTouchCapture():
var options = Options.CreateBuilder()
.WithoutTouchCapture()
.Build();
Platform Support
Touch capture currently has platform sessions for:
- Android
- iOS
- Mac Catalyst
Other .NET targets accept the option but do not emit touch records.
Pair With Screenshots
Touch input is most useful when the session also has visual context. The all-in-one packages already enable session JPEG capture every 2000ms at quality 60 with max width 480.
Important: Pairing touch input with screen capture will result in an FPS drop while frames are captured, encoded, and transported. Disable session JPEG capture for trend-focused runs unless visual evidence is required.
For core-only apps, add session capture when you want replay evidence:
var options = Options.CreateBuilder()
.WithTouchCapture()
.WithSessionJpegCapture(intervalMilliseconds: 2000, quality: 60, maxWidth: 480)
.Build();
See JPEG Screenshots for screenshot configuration.
Trends And Privacy
Touch records can reveal user behavior, typed paths through the UI, and sensitive screen locations. Keep touch capture out of protected Release, TestFlight, App Store, Play Store, and other distributable builds unless it is explicitly approved.
For touch-heavy screens, prefer the default move throttling or disable move events. A capture focused on tap targets usually needs down/up events and screenshots more than every move sample.