Skip to content

fix: stop camera stream on page navigation and tab hide#2240

Open
nyxsky404 wants to merge 1 commit into
janavipandole:mainfrom
nyxsky404:fix/camera-stream-stop-on-navigation
Open

fix: stop camera stream on page navigation and tab hide#2240
nyxsky404 wants to merge 1 commit into
janavipandole:mainfrom
nyxsky404:fix/camera-stream-stop-on-navigation

Conversation

@nyxsky404

@nyxsky404 nyxsky404 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

📄 Description

The camera MediaStream was not stopped when the user navigated away from or hid the try-on page, leaving the browser camera indicator active in the background.

Added two event listeners in try-on.js:

  • beforeunload — releases all MediaStream tracks immediately when the user navigates away.
  • visibilitychange — calls the existing stopCamera() when the tab becomes hidden.

🔗 Related Issues

Fixes #2235

🧩 Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation update

✅ Checklist

  • Code follows project styling guidelines
  • Changes are fully responsive and accessible
  • No extraneous logs or debug code left
  • Documentation updated accordingly
  • Built successfully locally
  • Console has zero errors or warnings

Release the MediaStream tracks via beforeunload and
visibilitychange so the browser camera indicator turns
off when the user leaves the try-on page.
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@nyxsky404 is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[BUG] Camera stream not stopped when navigating away from try-on page — camera indicator stays on

1 participant