Skip to content

fix: report zero volume from useTrackVolume - #473

Merged
davidliu merged 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/use-track-volume-silence
Oct 15, 2026
Merged

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

@davidliu davidliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@davidliu
davidliu merged commit 3c3f5d1 into livekit:main Oct 15, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
davidliu pushed a commit that referenced this pull request Oct 17, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @livekit/react-native@3.1.0

### Minor Changes

- Update @livekit/react-native-webrtc to 150.1.0. -
[#461](#461)
([@cloudwebrtc](https://github.com/cloudwebrtc))

iOS: the `LiveKitWebRTC` pod is published to the
[livekit/podspecs](https://github.com/livekit/podspecs) spec repo and
the CocoaPods trunk. The CocoaPods trunk stops accepting new pods on
December 2, 2026, so later `LiveKitWebRTC` versions will only be
available from livekit/podspecs. Add both sources to the top of your
`ios/Podfile`:

  ```ruby
  source 'https://github.com/livekit/podspecs.git'
  source 'https://cdn.cocoapods.org/'
  ```

Keep the `cdn.cocoapods.org` line: once a `Podfile` lists any `source`,
CocoaPods stops using trunk by default, and your other pods still come
from there.

Expo users don't need to edit the `Podfile` by hand: version 1.1.0 and
later of the [Expo
plugin](https://github.com/livekit/client-sdk-react-native-expo-plugin)
adds these sources during prebuild.

If `pod install` then reports that it could not find compatible versions
for `LiveKitWebRTC`, run `cd ios && pod update LiveKitWebRTC`.

### Patch Changes

- android: Fix build failure on Android Gradle Plugin 9+ for Expo 58+ -
[#454](#454)
([@gabrieldonadel](https://github.com/gabrieldonadel))

- android: Fix useTrackVolume reading audio samples in the wrong byte
order -
[#466](#466)
([@darrenabridge](https://github.com/darrenabridge))

- Require `livekit-client` ^2.20.0. Earlier 2.19.x releases pre-allocate
media sections in single peer connection mode, which React Native's
libwebrtc doesn't support, causing remote tracks to never be subscribed
or render black (livekit/client-sdk-js#1977,
livekit/client-sdk-js#2113). -
[#463](#463)
([@davidliu](https://github.com/davidliu))

- Fix `useTrackVolume` staying at the last non-zero value when the audio
track goes silent -
[#473](#473)
([@RaphaelFakhri](https://github.com/RaphaelFakhri))

- Fix `useRoom` disconnecting the room on every render when
`sortParticipants` is passed as an inline function -
[#472](#472)
([@cpruijsen](https://github.com/cpruijsen))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants