Title: Session Replay: support Unity (SurfaceView/OpenGL) rendering · Issue #5257 · getsentry/sentry-java · GitHub
Open Graph Title: Session Replay: support Unity (SurfaceView/OpenGL) rendering · Issue #5257 · getsentry/sentry-java
X Title: Session Replay: support Unity (SurfaceView/OpenGL) rendering · Issue #5257 · getsentry/sentry-java
Description: Summary Session Replay on Android shows a black screen when the app uses Unity for rendering. Unity renders via a SurfaceView backed by OpenGL in a separate process. The current PixelCopy-based screenshot mechanism does not capture Surfa...
Open Graph Description: Summary Session Replay on Android shows a black screen when the app uses Unity for rendering. Unity renders via a SurfaceView backed by OpenGL in a separate process. The current PixelCopy-based scr...
X Description: Summary Session Replay on Android shows a black screen when the app uses Unity for rendering. Unity renders via a SurfaceView backed by OpenGL in a separate process. The current PixelCopy-based scr...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/5257
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Session Replay: support Unity (SurfaceView/OpenGL) rendering","articleBody":"## Summary\n\nSession Replay on Android shows a black screen when the app uses Unity for rendering. Unity renders via a `SurfaceView` backed by OpenGL in a separate process. The current `PixelCopy`-based screenshot mechanism does not capture `SurfaceView` content, resulting in a fully black frame. This blocks replay utility for apps that embed Unity scenes (e.g. for game-like or interactive lesson surfaces).\n\n## Current behavior\n\n* Android replay capture uses `PixelCopy` to screenshot the window hierarchy.\n* `PixelCopy` does not capture `SurfaceView` contents because `SurfaceView` renders to a separate hardware-composited layer.\n* Unity games/scenes embedded in an Android app use `SurfaceView` + OpenGL, so they appear black in any captured replay frame.\n* Attempting capture via `screenshotty` (an alternative screenshot library) produces the same result.\n* The Sentry SDK is not initialized inside the Unity process; the Java/Android SDK captures the host app side only.\n\n## Gap\n\nAny Android app that embeds Unity content — increasingly common for interactive or game-adjacent product surfaces — gets unusable replays. The black region can cover most or all of the viewport, making the replay meaningless for debugging UX issues in Unity-rendered screens.\n\nThis is the same underlying constraint as [JAVA-221](https://linear.app/getsentry/issue/JAVA-221/capture-maps-google-mapbox-etc-in-session-replay) (maps rendered via native OpenGL), but Unity is a distinct integration path with higher prevalence in consumer apps.\n\n## Options\n\n1. **MediaProjection-based capture** — use Android's `MediaProjection` API to capture the composited screen output. This includes `SurfaceView` content and would solve Unity, maps, and other native-render cases. Requires a runtime permission prompt (`FOREGROUND_SERVICE_MEDIA_PROJECTION`) and is more invasive/complex to implement safely. Privacy implications need careful handling.\n2. **VirtualDisplay + SurfaceView mirror** — create a `VirtualDisplay` that mirrors the target surface. Technically complex; not guaranteed to work across Unity's multi-process setup.\n3. **Placeholder/redaction overlay** — when a `SurfaceView` is detected in the view hierarchy, render a labeled placeholder block in the replay frame (similar to how we mask sensitive content). This doesn't capture Unity content but makes replays honest about what's missing instead of just showing black.\n4. **SDK-side Unity integration** — coordinate with the Unity SDK (`getsentry/sentry-unity`) to have Unity emit its own frame snapshots or DOM-equivalent events that can be stitched into the replay. High effort; requires cross-SDK protocol work.\n\n## Recommendation\n\nOption 3 (placeholder overlay) is the lowest-risk near-term improvement — it converts a confusing black-screen replay into an honest, annotated gap. Option 1 (MediaProjection) is the right long-term fix for full capture fidelity, but carries permission/privacy tradeoffs that need product alignment before implementing.\n\nRelated: [JAVA-221](https://linear.app/getsentry/issue/JAVA-221/capture-maps-google-mapbox-etc-in-session-replay) (maps / native OpenGL rendering same root cause)\n\nAction taken on behalf of Simon Zhong.","author":{"url":"https://github.com/apps/sentry-junior","@type":"Person","name":"sentry-junior"},"datePublished":"2026-04-01T22:59:13Z","url":"https://github.com/getsentry/sentry-java/issues/5257"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1685adc9-21d8-3c49-e9fc-4f13eebe3280 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E9EE:29CA94:56FEF4:780A1C:6B04740B |
| html-safe-nonce | 5b990321fc7e895dd941e214304b7c660298bc11fd35d09f4a4422a74c9b70f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUVFOjI5Q0E5NDo1NkZFRjQ6NzgwQTFDOjZCMDQ3NDBCIiwidmlzaXRvcl9pZCI6IjM3MTMxMTc1NTU1MzY0NTg3NjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 573ada4fad95b179e03c1b621a12064977a15f93f3e959cc453b3490cfbd7367 |
| hovercard-subject-tag | issue:4190379467 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/5257/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dfb1a0ae24d731c2d0dafb7357970b06065ccafd6e52de0586c5ed6d92dea79c/getsentry/sentry-java/issues/5257 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dfb1a0ae24d731c2d0dafb7357970b06065ccafd6e52de0586c5ed6d92dea79c/getsentry/sentry-java/issues/5257 |
| og:image:alt | Summary Session Replay on Android shows a black screen when the app uses Unity for rendering. Unity renders via a SurfaceView backed by OpenGL in a separate process. The current PixelCopy-based scr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sentry-junior[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width