Skip to content

Conversation

@adrian-niculescu
Copy link
Contributor

Fixes #296

Problem

Camera active indicator remains on indefinitely when a Room is disconnected due to network failure (e.g., turning off WiFi/mobile data). This issue was reported in #296 and affects privacy, user experience, and battery life.

Root Cause

When network disconnection triggers reconnection attempts:

  1. LocalParticipant.prepareForFullReconnect() clears trackPublications and moves tracks to a republishes list for later republishing
  2. When reconnection fails permanently, the room disconnects
  3. LocalParticipant.cleanup() only disposes tracks in trackPublications (which is now empty)
  4. Tracks in the republishes list are orphaned and never disposed, leaving camera resources allocated

Solution

Modified LocalParticipant.cleanup() to also dispose tracks from the republishes list that were saved for reconnection but never got republished. This ensures proper camera resource cleanup even when reconnection fails.

Testing

Tested the fix by:

  1. Connecting to a room with video enabled
  2. Turning off internet connection to trigger failed reconnection
  3. Verifying camera indicator turns off when room disconnects

The camera indicator now properly turns off after failed reconnection attempts.

cc @davidliu

@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: fa6bf5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
client-sdk-android Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Disposed orphaned tracks from failed reconnection attempts. When reconnection fails after prepareForFullReconnect() was called, tracks were moved to the republishes list but never disposed when the room disconnected permanently, leaving camera resources allocated.

Fixes livekit#296
@adrian-niculescu adrian-niculescu force-pushed the fix/camera-indicator-orphaned-tracks branch from dfe2940 to fa6bf5e Compare November 10, 2025 20:52
@davidliu davidliu merged commit ce166ab into livekit:main Nov 16, 2025
2 checks passed
@davidliu
Copy link
Contributor

Thanks for the PR!

@davidliu davidliu mentioned this pull request Nov 16, 2025
@adrian-niculescu adrian-niculescu deleted the fix/camera-indicator-orphaned-tracks branch November 16, 2025 17:47
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.

Camera active indicator stays on when Room is disconnected by turning off the network connection

2 participants