Skip to content

feat: add manual start and stop recording#256

Open
ioannisj wants to merge 3 commits intomainfrom
feat/start-stop-session-recording
Open

feat: add manual start and stop recording#256
ioannisj wants to merge 3 commits intomainfrom
feat/start-stop-session-recording

Conversation

@ioannisj
Copy link
Collaborator

@ioannisj ioannisj commented Jan 21, 2026

💡 Motivation and Context

Closes #124
Docs PR: PostHog/posthog.com#14487

  • Add manual session recording control APIs (iOS, Android, Web)
  • Expose isSessionReplayActive to match iOS and Android implementation

💚 How did you test it?

Manual testing:

  • iOS
  • Android
  • Web

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

@ioannisj ioannisj marked this pull request as ready for review January 29, 2026 18:35
@ioannisj ioannisj requested a review from a team January 29, 2026 18:35
case 'isSessionReplayActive':
// not supported on Web
// Flutter Web uses the JS SDK for Session replay
return false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a behavior change needed to expose to public API.
Safeguard to skip session recordings in Flutter was moved to native_communicator.dart

@@ -0,0 +1,109 @@
# Disabled rules
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ported from posthog-ios repo

@@ -1,5 +1,9 @@
## Next

- feat: add manual session recording control APIs ([#256](https://github.com/PostHog/posthog-flutter/pull/256))
Copy link
Member

Choose a reason for hiding this comment

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

do those API work even if config.sessionReplay is disabled or both ways?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what we did for the other sdks I believe. So if local config is false, people can start a recording later on manually.

If remote config/flags is false, then no-op

Trying to validate these with some local testing


@override
Future<void> startSessionRecording({bool resumeCurrent = true}) async {
if (!isSupportedPlatform()) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!isSupportedPlatform()) {
if (!isSupportedPlatform() || macOS) {

all those methods should bail if its a macOS app since replay isnt supported, theres no need to call method channels if we know its not gonna work
the code above is just pseudocode

Copy link
Member

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

left 2 comments otherwise LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manually start and stop session recordings

2 participants