'React Native: How to mute volume?
How do you mute the volume in React Native (specifically for Android)?
I am using https://github.com/oney/react-native-webrtc but disabling the audio tracks for that doesn't seem to do anything, so I want to just mute the phone completely.
Solution 1:[1]
I used offerToReceiveAudio : false options to tell my PeerConnection that don't capture the audio track , in createOffer method .
For remote PeerConnection muting use this :
const pc = new RTCPeerConnection();
pc.createOffer({offerToReceiveVideo: true , offerToReceiveAudio: false}).then(sdpOffer=>{
///
});
And use these params for the local media stream :
const mediaParams = {
video : true ,
audio : false ,
options:{ muted : true }
};
getUserMedia(mediaParams, (error, stream) => {});
But I guess there's no certain way to mute the RTCView directly .
Solution 2:[2]
Inside the video tag use:
<Video ref={this.video}
isMuted={true}
source={{ uri: this.state.video_file }}/>.
Hope It would work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Pabel Mahbub |
