updateUserVideo method
void
updateUserVideo(
{ - required int uid,
- required bool videoDisabled,
})
Implementation
void updateUserVideo({required int uid, required bool videoDisabled}) {
// if local user updates video
if (uid == value.localUid) {
value = value.copyWith(isLocalVideoDisabled: videoDisabled);
// if remote user updates video
} else if (uid == value.mainAgoraUser.uid) {
value = value.copyWith(
mainAgoraUser: AgoraUser(uid: uid, videoDisabled: videoDisabled));
} else {
List<AgoraUser> tempList = value.users;
int indexOfUser = tempList.indexWhere((element) => element.uid == uid);
if (indexOfUser == -1) return; //this means user is no longer in the call
tempList[indexOfUser] =
tempList[indexOfUser].copyWith(videoDisabled: videoDisabled);
value = value.copyWith(users: tempList);
}
}