Closed SN99LZ closed 1 year ago
Please provide a MVCE.
I created a useEffect with a simple code as explained in the docs it works on Android but not on IOS : (REAL DEVICES)
useEffect(() => { const volumeListener = VolumeManager.addVolumeListener((result) => { console.log('##### Volume changed ##### ', result.volume) setVolumeLevel(result.volume); });
return () => { volumeListener.remove(); } }, []);
Are you using a video library like expo-av or react-native-video? If yes, did you try to change the audio mode? https://github.com/hirbod/react-native-volume-manager#ios-audio-session-management
No i don't use a video library but somehow it works now thanks for the help.
@SN99LZ what did you use to make it work? Ran into the same issue with the hook setup.
@saaymeen did you make sure to have the newest version installed?
Hi @hirbod, I am on 1.8.0. Any way to debug the module?
Are you trying it inside an iOS Simulator? This module only works on a real device. Android Emulator works if API Level 33+
I am using it on a real iPad Pro 2018 model, but I had a call with a colleague running an parallel and when I disconnect the call and restart the app, it works. Sorry for the inconvenience, I missed that detail. Could it work while being in a call tho?
I've honestly never tested that case. It might work depending on the Audio Session and Audio Category. This library has multiple setters (setCategory and setMode). With the right combination I am pretty sure it should work (mixWithOthers might be worth a shot)
Hello, on iOS 15 addVolumeListener is NOT triggered when the volume is changed with a slider or when physical volume buttons are pressed on a device.
OS version: 15.6.1 "react-native": "0.67.5"