init method

Future<void> init(
  1. int srcCallId, [
  2. ILogsModel? logs
])

Create texture id rendering video of the specifed call

Implementation

Future<void> init(int srcCallId, [ILogsModel? logs]) async {
  if (_textureId != kInvalidTextureId) return;
  _srcCallId = srcCallId;
  _logs = logs;

  try {
    _textureId = await PjsipConnectFlutter().videoRendererCreate() ?? 0;
  } on PlatformException catch (err) {
    _logs?.print('Cant create renderer Err: ${err.code} ${err.message}');
  }

  if (_textureId != kInvalidTextureId) {
    _logs?.print('Created textureId: $textureId for callId:$_srcCallId');
    _eventSubscription = EventChannel(
      'SipConnect/Texture$textureId',
    ).receiveBroadcastStream().listen(eventListener, onError: errorListener);

    setSourceCall(srcCallId);
  }
}