Reputation: 27507
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.
Upvotes: 4
Views: 4665
Reputation: 125
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 .
Upvotes: 1