Skip to main content
Version: 2.x.x

Meeting Class Callbacks - Unity


OnCreateMeetingIdCallback

The OnCreateMeetingIdCallback is triggered when a new meeting ID is successfully created using the CreateMeetingId() method.

Parameters

  • meetingId: string
    • The newly created meeting ID.

Usage

Register this callback to receive the generated meeting ID upon successful execution of CreateMeetingId().

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnCreateMeetingIdCallback += (meetingId) =>
{
Debug.Log("Meeting ID created: " + meetingId);
};
meeting.CreateMeetingId("YOUR_TOKEN");

OnCreateMeetingIdFailedCallback

The OnCreateMeetingIdFailedCallback is triggered when the attempt to create a meeting ID using the CreateMeetingId() method fails.

Parameters

  • error: string
    • The error message describing why the meeting ID creation failed.

Usage

Register this callback to handle errors that may occur during meeting ID creation.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnCreateMeetingIdFailedCallback += (error) =>
{
Debug.LogError("Failed to create meeting ID: " + error);
};
meeting.CreateMeetingId("YOUR_TOKEN_HERE");

OnParticipantJoinedCallback

The OnParticipantJoinedCallback is triggered for all participants (local or remote) when a participant joins the meeting. It provides the IParticipant object representing the participant who joined.

Parameters

  • participant: IParticipant
    • The participant who joined the meeting.

Usage

Register this callback to receive information when any participant joins the meeting.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnParticipantJoinedCallback += (iParticipant) =>
{
Debug.Log("Participant joined: " + iParticipant.Name);
};

OnParticipantLeftCallback

The OnParticipantLeftCallback is triggered for all participants (local or remote) when a participant leaves the meeting. It provides the IParticipant object representing the participant who left.

Parameters

  • participant: IParticipant
    • The participant who left the meeting.

Usage

Register this callback to receive information when any participant leaves the meeting.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnParticipantLeftCallback += (iParticipant) =>
{
Debug.Log("Participant left: " + iParticipant.Name);
};

OnMeetingStateChangedCallback

The OnMeetingStateChangedCallback is triggered whenever there is a change in the meeting state. This can include transitions such as connecting, connected, reconnecting, or disconnected.

Parameters

  • state: MeetingState
    • The updated meeting state. Possible values include:
      • MeetingState.NONE
        The initial state before any meeting-related operation has started.

      • MeetingState.CONNECTING
        Indicates that the participant is in the process of joining the meeting.

      • MeetingState.CONNECTED
        Indicates that the participant has successfully joined the meeting.

      • MeetingState.RECONNECTING
        Indicates that the connection was interrupted and a reconnection attempt is in progress.

      • MeetingState.DISCONNECTED
        Indicates that the participant has left the meeting or the connection has been terminated.

Usage

Register this callback to monitor and respond to changes in the meeting's connection state.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnMeetingStateChangedCallback += (state) =>
{
Debug.Log("Meeting state changed: " + state);
};

OnErrorCallback

The OnErrorCallback is triggered when an error occurs during meeting operations, such as joining, leaving, or interacting with media devices. It provides an Error object containing details about the issue.

Parameters

  • error: Error
    • An object representing the error. The Error class includes the following properties:

      • code: string

        • A short code identifying the type of error.
      • message: string

        • A descriptive message explaining the error.
      • type: string

        • The type of error.

Usage

Register this callback to handle and respond to runtime errors that occur while interacting with the meeting.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnErrorCallback += (error) =>
{
Debug.LogError("Error occurred:");
Debug.LogError("Code: " + error.code);
Debug.LogError("Message: " + error.message);
Debug.LogError("Type: " + error.type);
};

OnSpeakerChangedCallback

The OnSpeakerChangedCallback is triggered when the active speaker changes in the meeting. It provides the participant ID of the new active speaker.

Parameters

  • participantId: string
    • The unique identifier of the participant who is currently the active speaker.

Usage

Use this callback to track and highlight the participant who is currently speaking.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnSpeakerChangedCallback += (participantId) =>
{
Debug.Log("Active speaker changed. Participant ID: " + participantId);
};

OnPausedAllStreamsCallback

The OnPausedAllStreamsCallback is triggered when all remote participants' media streams of a specific type (audio or video) have been successfully paused.

Parameters

  • streamKind: StreamKind
    • Indicates the type of stream that was paused. Possible values:
      • StreamKind.AUDIO
      • StreamKind.VIDEO

Usage

Use this callback to confirm that all audio or video streams have been paused.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnPausedAllStreamsCallback += (streamKind) =>
{
Debug.Log("All " + streamKind + " streams have been paused.");
};

OnResumedAllStreamsCallback

The OnResumedAllStreamsCallback is triggered when all remote participants' media streams of a specific type (audio or video) have been successfully resumed.

Parameters

  • streamKind: StreamKind
    • Indicates the type of stream that was resumed. Possible values:
      • StreamKind.AUDIO
      • StreamKind.VIDEO

Usage

Use this callback to confirm that all audio or video streams have been resumed.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnResumedAllStreamsCallback += (streamKind) =>
{
Debug.Log("All " + streamKind + " streams have been resumed.");
};

OnCallStartedCallback

The OnCallStartedCallback is triggered when an external call starts, whether it’s a traditional phone call or a VoIP call (e.g., WhatsApp).

Parameters

  • None

Usage

Use this callback to manage interruptions caused by external calls. To ensure the local participant does not hear remote participants or speak in the meeting during the external call:

  • Disable the microphone for the local participant using SetAudio(false).
  • Pause incoming audio streams from remote participants using PauseAllStreams(StreamKind.AUDIO).

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnCallStartedCallback += () =>
{
Debug.Log("External call started.");
// Disable local participant's audio
localParticipant.SetAudio(false);

// Pause remote streams
meeting.PauseAllStreams(StreamKind.AUDIO);
};

OnCallHangupCallback

The OnCallHangupCallback is triggered when an external call ends, whether it’s a traditional phone call or a VoIP call (e.g., WhatsApp).

Parameters

  • None

Usage

Use this callback to handle any updates or resume actions when an external call interruption ends. If you previously disabled the local participant's microphone and paused remote participants' audio streams in the OnCallStartedCallback, make sure to re-enable them here:

  • Use SetAudio(true) to allow the local participant to speak again.
  • Use ResumeAllStreams(StreamKind.AUDIO) to allow the local participant to hear remote participants again.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnCallHangupCallback += () =>
{
Debug.Log("External call ended.");

// Re-enable local microphone
localParticipant.SetAudio(true);

// Resume audio streams of remote participants
meeting.ResumeAllStreams(StreamKind.AUDIO);
};

OnCallRingingCallback

The OnCallRingingCallback is triggered when an incoming external call is ringing, before it is answered. This includes both traditional phone calls and VoIP calls (e.g., WhatsApp).

Parameters

  • None

Usage

Use this callback to prepare the application for an incoming call. For example, you may want to display a UI indicator.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnCallRingingCallback += () =>
{
Debug.Log("External call is ringing.");
// Optional: Notify user
}

OnAudioDeviceChanged

The OnAudioDeviceChanged event is triggered when an audio device is connected, removed, or when the selected audio device is changed.

Parameters

  • availableDevice: AudioDeviceInfo[]
    • Array of available audio devices
  • selectedDevice: AudioDeviceInfo
    • The currently selected audio device

Usage

Use this callback to respond to audio device changes or updates.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnAudioDeviceChangedCallback += (AudioDeviceInfo[] availableDevices, AudioDeviceInfo selectedDevice) =>
{
Debug.Log($"Audio device changed. Selected device: {selectedDevice.label}");
//...
};

OnMicRequestedCallback

  • This event will be emitted to the participant B when any other participant A requests to enable mic of participant B.
  • On accepting the request, mic of participant B will be enabled.

Parameters

  • participantId: string
    • The unique identifier of the participant (A) who initiated the microphone request.
  • accept: Action
    • A callback method. Invoke this action to accept the microphone request and attempt to enable/unmute your microphone.
  • reject: Action
    • A callback method. Invoke this action to reject the microphone request. Your microphone state will remain unchanged.

Usage

Use this callback to be notified of incoming microphone activation request.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnMicRequestedCallback += (string participantId, Action accept, Action reject) =>
{
Debug.Log($"mic access requested by participant: {participantId}");
// Optionally add logic: accept(); or reject();
};

OnWebcamRequestedCallback

  • This event will be emitted to the participant B when any other participant A requests to enable webcam of participant B.
  • On accepting the request, webcam of participant B will be enabled.

Parameters

  • participantId: string
    • The unique identifier of the participant (A) who initiated the webcam request.
  • accept: Action
    • A callback method. Invoke this action to accept the webcam request and attempt to enable your webcam.
  • reject: Action
    • A callback method. Invoke this action to reject the webcam request. Your webcam will remain in its current state.

Usage

Use this callback to be notified of incoming webcam activation request.

Example

Meeting meeting = Meeting.GetMeetingObject();
meeting.OnWebcamRequestedCallback += (string participantId, Action accept, Action reject) =>
{
Debug.Log($"Webcam access requested by participant: {participantId}");
// Optionally add logic: accept(); or reject();
};

Got a Question? Ask us on discord