Skip to content

Commit b2fe82b

Browse files
billyvgc298lee
authored andcommitted
new quality options
1 parent 7bf2be5 commit b2fe82b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/replay/src/canvas.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { getCanvasManager } from '@sentry-internal/rrweb';
22
import type { Integration } from '@sentry/types';
3-
import type { ReplayConfiguration } from './types';
3+
import type { CanvasManagerInterface, GetCanvasManagerOptions, ReplayConfiguration } from './types';
44

55
interface ReplayCanvasOptions {
6-
fps: number;
7-
quality: number;
6+
quality: 'low' | 'medium' | 'high';
7+
manualSnapshot?: boolean;
88
}
99

1010
/** An integration to add canvas recording to replay. */
@@ -21,14 +21,14 @@ export class ReplayCanvas implements Integration {
2121

2222
private _canvasOptions: ReplayCanvasOptions;
2323

24-
public constructor() {
24+
public constructor(options?: Partial<ReplayCanvasOptions>) {
2525
this.name = ReplayCanvas.id;
2626
// TODO FN: Allow to configure this
2727
// But since we haven't finalized how to configure this, this is predefined for now
2828
// to avoid breaking changes
2929
this._canvasOptions = {
30-
fps: 4,
31-
quality: 0.6,
30+
quality: (options && options.quality) || 'medium',
31+
manualSnapshot: true,
3232
};
3333
}
3434

@@ -46,7 +46,12 @@ export class ReplayCanvas implements Integration {
4646
_experiments: {
4747
canvas: {
4848
...this._canvasOptions,
49-
manager: getCanvasManager,
49+
manager: opts =>
50+
this.canvasManager({
51+
...opts,
52+
manualSnapshot: this._canvasOptions.manualSnapshot,
53+
}),
54+
quality: this._canvasOptions.quality,
5055
},
5156
},
5257
};

0 commit comments

Comments
 (0)