setEncryptInfo method
设置传输时使用内置加密的方式
key 是加密密钥,长度限制为 36 位,超出部分将会被截断
返回值:
0:调用成功;<0:调用失败,具体原因参看 ReturnStatus。
注意:该方法必须在进房之前调用,可重复调用,以最后调用的参数作为生效参数。
Implementation
Future<int?> setEncryptInfo({
required EncryptType aesType,
required String key,
}) {
if (Platform.isAndroid) {
return ($instance as $a.RTCEngine).setEncryptInfo(aesType.$value, key)
as Future<int?>;
} else {
return ($instance as $i.ByteRTCEngine).setEncryptInfo(
// Which should be t_xxx.code_to_ios
// But it's not exist, besides, the values of ByteRTCEncryptType and EncryptType are same.
// It's can be written as following.
($i.ByteRTCEncryptType.values.firstWhere(
(e) => e.$value == aesType.$value,
)),
key,
) as Future<int?>;
}
}