Skip to content

[Bug]: [Android][v7.0.0-beta.11] Repeated muted assignments prevent volume restoration #5043

Description

@HanSeonWoo

What happened?

On Android, assigning muted=true more than once can overwrite the volume that should be restored when unmuting.

The first mute assignment stores the current player volume in userVolume and sets player.volume to 0. A second muted=true assignment then stores the current volume (0) in userVolume. When muted=false is assigned later, the player restores 0, so audio remains silent.

Expected behavior: repeated assignments of the same muted value should be a no-op, and unmuting should restore the volume from before muting.

The same application flow works as expected on iOS.

Adding the following guard to the Android muted setter preserves userVolume and restores audio correctly:

if (value == muted) return@mainThreadProperty

Steps to reproduce

A common setup is to assign the initial mute value when creating the player and synchronize the same React state in an effect:

const [muted, setMuted] = useState(true);

const player = useVideoPlayer(source, (player) => {
  player.muted = muted;
});

useEffect(() => {
  player.muted = muted;
}, [player, muted]);

On the initial render:

  1. The useVideoPlayer setup callback assigns player.muted = true.
  2. The effect runs and assigns player.muted = true again.
  3. Call setMuted(false).
  4. Observe that playback remains silent.

The internal state changes as follows:

Initial state
player.volume = 1.0
userVolume = 1.0

Setup: muted=true
player.volume = 0.0
userVolume = 1.0

Effect: muted=true
player.volume = 0.0
userVolume = 0.0

setMuted(false)
player.volume = 0.0

The issue was reproduced without the guard. With the guard applied, unmuting restored speaker audio correctly on both tested Android devices.

Reproduction repository

No response

react-native-video version

7.0.0-beta.11

react-native version

0.81.5

react-native-nitro-modules version

0.35.0

Platforms

Android

OS version

Android 12 (Galaxy Fold 5G, SM-F907N) / Android 16 (Galaxy A33 5G, SM-A336N)

Device

Real device

Architecture

New Architecture

Expo

No (bare / React Native CLI)

Last working version

No response

Media / source type

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions