HMSUpdateListener
PROTOCOL
@objc public protocol HMSUpdateListener: AnyObject
100ms SDK provides callbacks to the client app about any change or update happening in the room after a user has joined by implementing HMSUpdateListener. These updates can be used to render the video on screen or to display other info regarding the room.
Methods
on(join:)
@objc(onJoin:) func on(join room: HMSRoom)
This will be called on a successful JOIN of the room by the user This is the point where applications can stop showing its loading state
- Parameter room: the room which was joined
Parameters
Name | Description |
---|---|
room | the room which was joined |
on(room:update:)
@objc(onRoom:update:) func on(room: HMSRoom, update: HMSRoomUpdate)
This is called when there is a change in any property of the Room
- Parameters:
- room: the room which was joined
- update: the triggered update type. Should be used to perform different UI Actions
Parameters
Name | Description |
---|---|
room | the room which was joined |
update | the triggered update type. Should be used to perform different UI Actions |
on(peer:update:)
@objc(onPeer:update:) func on(peer: HMSPeer, update: HMSPeerUpdate)
This will be called whenever there is an update on an existing peer or a new peer got added/existing peer is removed. This callback can be used to keep a track of all the peers in the room
- Parameters:
- peer: the peer who joined/left or was updated
- update: the triggered update type. Should be used to perform different UI Actions
Parameters
Name | Description |
---|---|
peer | the peer who joined/left or was updated |
update | the triggered update type. Should be used to perform different UI Actions |
on(track:update:for:)
@objc(onTrack:update:peer:) func on(track: HMSTrack, update: HMSTrackUpdate, for peer: HMSPeer)
This is called when there are updates on an existing track or a new track got added/existing track is removed This callback can be used to render the video on screen whenever a track gets added
- Parameters:
- track: the track which was added, removed or updated
- update: the triggered update type
- peer: the peer for which track was added, removed or updated
Parameters
Name | Description |
---|---|
track | the track which was added, removed or updated |
update | the triggered update type |
peer | the peer for which track was added, removed or updated |
on(error:)
@objc(onError:) func on(error: HMSError)
This will be called when there is an error in the system and SDK has already retried to fix the error
- Parameter error: the error that occured
Parameters
Name | Description |
---|---|
error | the error that occured |
on(message:)
@objc(onMessage:) func on(message: HMSMessage)
This is called when there is a new broadcast message from any other peer in the room This can be used to implement chat is the room
- Parameter message: the received broadcast message
Parameters
Name | Description |
---|---|
message | the received broadcast message |
on(roleChangeRequest:)
@objc(roleChangeRequest:) optional func on(roleChangeRequest: HMSRoleChangeRequest)
This is called when a role change request arrives
- Parameter roleChangeRequest: the request for role change info
Parameters
Name | Description |
---|---|
roleChangeRequest | the request for role change info |
on(updated:)
@objc(onUpdatedSpeakers:) func on(updated speakers: [HMSSpeaker])
This is called every 1 second with list of active speakers
A HMSSpeaker object contains -
- HMSPeer: the peer who is speaking
- trackID: the track identifier which is emitting audio
- level: a number within range 1-100 indicating the audio volume A peer who is not present in the list indicates that the peer is not speaking This can be used to highlight currently speaking peers in the room
- Parameter speakers: the list of speakers
Parameters
Name | Description |
---|---|
speakers | the list of speakers |
onReconnecting()
@objc func onReconnecting()
onReconnected()
@objc func onReconnected()
ed()