Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: canvas recording support #946

Merged
merged 9 commits into from
Jan 22, 2024
Merged

feat: canvas recording support #946

merged 9 commits into from
Jan 22, 2024

Conversation

daibhin
Copy link
Contributor

@daibhin daibhin commented Jan 3, 2024

Changes

Related to PostHog/posthog#14555

Adds the necessary config to control canvas recording of sessions remotely. While we experiment before launch we have decided to make this a remote config so that we have better control.
It sets an FPS and quality value for capturing canvases as images based on the decide response. Should nothing be returned or partial config returned the SDK will not enable canvas recording for the session.

Checklist

@daibhin daibhin requested a review from a team January 3, 2024 13:30
Copy link

github-actions bot commented Jan 3, 2024

Size Change: +2.39 kB (0%)

Total Size: 760 kB

Filename Size Change
dist/array.full.js 178 kB +603 B (0%)
dist/array.js 120 kB +596 B (+1%)
dist/es.js 120 kB +596 B (+1%)
dist/module.js 120 kB +596 B (0%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 12 kB
dist/recorder-v2.js 104 kB
dist/recorder.js 58.4 kB
dist/surveys.js 48.7 kB

compressed-size-action

@@ -491,6 +507,12 @@ export class SessionRecording {
}
}

if (!_isNull(this._recordCanvas) && !_isNull(this._canvasFps) && !_isNull(this._canvasQuality)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a default fallback for _canvasFps and _canvasQuality instead of not enabling canvas at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that but didn't want to choose anything arbitrary before we knew what a sensible value might be. In reality they should never be null because we'll set the default on the backend so this is really more of a typing constraint

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the downside is that canvas recording can only start after the decide API has responded but by definition, recording should start recording until the decided responds, and only continue recording if it's enabled otherwise discard the recordings, so I guess we need to have some default values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC what I meant above is related to cost control, if we don't need this right now, happy to merge as it is, approving it anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, better to start default disabled now because we can switch to default enabled easier than the reverse IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not about the _recordCanvas but rather the _canvasFps nd _canvasQuality.

Based on that https://github.com/PostHog/product-internal/blob/main/requests-for-comments/2023-11-02-mobile-replay-specification.md

before the decide response has been returned the client buffers all recording data

Without default (hardcoded) config for _canvasFps and _canvasQuality, this won't be possible since the 2 properties only have value after decide has responded.

@posthog-bot
Copy link
Collaborator

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM... won't merge till you're back since it's in your 🧠

@daibhin daibhin added the bump minor Bump minor version when this PR gets merged label Jan 22, 2024
@daibhin daibhin merged commit 7dbf654 into master Jan 22, 2024
13 checks passed
@daibhin daibhin deleted the dn-feat/canvas-support branch January 22, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants