Open pappricot opened 4 years ago
I just noticed the same thing testing on Android. On iOS, I previously used setPlaybackCategory to create a toggle, but that does not work on Android either.
I made sure to set the MODIFY_AUDIO_SETTINGS permission. When I press the speaker toggle, the sound does pause for a second, and the volume seems to change for a second-- but sound is playing both through the speaker and the earpiece either way.
@brianomchugh What library did you use to get setPlaybackCategory? I checked on react-native-sound there's no such method..
@pappricot Oops, I meant setCategory... the following works for me with iOS and react-native-sound@0.10.9 (old version). I am going to try an older version on Android to see if it does anything.
if (this.state.speaker) {
this.sound.setCategory("PlayAndRecord")
} else {
this.sound.setCategory("Playback")
}
@pappricot I just noticed in your code you have true for both values of the toggle:
this.state.useEarPiece ? this.sound.setSpeakerphoneOn(true) : this.sound.setSpeakerphoneOn(true)
@pappricot any update on this?
any updates? I can't change the speakers output of on android!
:beetle: Description setSpeakerphoneOn doesn't work
I looked up documentation for setSpeakerphoneOn at https://github.com/zmxv/react-native-sound/wiki/API, where it states that you just need to pass a boolean value into it. What I'm trying to achieve is to have a toggle button for switching on and off setSpeakerphoneOn for voicemail files :beetle: What is the observed behavior? Doesn't seem to work
:beetle: What is the expected behavior? Expected to have a toggle button for switching on and off setSpeakerphoneOn for voicemail files
:beetle: Please post your code: Posting snippets of my code:
:bulb: Does the problem have a test case?
:bulb: **Possible solution**:bulb: Is there a workaround?
:bulb: If the bug is confirmed, would you be willing to create a pull request?
Is your issue with...
Are you using...
react-native run-android
)Which versions are you using?
Does the problem occur on...
If your problem is happening on a device, which device?