ios: Enabled camera and microphone after connect to room

This commit is contained in:
openvidu 2024-08-07 15:51:15 +02:00 committed by Unknown
parent 00248c9870
commit 55d303d7b5
2 changed files with 13 additions and 1 deletions

View File

@ -117,9 +117,21 @@ struct ConnectView: View {
print("Connecting to room...") print("Connecting to room...")
try await roomCtx.connect() try await roomCtx.connect()
print("Room connected") print("Room connected")
await enableCameraAndMicrophone()
} catch { } catch {
print("Failed to get token: \(error.localizedDescription)") print("Error trying to connect to room: \(error.localizedDescription)")
}
}
func enableCameraAndMicrophone() async {
do {
try await room.localParticipant.setCamera(enabled: true)
try await room.localParticipant.setMicrophone(enabled: true)
} catch {
print("Error enabling camera and microphone: \(error.localizedDescription)")
} }
} }
} }