Use high level track APIs in example app & docs (#36)

This commit is contained in:
David Zhao
2021-11-26 23:51:37 -08:00
committed by GitHub
parent c50e0269cf
commit 66dbc94c1a
4 changed files with 23 additions and 45 deletions
+7 -9
View File
@@ -68,19 +68,17 @@ class _RoomPageState extends State<RoomPage> {
if (result != true) return;
// video will fail when running in ios simulator
try {
// Create video track
final localVideo = await LocalVideoTrack.createCameraTrack();
// Try to publish the video
await widget.room.localParticipant.publishVideoTrack(localVideo);
// Create mic track
final localAudio = await LocalAudioTrack.create();
// // Try to publish audio
await widget.room.localParticipant.publishAudioTrack(localAudio);
await widget.room.localParticipant.setCameraEnabled(true);
} catch (error) {
print('could not publish video: $error');
await context.showErrorDialog(error);
}
try {
await widget.room.localParticipant.setMicrophoneEnabled(true);
} catch (error) {
print('could not publish audio: $error');
await context.showErrorDialog(error);
}
}
void _onRoomDidUpdate() {