logo
当前页

设置用户头像


语聊房 UIKit(Live Audio Room Kit) 支持您通过传递图片的 URL(支持 PNG、JPG 格式)自定义用户头像,并与房间内参与者共享。

URL 必须在 64 字节以内,如果超过 64 字节,将显示默认背景。

实现流程

具体实现方式,请参考如下代码:

Java
Kotlin
ZegoUIKitPrebuiltLiveAudioRoomConfig config;
if (isHost) {
   config = ZegoUIKitPrebuiltLiveAudioRoomConfig.host();
} else {
   config = ZegoUIKitPrebuiltLiveAudioRoomConfig.audience();
}
config.userAvatarUrl = YOUR IMAGE URL;
ZegoUIKitPrebuiltLiveAudioRoomFragment fragment = ZegoUIKitPrebuiltLiveAudioRoomFragment.newInstance(appID,appSign, userID, userName, roomID, config);// 请从 ZEGO 控制台获取 AppID、Appsign。
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commitNow();
1
Copied!
val config: ZegoUIKitPrebuiltLiveAudioRoomConfig = if (isHost) {
     ZegoUIKitPrebuiltLiveAudioRoomConfig.host()
} else {
     ZegoUIKitPrebuiltLiveAudioRoomConfig.audience()
}
config.userAvatarUrl = YOUR IMAGE URL

val fragment = ZegoUIKitPrebuiltLiveAudioRoomFragment.newInstance(appID, appSign, userID, userName, roomID, config)
supportFragmentManager.beginTransaction()
            .replace(R.id.fragment_container, fragment)
            .commitNow()
1
Copied!

Previous

切换语言

Next

自定义麦位

当前页

返回到顶部