Skip to content

Commit e5df0cc

Browse files
committed
send replay config from dart to native
1 parent 845d266 commit e5df0cc

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

flutter/lib/src/replay/integration.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:meta/meta.dart';
55
import '../../sentry_flutter.dart';
66
import '../event_processor/replay_event_processor.dart';
77
import '../native/sentry_native_binding.dart';
8+
import 'replay_config.dart';
89

910
@internal
1011
const replayIntegrationName = 'ReplayIntegration';
@@ -24,6 +25,18 @@ class ReplayIntegration extends Integration<SentryFlutterOptions> {
2425
if ((options.experimental.replay.onErrorSampleRate ?? 0) > 0) {
2526
options.addEventProcessor(ReplayEventProcessor(hub, _native));
2627
}
28+
29+
SentryScreenshotWidget.onBuild((status, prevStatus) {
30+
if (status != prevStatus) {
31+
_native.setReplayConfig(ReplayConfig(
32+
width: status.size?.width.round() ?? 0,
33+
height: status.size?.height.round() ?? 0,
34+
frameRate: 1,
35+
bitRate: 75000, // TODO replay quality config
36+
));
37+
}
38+
return true;
39+
});
2740
}
2841
}
2942
}

flutter/lib/src/replay/replay_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ReplayConfig extends ScheduledScreenshotRecorderConfig {
1313

1414
final int bitRate;
1515

16-
ReplayConfig({
16+
const ReplayConfig({
1717
required int super.width,
1818
required int super.height,
1919
required super.frameRate,

flutter/lib/src/replay/scheduled_recorder_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import '../screenshot/recorder_config.dart';
33
class ScheduledScreenshotRecorderConfig extends ScreenshotRecorderConfig {
44
final int frameRate;
55

6-
ScheduledScreenshotRecorderConfig({
6+
const ScheduledScreenshotRecorderConfig({
77
super.width,
88
super.height,
99
required this.frameRate,

flutter/lib/src/screenshot/recorder_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ScreenshotRecorderConfig {
77
final int? width;
88
final int? height;
99

10-
ScreenshotRecorderConfig({
10+
const ScreenshotRecorderConfig({
1111
this.width,
1212
this.height,
1313
});

0 commit comments

Comments
 (0)