onUserVideoStateChanged method

void onUserVideoStateChanged(
  1. String userId,
  2. TUIVideoStreamType streamType,
  3. bool hasVideo,
  4. TUIChangeReason reason,
)

Implementation

void onUserVideoStateChanged(String userId, TUIVideoStreamType streamType, bool hasVideo, TUIChangeReason reason) {
  if (hasVideo) {
    userState.hasVideoStreamUserList.value.add(userId);
  } else {
    userState.hasVideoStreamUserList.value.remove(userId);
  }
  final LinkedHashSet<String> tempList = LinkedHashSet<String>();
  tempList.addAll(userState.hasVideoStreamUserList.value);
  userState.hasVideoStreamUserList.value = tempList;
  if (userId == userState.selfInfo.userId) {
    mediaState.isCameraOpened.value = hasVideo;
  }
}