Skip to content

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
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

@ioannisj ioannisj requested a review from a team as a code owner February 6, 2026 15:54
@ForTheYin
Copy link

Hi PostHog team,

Thanks for adding this feature for Flutter. I've tried out this feature branch on an app and followed the instructions here.

I have the PostHogConfig.sessionReplay boolean set to false and then I attempted to manually record a session.

This is my config:

    final posthogConfig = PostHogConfig(_config.posthogApiKey);
    posthogConfig.host = _config.posthogHost;
    posthogConfig.debug = kDebugMode;
    posthogConfig.captureApplicationLifecycleEvents = true;
    posthogConfig.sessionReplay = false;
    posthogConfig.sessionReplayConfig.maskAllTexts = false;
    posthogConfig.sessionReplayConfig.maskAllImages = false;

   // Some time later...
   Posthog().startSessionRecording(resumeCurrent: false)

   // Also tried it with
   Posthog().startSessionRecording(resumeCurrent: true)

Both startSessionRecording usages create recordings that have timestamps, but no content in the session replay preview (no images fetched).


The recording work normally when I set sessionReplay to true, but then this creates a unwanted session replay.

I also tried to manually remove the config.sessionReplay check in PostHogWidget, but that didn't work either.

    // posthog_widget.dart - PostHogWidgetState, L34
    if (config == null || !config.sessionReplay) {
      return;
    }

iOS 26.0 Simulator & a real Device, Flutter 3.35.7

@ioannisj
Copy link
Collaborator Author

ioannisj commented Feb 7, 2026

Hey @ForTheYin thanx for testing this out! 🙏 I also noticed the same thing happen to me yesterday during a final test before releasing and held off the merge. This used to work fine before so it must be either some late changes made here or in the ingestion side of things. I'll try to sort this asap

@ioannisj
Copy link
Collaborator Author

ioannisj commented Feb 7, 2026

Actually let me correct myself, this used to work with the config enabled, so the happy path you describe here. I bumped into the same issue when config was disabled

@ioannisj
Copy link
Collaborator Author

Okay turns out that PostHogWidget was disabled because of config, and we had no way of dynamically re-enabling it.

@marandaneto pushed a fix for this in c385b62. Used an internal ValueNotifier cause I didn't wanat to couple PostHog with PostHogWidget. Could not think of a better alternative. Worth a second look

@ioannisj ioannisj enabled auto-merge (squash) February 11, 2026 14:47
@ioannisj ioannisj merged commit 91a8a95 into main Feb 11, 2026
16 checks passed
@ioannisj ioannisj deleted the feat/start-stop-session-recording branch February 11, 2026 15:22
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

3 participants