Skip to content

Add experimental session replay capturing on iOS (UE 5.8+)#1462

Open
tustanivsky wants to merge 11 commits into
mainfrom
feat/session-replay-ios
Open

Add experimental session replay capturing on iOS (UE 5.8+)#1462
tustanivsky wants to merge 11 commits into
mainfrom
feat/session-replay-ios

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This PR adds session replay capturing support on iOS, extending the existing desktop (Windows/Mac/Linux) crash-replay feature to mobile Apple devices.

When Attach session replay is enabled, the plugin records a rolling gameplay clip by capturing the backbuffer, encoding it to H.264 via the engine's AVCodecs abstraction (hardware VideoToolbox on iOS), and muxing it into a fragmented MP4 on disk. If the app crashes, the clip is uploaded as a video/mp4 attachment to the crash event on the next launch, reusing the existing sentry-cocoa onLastRunStatusDetermined upload flow that was already in place for macOS.

Example crash event with session replay attached captured on iOS.

Key changes

  • Moved the session replay recorder from FMacSentrySubsystem into the shared FAppleSentrySubsystem base so macOS and iOS use the same recorder lifecycle, replay file path handling, and next-launch upload logic.
  • Extended the Apple-specific (VideoToolbox/Metal) code paths in the recording pipeline from PLATFORM_MAC to PLATFORM_APPLE:
    • encoder pool textures are created with ETextureCreateFlags::CPUReadback (required by the engine's RHI→Metal resource transform; without it VideoToolbox rejects every frame) with the extra copy pass Metal requires
    • microsecond SendFrame timestamp scale, CABAC entropy workaround, and the hourly encoder restart guarding the uint32 PTS wrap
  • Opened the encoder with swapped width/height when the backbuffer arrives transposed relative to the app's screen orientation
  • Refactored the session replay platform gate in Sentry.Build.cs into IsSessionReplaySupported(), enabling iOS behind UE_5_8_OR_LATER.
  • Enabled AVCodecsCore and VTCodecs for IOS in the sample project.

Known Limitations

iOS support requires Unreal Engine 5.8 or newer - UE 5.8 is the first release where the (still experimental) AVCodecs plugin suite allowlists iOS - VTCodecs (VideoToolbox H.264 hardware encoding) and its RHI integration were previously Mac-only. On older engine versions the plugin builds as before, with session replay capturing unavailable on iOS.

Documentation

Related items:

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 0a70f42

Comment thread plugin-dev/Source/Sentry/Private/SessionReplay/SentryVideoEncoder.cpp Outdated
Comment thread plugin-dev/Source/Sentry/Sentry.Build.cs

@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 and found 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 519b580. Configure here.

Comment thread plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp Outdated
Comment thread plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp Outdated
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