openvidu-react-native: Added mute unmute speaker
This commit is contained in:
parent
64f1cc53ef
commit
0c2e261c51
@ -12,6 +12,8 @@ import {
|
|||||||
Image,
|
Image,
|
||||||
PermissionsAndroid,
|
PermissionsAndroid,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
import InCallManager from 'react-native-incall-manager';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { OpenViduReactNativeAdapter, OpenVidu, RTCView } from 'openvidu-react-native-adapter';
|
import { OpenViduReactNativeAdapter, OpenVidu, RTCView } from 'openvidu-react-native-adapter';
|
||||||
@ -38,7 +40,8 @@ export default class App extends Component<Props> {
|
|||||||
mirror: true,
|
mirror: true,
|
||||||
videoSource: undefined,
|
videoSource: undefined,
|
||||||
video: true,
|
video: true,
|
||||||
audio: true
|
audio: true,
|
||||||
|
speaker: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +275,12 @@ export default class App extends Component<Props> {
|
|||||||
this.setState({ video: !this.state.video });
|
this.setState({ video: !this.state.video });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
muteUnmuteSpeaker() {
|
||||||
|
InCallManager.setSpeakerphoneOn(!this.state.speaker);
|
||||||
|
this.setState({ speaker: !this.state.speaker });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
@ -306,6 +315,14 @@ export default class App extends Component<Props> {
|
|||||||
color="#3383FF"
|
color="#3383FF"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
<View style={styles.button}>
|
||||||
|
<Button
|
||||||
|
onLongPress={() => this.muteUnmuteSpeaker()}
|
||||||
|
onPress={() => this.muteUnmuteSpeaker()}
|
||||||
|
title={this.state.speaker ? 'Mute Speaker' : 'Unmute Speaker'}
|
||||||
|
color="#79b21e"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
<View style={styles.button}>
|
<View style={styles.button}>
|
||||||
<Button
|
<Button
|
||||||
onLongPress={() => this.muteUnmuteCamera()}
|
onLongPress={() => this.muteUnmuteCamera()}
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
"openvidu-react-native-adapter": "file:openvidu-react-native-adapter-2.17.0.tgz",
|
"openvidu-react-native-adapter": "file:openvidu-react-native-adapter-2.17.0.tgz",
|
||||||
"react": "17.0.1",
|
"react": "17.0.1",
|
||||||
"react-native": "0.64.0",
|
"react-native": "0.64.0",
|
||||||
"react-native-get-random-values": "1.6.0"
|
"react-native-get-random-values": "1.6.0",
|
||||||
|
"react-native-incall-manager": "3.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.13.10",
|
"@babel/core": "7.13.10",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user