initialize method

Future<void> initialize(
  1. String key, {
  2. required WebRTCCodec codec,
})

Implementation

Future<void> initialize(
  String key, {
  required WebRTCCodec codec,
}) async {
  final KeyProviderOptions keyProviderOptions = KeyProviderOptions(
    sharedKey: true,
    ratchetSalt: Uint8List.fromList(key.codeUnits),
    ratchetWindowSize: 16,
  );

  _keyProvider ??= await _frameCyrptorFactory.createDefaultKeyProvider(
    keyProviderOptions,
  );

  _videoCodec = codec;

  await _keyProvider?.setSharedKey(key: aesKey);
}