File tree Expand file tree Collapse file tree 4 files changed +65
-2
lines changed Expand file tree Collapse file tree 4 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const INTEGRATIONS = {
2020
2121export { INTEGRATIONS as Integrations } ;
2222
23- export { Replay } from '@sentry/replay' ;
23+ export { Replay , ReplayCanvas } from '@sentry/replay' ;
2424export type {
2525 ReplayEventType ,
2626 ReplayEventWithTime ,
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ const baseBundleConfig = makeBaseBundleConfig({
88 outputFileBase : ( ) => 'bundles/replay' ,
99} ) ;
1010
11- const builds = makeBundleConfigVariants ( baseBundleConfig ) ;
11+ const baseCanvasBundleConfig = makeBaseBundleConfig ( {
12+ bundleType : 'addon' ,
13+ entrypoints : [ 'src/canvas.ts' ] ,
14+ jsVersion : 'es6' ,
15+ licenseTitle : '@sentry/replaycanvas' ,
16+ outputFileBase : ( ) => 'bundles/replaycanvas' ,
17+ } ) ;
18+
19+ const builds = [ ...makeBundleConfigVariants ( baseBundleConfig ) , ...makeBundleConfigVariants ( baseCanvasBundleConfig ) ] ;
1220
1321export default builds ;
Original file line number Diff line number Diff line change 1+ import { getCanvasManager } from '@sentry-internal/rrweb' ;
2+ import type { Integration } from '@sentry/types' ;
3+ import type { ReplayConfiguration } from './types' ;
4+
5+ interface ReplayCanvasOptions {
6+ fps : number ;
7+ quality : number ;
8+ }
9+
10+ /** An integration to add canvas recording to replay. */
11+ export class ReplayCanvas implements Integration {
12+ /**
13+ * @inheritDoc
14+ */
15+ public static id : string = 'ReplayCanvas' ;
16+
17+ /**
18+ * @inheritDoc
19+ */
20+ public name : string ;
21+
22+ private _canvasOptions : ReplayCanvasOptions ;
23+
24+ public constructor ( ) {
25+ this . name = ReplayCanvas . id ;
26+ // TODO FN: Allow to configure this
27+ // But since we haven't finalized how to configure this, this is predefined for now
28+ // to avoid breaking changes
29+ this . _canvasOptions = {
30+ fps : 4 ,
31+ quality : 0.6 ,
32+ } ;
33+ }
34+
35+ /** @inheritdoc */
36+ public setupOnce ( ) : void {
37+ // noop
38+ }
39+
40+ /**
41+ * Get the options that should be merged into replay options.
42+ * This is what is actually called by the Replay integration to setup canvas.
43+ */
44+ public getOptions ( ) : Partial < ReplayConfiguration > {
45+ return {
46+ _experiments : {
47+ canvas : {
48+ ...this . _canvasOptions ,
49+ manager : getCanvasManager ,
50+ } ,
51+ } ,
52+ } ;
53+ }
54+ }
Original file line number Diff line number Diff line change 11export { Replay } from './integration' ;
2+ export { ReplayCanvas } from './canvas' ;
23
34export type {
45 ReplayConfiguration ,
You can’t perform that action at this time.
0 commit comments