Manage Audio and Video Devices - iOS
This feature allows hosts to switch their microphone, speaker, or camera devices during a live stream. Only hosts (in SEND_AND_RECV
mode) can change input/output devices, ensuring they maintain control over their audio and video quality, while audience members (in RECV_ONLY
mode) continue to receive the broadcast seamlessly.
Changing Audio Input Device​
getMics()
​
-
The
getMics()
method will return an array of tuples, where each tuple consists of two elements deviceName and deviceType. -
returns
[deviceName: String, deviceType: String]
Example​
- Swift
let devices = meeting.getMics()
for device in devices {
print(device.deviceName) //sample output [("Speaker","Speaker"), ("iPhone Microphone", "Receiver")]
}
changeMic()
​
- Participant can change the audio device using
changeMic(selectedDevice: String)
method ofMeeting
classs
Example​
- Swift
func changeAudioDevice(device: String) {
changeMic(selectedDevice: "Speaker") //output will be changed to speaker
}
caution
selectedDevice string should only be from the deviceName that you get from the returned array of getMics()
.
Changing Camera Input Device​
switchWebcam()
​
- By using
switchWebcam()
function, a participant can stream from front / rear camera during the meeting.
Example​
- Swift
/// keep track of camera position
private var cameraPosition = CameraPosition.front
@IBAction func cameraButtonTapped(_ sender: Any) {
cameraPosition.toggle()
// switch camera to front/back
// Values: .front, .back
self.meeting?.switchWebcam(position: cameraPosition)
}
API Reference​
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord