Setting the user type
PlanetKit provides a feature to set a user type when joining a group call, enabling your application to distinguish between different categories of users.
You can define custom user types (for example, regular users and bots) and tailor your application's behavior or UI based on the user type. Additionally, LINE Planet reserves certain user type values for built-in agent roles.
Supported call type | Minimum SDK version |
---|---|
Group call (conference) | PlanetKit 6.1 |
User types
User types are classified as follows:
- Custom user types
- User types defined and managed by your application
- Value range: 1 to 9999
- PlanetKit user types
- User types used internally by LINE Planet to represent agent roles, defined in
PlanetKitUserType
- Value range: 0, 10000 to 99999
- For more information, see the Agent call documentation.
- User types used internally by LINE Planet to represent agent roles, defined in
Sample code
The following sample code shows how to use the feature to set the user type.
Define and set the user type
Define the application user types according to your requirements. When joining a group call, set a user type with PlanetKitJoinConferenceSettingBuilder
のwithCustomUserTypeKey()
.
enum AppUserType: Int {
case videoBot = 100
}
func joinConference(...) {
...
let settings = try! PlanetKitJoinConferenceSettingBuilder()
...
.withCustomUserTypeKey(userType: AppUserType.videoBot.rawValue)
.build()
let param = PlanetKitConferenceParam(myUserId: myUserId, roomId: roomId, roomServiceId: serviceId, displayName: displayName, delegate: manageable, accessToken: accessToken)
...
let result = PlanetKitManager.shared.joinConference(param: param, settings: settings)
...
}
Implement actions for each user type
Implement actions to be processed according to each user type. You can use the APIs of PlanetKitUserTypeContainer
to check for the user type.
extension ConferenceViewController: PlanetKitConferenceDelegate {
...
func peerListDidUpdate(_ conference: PlanetKitConference, updated: PlanetKitConferencePeerListUpdateParam) {
for peer in updated.addedPeers {
if peer.userType.customUserType == AppUserType.videoBot.rawValue {
print("Video bot has joined. ID: \(peer.id.uniqueId)")
}
}
for peer in updated.removedPeers {
if peer.userType.customUserType == AppUserType.videoBot.rawValue {
print("Video bot has left. ID: \(peer.id.uniqueId)")
}
}
}
}