设置昵称、头像(全平台)
本文介绍如何设置用户的头像和昵称。
设置头像、昵称
如果您需要自定义昵称或头像,可以使用如下接口进行更新:
TUICallKit.createInstance(context).setSelfInfo("jack", "https:/****/user_avatar.png", callback)
TUICallKit.createInstance(context).setSelfInfo("jack", "https:/****/user_avatar.png", callback);
[[TUICallKit createInstance] setSelfInfo:@"" avatar:@"" succ:^{} fail:^(int code, NSString *errMsg) {}];
TUICallKit.createInstance().setSelfInfo(nickname: "", avatar: "") {} fail: { code, message in}
TUIResult result = TUICallKit.instance.setSelfInfo('userName', 'url:********');
const options = {nickName: 'jack',avatar: 'https:/****/user_avatar.png'}TUICallKit.setSelfInfo(options, (res) => {if (res.code === 0) {console.log('setSelfInfo success');} else {console.log(`setSelfInfo failed, error message = ${res.msg}`);}});
try {await TUICallKitServer.setSelfInfo({ nickName: "jack", avatar: "http://xxx" });} catch (error: any) {alert(`[TUICallKit] Failed to call the setSelfInfo API. Reason: ${error}`);}
注意:
因为用户隐私限制,非好友之间的通话,被叫的昵称和头像更新可能会有延迟,一次通话成功后就会顺利更新。