initializeMediaDevices method

  1. @override
Future<void> initializeMediaDevices()
override

Implementation

@override
Future<void> initializeMediaDevices() async {
  if (_mParticipant?.peerConnection != null) return;

  final RTCPeerConnection peerConnection = await _createPeerConnection(
    constraints: RTCConfigurations.offerPublisherSdpConstraints,
  );

  _mParticipant = ParticipantMediaState.init(
    ownerId: kIsMine,
    peerConnection: peerConnection,
    onFirstFrameRendered: () => _notify(CallbackEvents.shouldBeUpdateState),
    videoCodec: _currentCallSetting.videoConfig.preferedCodec,
    isE2eeEnabled: _currentCallSetting.e2eeEnabled,
    connectionType: _connectionType,
  );

  _localCameraStream = await _getUserMedia();
  if (_localCameraStream != null) {
    _mParticipant?.setSrcObject(_localCameraStream!);
  }
}