connected method

void connected(
  1. RemoteParticipant participant
)

Updates the agent with information from the connected participant.

Implementation

void connected(RemoteParticipant participant) {
  final AgentState? nextAgentState = _readAgentState(participant);
  final RemoteAudioTrack? nextAudioTrack = _resolveAudioTrack(participant);
  final RemoteVideoTrack? nextAvatarTrack = _resolveAvatarVideoTrack(participant);

  final bool shouldNotify = _state != _AgentLifecycle.connected ||
      _agentState != nextAgentState ||
      !identical(_audioTrack, nextAudioTrack) ||
      !identical(_avatarVideoTrack, nextAvatarTrack) ||
      _error != null ||
      _isBuffering;

  _state = _AgentLifecycle.connected;
  _isBuffering = false;
  _error = null;
  _agentState = nextAgentState;
  _audioTrack = nextAudioTrack;
  _avatarVideoTrack = nextAvatarTrack;

  if (shouldNotify) {
    notifyListeners();
  }
}