Skip to content

Mobile Session Replay: SDK Recording parameters and API #63248

Closed
@bruno-garcia

Description

@bruno-garcia

This ticket defines some aspects of recording a mobile app and supporting data/context to send to Sentry:
It serves to track what parameters we will need and to align between iOS and Android.

Recording parameters and Options

These parameters/options might not be public, but we'll use these to control or adjust video quality, size and recording overhead.

Let's not put this into SentryOptions directly, but create a new nested object SessionReplayOptions which contains all of these params. SentryOptions then holds a ref to this nested object (sentryOptions.setSessionReplayOptions(replayOptions)).

Public options:

  • sessionReplay.sessionSampleRate: float - sample rate
  • sessionReplay.onErrorSampleRate: float - If the entire session is not sampled, use the sample rate to sample sessions when an error occurs.
  • quality: high|medium|low - for later, predefined quality options that change bitrate, resolution, maybe mimeType under the hood

Masking:

We'll redact all text input controls, WebView, labels, images (except when loaded from the bundle), custom controls by default.

  • Provide a way to pause/resume recording for certain screens (E.g. a PIN-code screen we cannot really redact properly). It should probably be a top-level API of the static class (Sentry.resumeSessionReplay/Sentry.pauseSessionReplay)
    • Let's bring this up with frontend/backend, because there will be gaps between replay segments. Maybe we could add new RREvent types or breadcrumbs indicating the replay was paused/resumed to surface this in the frontend.
  • Provide a way to redact views based on their class name. We should do that on SDK init - register a list of classes that you know are sensitive from the beginning. sessionReplayOptions.addClassForMasking(), name TBD
  • Provide a way to redact specific view instances. Via an extension property/function on iOS and Kotlin Android, e.g. sampleView.sentryBlock = true|false
    • On Android we could also use view.setTag("sentry-block|unblock").
    • In case of Java, extension property wouldn't work so we probably need to call to Sentry static class, maybe let's not do it in the first version

Internal/Private Recording options:

  • frameRate: float: Screenshot every N seconds, default is 1, 0.5 is a valid option
  • bitRate: int: The quality of the 'video', defaults to 20.
  • mimeType: enum: h264 - let's always hardcode it to h264
  • height: Used on Android. The height of the video. Width adjusts proportionally. Default 720. This might depend on device it runs.
  • scaling: Used on iOS and Android. Default 1x that means,for an iPhone 15 Pro, the video is 320x840

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions