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
+2 -2
View File
@@ -26,7 +26,7 @@ class _ConnectPageState extends State<ConnectPage> {
final _uriCtrl = TextEditingController();
final _tokenCtrl = TextEditingController();
bool _simulcast = false;
bool _simulcast = true;
bool _busy = false;
@override
@@ -48,7 +48,7 @@ class _ConnectPageState extends State<ConnectPage> {
_uriCtrl.text = prefs.getString(_storeKeyUri) ?? '';
_tokenCtrl.text = prefs.getString(_storeKeyToken) ?? '';
setState(() {
_simulcast = prefs.getBool(_storeKeySimulcast) ?? false;
_simulcast = prefs.getBool(_storeKeySimulcast) ?? true;
});
}
+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() {