Callbacks
Responses to any API call from the app is handled by callbacks. For example, on successful creation of audio session, onSessionCreated callback gets invoked or, if there is any error, onSessionError API gets invoked.
Following are the callbacks SDK provides. Session callbacks are common for all session types (audio, video, chat) and each session type has its own specific callbacks. The app can receive these callbacks by implementing appropriate delegates.
Stream Related
Stream related callbacks are provided by IrisRtcStream class.
onLocalStream
This callback gets invoked when the local preview is available.
Stream.onLocalStream = (stream) => {
// Stream is received
}
Parameters | |
---|---|
stream | Media stream |
onStreamError
This callback gets invoked when there is an error during stream creation process.
Stream.onStreamError = (errorCode, errorMessage) => {
// Throws error if failed to create stream
}
Parameters | |
---|---|
errorCode | Error Code |
errorMessage | Error description |
Session Related
Session related callbacks are common for video, audio and chat sessions. By implementing corresponding delegates for each sessions user can access these callbacks
onSessionCreated
This callback gets invoked when the room is created successfully.
irisRtcSession.onSessionCreated = (roomId) => {
// Session is created
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
onSessionJoined
This callback gets invoked when the receiver joins the room successfully.
irisRtcSession.onSessionJoined = (roomId, myJid) => {
// User joined the session
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
myJid | Jid of the user |
onSessionParticipantJoined
This callback gets invoked at the sender side when the remote participant joins the room.
irisRtcSession.onSessionParticipantJoined = (roomId, participantJid) => {
// Remote participant joined the session
Parameters | |
---|---|
roomId | Room id received from 555 backend |
participantJid | Participant Jid |
onSessionConnected
This callback gets invoked when the session is connected.
irisRtcSession.onSessionConnected = (roomId) => {
// User joined the session
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
onSessionEnd
This callback gets invoked when the session ends.
irisRtcSession.onSessionEnd = (roomId) => {
};
Parameters | |
---|---|
roomId | Room id received from 555 backend |
onSessionParticipantLeft
This callback gets invoked when the participant leaves the room.
irisRtcSession.onSessionParticipantLeft = (roomId, participantJid, closeSession) => {
//
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
participantId | Participant Id |
closeSession | is true when all participants have left the room |
onSessionParticipantProfile
This callback gets invoked when the participant profile is changed.
irisRtcSession.onUserProfileChange = (roomId, participantJid, profileJson) => {
//
}
Parameters | |
---|---|
roomId | Room id received from Iris backend |
participantJid | Participant Jid |
profileJson | user profile json object containing participant's name and role |
onSessionDominantSpeakerChanged
This callback gets invoked when dominant speaker is changed in multiple stream.
irisRtcSession.onDominantSpeakerChanged = (roomId, dominantSpeakerId) => {
//
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
dominantSpeakerId | Participant Jid |
traceId | Trace id |
onSessionParticipantNotResponding
This callback gets invoked when remote participant is not responding.
irisRtcSession.onSessionParticipantNotResponding = (roomId, participantJid) => {
//
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
participantJid | Participant Jid |
traceId | Trace id |
onSessionTypeChanged
This callback gets invoked when there is change in session type.
irisRtcSession.onSessionTypeChange = (roomId, participantJid, sessionType) => {
//
}
Parameters | |
---|---|
roomId | Room id received from 555 backend |
participantJid | Participant Jid |
sessionType | Session type |
onSessionParticipantAudioMuted
This callback gets invoked when audio of remote participant muted or unmuted.
irisRtcSession.onSessionParticipantAudioMuted = (roomId, participantJid, audioMute) => {
};
Parameters | |
---|---|
roomId | Room id received from 555 backend |
participantJid | Participant Jid |
audioMute | Audio state, mute or unmute |
onSessionParticipantVideoMuted
This callback gets invoked when video of remote participant muted or unmuted.
irisRtcSession.onSessionParticipantVideoMuted = (roomId, jid, videoMute) => {
};
Parameters | |
---|---|
mute | Video state, mute or unmute |
participantId | Participant Id |
roomId | Room id received from Iris backend |
traceId | Trace id |
onSessionError
This callback gets invoked when there is error while the session is active.
irisRtcSession.onSessionError = (roomId, errorCode, errorMessage) => {
//
}
Parameters | |
---|---|
roomId | Room id received from Iris backend |
errorCode | Error Code |
errorMessage | Additional error description |