Skip to content

fix: report zero volume from useTrackVolume - #473

Open
RaphaelFakhri wants to merge 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/use-track-volume-silence
Open

RaphaelFakhri wants to merge 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/use-track-volume-silence

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Fixes useTrackVolume so it reports silence.

The native volume processors emit volume: 0 when a track is silent or muted. The event handler checked event.volume for truthiness, so a value of 0 was ignored and the hook kept returning the last non-zero volume. A level meter built on the hook stays stuck at its last level after the speaker stops.

The handler now only skips events where volume is null or undefined.

Testing:

  • The repo has no jest tests for hooks yet, so this PR keeps the change to the one-line fix and a changeset.
  • A local jest test that emits a non-zero volume followed by 0 fails before the change (Expected: 0, Received: 0.4) and passes after it. It needs react-test-renderer and a jest environment change, so it is not included. It can be added on request.
  • yarn lint and yarn typescript pass.

@changeset-bot

changeset-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b3bc601

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

This PR includes changesets to release 1 package
Name Type
@livekit/react-native 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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

1 participant