setRemoteVideoEnabled method
- bool enabled
Sets inbound video in this OngoingCall as enabled
or not.
No-op if isRemoteVideoEnabled is already enabled
.
Implementation
Future<void> setRemoteVideoEnabled(bool enabled) async {
Log.debug('setRemoteVideoEnabled($enabled)', '$runtimeType');
try {
final List<Future> futures = [];
if (enabled && isRemoteVideoEnabled.isFalse) {
for (CallMember m in members.values.where((e) => e.id != _me)) {
futures.addAll([
m.setVideoEnabled(true, source: MediaSourceKind.device),
m.setVideoEnabled(true, source: MediaSourceKind.display),
]);
}
isRemoteVideoEnabled.toggle();
} else if (!enabled && isRemoteVideoEnabled.isTrue) {
for (CallMember m in members.values.where((e) => e.id != _me)) {
m.tracks.where((e) => e.kind == MediaKind.video).forEach((e) {
futures.add(m.setVideoEnabled(false, source: e.source));
});
}
isRemoteVideoEnabled.toggle();
}
await Future.wait(futures);
} on MediaStateTransitionException catch (_) {
// No-op.
}
}