getRTCPeer method

Future<RTCPeerConnection> getRTCPeer()

Get current RTC peer connection.

Returns RTCPeerConnection Object which represents the Peer Connection.

Implementation

Future<RTCPeerConnection> getRTCPeer() async {
  _logger.i('Getting RTC Peer');
  if (peer != null) {
    String connectionState = getConnectionState(peer!);
    RTCSessionDescription? currentLocalDescription =
        await peer!.getLocalDescription();
    RTCSessionDescription? currentRemoteDescription =
        await peer!.getRemoteDescription();
    _logger.d(
        '''getRTCPeer return: {$connectionState, $currentLocalDescription, $currentRemoteDescription}''');
  }
  return peer!;
}