Skip to content

Commit 81dce54

Browse files
markushiclaude
andcommitted
feat(rrweb): add screenshot strategy serialization
Serialize the screenshot strategy from replay options in RRWeb events, mapping PIXEL_COPY to "pixelCopy" and defaulting to "canvas". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fcec2f2 commit 81dce54

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

sentry/src/main/java/io/sentry/rrweb/RRWebOptionsEvent.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.sentry.JsonUnknown;
77
import io.sentry.ObjectReader;
88
import io.sentry.ObjectWriter;
9+
import io.sentry.ScreenshotStrategyType;
910
import io.sentry.SentryOptions;
1011
import io.sentry.SentryReplayOptions;
1112
import io.sentry.protocol.SdkVersion;
@@ -52,6 +53,12 @@ public RRWebOptionsEvent(final @NotNull SentryOptions options) {
5253
optionsPayload.put("quality", replayOptions.getQuality().serializedName());
5354
optionsPayload.put("maskedViewClasses", replayOptions.getMaskViewClasses());
5455
optionsPayload.put("unmaskedViewClasses", replayOptions.getUnmaskViewClasses());
56+
57+
final String screenshotStrategy =
58+
(replayOptions.getScreenshotStrategy() == ScreenshotStrategyType.PIXEL_COPY)
59+
? "pixelCopy"
60+
: "canvas";
61+
optionsPayload.put("screenshotStrategy", screenshotStrategy);
5562
}
5663

5764
@NotNull

sentry/src/test/resources/json/rrweb_options_event.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"maskedViewClasses": [],
1313
"nativeSdkName": "sentry.java",
1414
"sessionSampleRate": 0.5,
15-
"quality": "low"
15+
"quality": "low",
16+
"screenshotStrategy": "pixelCopy"
1617
}
1718
}
1819
}

0 commit comments

Comments
 (0)