Skip to content

feat(flutter): configurable Session Replay capture scale#626

Open
abelonogov-ld wants to merge 13 commits into
mainfrom
andrey/flutter-sr-scale
Open

feat(flutter): configurable Session Replay capture scale#626
abelonogov-ld wants to merge 13 commits into
mainfrom
andrey/flutter-sr-scale

Conversation

@abelonogov-ld

Copy link
Copy Markdown
Contributor

Summary

  • Adds scale to the Flutter SessionReplayOptions (double?, default 1.0 = 1x / 160 DPI) — a capture-resolution multiplier (2.0 = 2x, etc.). null is treated as 1.0.
  • Threads scale through the Pigeon schema (messages.dart + regenerated messages.g.*), the native options codec, and both native bridges (LDNativeApiImpl for Android/iOS).
  • Capture fix: the Flutter capture service now renders frames at the configured scale instead of the full device pixel ratio. Previously frames were captured at full DPR (e.g. 3x on a typical phone), producing oversized replay frames that didn't match the scale recorded by the native exporter.
  • Each LDNativeApiImpl resolves scale once and passes the same value to both the native exporter options (ReplayOptions / SessionReplayOptions) and the Flutter capture service, keeping capture resolution and exported metadata in sync.
  • Updates docs/README and adds codec tests (default, custom, and null propagation).

Behavior note

Default scale is 1.0, so frames now capture at 1x by default instead of full device DPR. This makes scale: 1 mean 160 DPI / 1x as expected. Set scale: 2.0 for sharper replays.

Cross-repo dependency

The iOS bridge passes scale into the native SessionReplayOptions, which requires the native scale support in launchdarkly/swift-launchdarkly-observability#223. That PR must land and ship in a new swift-launchdarkly-observability release, and the iOS dependency (podspec / Package.swift) bumped to it, before the iOS side builds against a published version. Android scale support already exists in observability-android in this repo.

Test plan

  • dart analyze + dart format pass
  • flutter test passes (codec tests included)
  • Android: replay frames at default scale are 1x / 160 DPI; scale: 2.0 captures at 2x
  • iOS (against the swift release with chore: Add node-workspace plugin for release-please. #223): replay frames at default scale are 1x; scale: 2.0 captures at 2x

Made with Cursor

abelonogov-ld and others added 7 commits June 12, 2026 13:31
Wire OTLP_ENDPOINT and BACKEND_URL dart-defines through to
ObservabilityOptions in the example app, mirroring otlpEndpoint /
backendUrl in the Swift sample's Secrets.xcconfig. Empty/unset defines
fall back to the production defaults baked into the SDK. Documents the
optional keys in the example README and dart_defines template.

Co-authored-by: Cursor <cursoragent@cursor.com>
…chdarkly/observability-sdk into andrey/flutter-otlp-endpoint-config

* 'andrey/flutter-otlp-endpoint-config' of github.com:launchdarkly/observability-sdk:
Add `SessionReplayOptions.scale` (double?, default 1.0 = 1x / 160 DPI) and
thread it through the Pigeon schema, codec, and native bridges on both
platforms. The Flutter capture service now renders frames at the configured
scale instead of the full device pixel ratio, so capture resolution matches
the scale recorded by the native Session Replay exporter (fixes oversized
replay frames). Resolves scale once in each LDNativeApiImpl so the exporter
options and the Flutter capture service stay in sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld abelonogov-ld requested a review from a team as a code owner June 12, 2026 22:00

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 77fadde. Configure here.

abelonogov-ld and others added 4 commits June 12, 2026 15:05
A missing or non-positive `scale` made the native exporter record the raw
(possibly 0/negative) value while the Dart capture fell back to the device
pixel ratio, reintroducing the capture/exporter scale mismatch. Resolve a
missing or `<= 0` scale to the 1.0 default on both Android and iOS so the
exporter options and the over-the-channel capture scale always agree.

Also fixes an ambiguous `CGFloat.init` function reference on iOS by using an
explicit closure for the scale conversion.

Co-authored-by: Cursor <cursoragent@cursor.com>
…r-sr-scale

* andrey/flutter-otlp-endpoint-config:
  update ver
  bump dependencies
  feat(flutter): allow overriding OTLP endpoint and backend URL in example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants