Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: muted not working on Android 12/13 for Samsung and Pixel devices #4162

Open
eweseongyeoh opened this issue Sep 11, 2024 · 4 comments
Open
Labels
Accepted Issue is confirmed and accepted by maintainers team bug help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it. Platform: Android Repro Provided

Comments

@eweseongyeoh
Copy link

eweseongyeoh commented Sep 11, 2024

Version

6.5.0

What platforms are you having the problem on?

Android

System Version

Android 13

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

muted video still play audio when loaded on Samsung/Pixel devices with Android 12 or 13; please note that we have attempted to load the same video on other devices like Huawei/Xiaomi/oppo with similar Android version and they work fine in them.

we have applied a workaround with selectedAudioTrack={{type: SelectedTrackType.DISABLED}} configuration, it isn't ideal, but it works for us.

Reproduction Link

No response

Reproduction

Step to reproduce this bug are:

  1. Load a muted video on Samsung/Pixel devices with Android 12 or 13
  2. Notice video still play audio when loaded
Copy link

Thank you for your bug report. We will review it and get back to you if we need more information.

Copy link

Thank you for your bug report. We will review it and get back to you if we need more information.

@freeboub
Copy link
Collaborator

https://developer.android.com/reference/kotlin/androidx/media3/common/Player#setVolume(float) currently we don't check if volume control is available ... I think you have a correct workaround.
media3 volume apis are handling volume on player side and it can be disturbing for end user to have 2 parrallel volume management. I can advise to use something like : https://www.npmjs.com/package/react-native-volume-manager to handle volume of the device, not one the player

@freeboub freeboub added Accepted Issue is confirmed and accepted by maintainers team and removed Waiting for Review labels Sep 15, 2024
@freeboub
Copy link
Collaborator

freeboub commented Sep 18, 2024

I don't reproduce the issue with emulator. It would be interesting to test following patch to see if the log is displayed !

Tested on emulator Pixel 8 API 31 (Android 12)

diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
index 0714115e..62055c9d 100644
--- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
+++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
@@ -2133,7 +2133,12 @@ public class ReactExoplayerView extends FrameLayout implements
     public void setMutedModifier(boolean muted) {
         this.muted = muted;
         if (player != null) {
-            player.setVolume(muted ? 0.f : audioVolume);
+            Player.Commands cmd = player.getAvailableCommands();
+            if (cmd.contains(Player.COMMAND_SET_VOLUME)) {
+                player.setVolume(muted ? 0.f : audioVolume);
+            } else {
+                DebugLog.e(TAG, "player doesn't support volume management");
+            }
         }
     }
 

@freeboub freeboub added the help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it. label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue is confirmed and accepted by maintainers team bug help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it. Platform: Android Repro Provided
Projects
None yet
Development

No branches or pull requests

2 participants