setVideoEnabled method
- bool enabled, {
- MediaSourceKind source = MediaSourceKind.device,
Sets the inbound video of this CallMember as enabled.
Implementation
Future<void> setVideoEnabled(
bool enabled, {
MediaSourceKind source = MediaSourceKind.device,
}) async {
Log.debug('setVideoEnabled($enabled, $source)', '$runtimeType');
if (_videoGuard.isLocked) {
return;
}
await _videoGuard.protect(() async {
final bool previous = switch (source) {
MediaSourceKind.device => hasDeviceVideo.value,
MediaSourceKind.display => hasDisplayVideo.value,
};
final RxBool reactive = switch (source) {
MediaSourceKind.device => hasDeviceVideo,
MediaSourceKind.display => hasDisplayVideo,
};
try {
reactive.value = enabled;
if (enabled) {
await _connection?.enableRemoteVideo(source);
} else {
await _connection?.disableRemoteVideo(source);
}
} catch (e) {
reactive.value = previous;
}
});
}