Closed KZinc closed 4 years ago
I found that if I use 'Voice' I got needed result.
@KZinc can you share your code? i'm facing same issue.
Sound.setCategory('Voice');
is what does the trick. It is not documented anywhere but it worked for me.
I believe it works because of https://github.com/zmxv/react-native-sound/blob/1aa45f25c8c03ea5c17fac18564c3928bd023113/android/src/main/java/com/zmxv/RNSound/RNSoundModule.java#LL88C1-L88C1 for Android while for iOS the default is to play through the ear speaker.
:beetle: Description
I want sound not from main speaker, but from ear one. :beetle: What have you tried? I've tried
Sound.setCategory('Playback');
With all of the categories, Alarm makes sound twice quite but still not from speakerphone i want.There is closed request which says I should use
Sound.setCategory('Playback');
:beetle: Please post your code: import Sound from 'react-native-sound'; Sound.setCategory('Playback');const [voice] = useState( new Sound(message, () => { if (!timeout) { setTimeoutValue(setInterval(() => { voice.getCurrentTime((pos) => { setCounter(Math.floor((voice.getDuration() - pos) * 10)); }); }, 500)); } }), );
const play = (): void => { voice.play(() => voice.release()); };
:bulb: Possible solution
Is your issue with...
[ ] Android Are you using...
[ ] React Native CLI (e.g.
react-native run-android
)Which versions are you using?
Does the problem occur on...
If your problem is happening on a device, which device?