Set avatar for users
Live Audio Room Kit (ZegoUIKitPrebuiltLiveAudioRoom) supports you to customize the user avatar and share it with in-room participants. All you need to do is pass the image URL (PNG, JGP, JGEP, BMP, GIF, and WEBP are supported).
Note
The URL must be within 64 bytes. If exceeds, the default background is displayed.
Here is the reference code:
Untitled
class ViewController: UIViewController {
let selfUserID: String = "userID"
let selfUserName: String = "userName"
let yourAppID: UInt32 = YourAppID
let yourAppSign: String = "YourAppSign"
let roomID: String = "YourRoomID"
@IBAction func startLiveAudio(_ sender: Any) {
// Modify your custom configurations here.
let config: ZegoUIKitPrebuiltLiveAudioRoomConfig = ZegoUIKitPrebuiltLiveAudioRoomConfig.host()
config.userAvatarUrl = "https://www.zegocloud.com/_nuxt/img/discord_nav@2x.8739674.png"// Example
let liveAudioVC = ZegoUIKitPrebuiltLiveAudioRoomVC.init(yourAppID, appSign: yourAppSign, userID: selfUserID, userName: selfUserName, roomID: roomID, config: config)
liveAudioVC.modalPresentationStyle = .fullScreen
self.present(liveAudioVC, animated: true, completion: nil)
}
}
1