tencent cloud

Feedback

TUICallEvent

Last updated: 2024-04-03 17:23:11

    TUICallEvent API Introduction

    TUICallEvent API is the Event Interface of the Audio and Video Call Components.

    Event List

    EVENT
    Description
    An error occurred inside the SDK
    This event is received when the SDK enters the ready state
    Receiving this event after a duplicate sign-in indicates that the user has been removed from the room
    If a user answers, this event will be received
    If a user agrees to join the call, this event will be received
    If a user agrees to leave the call, this event will be received
    User declines the call, this event will be received
    Invite user, no response, this event will be received
    Invitee Busy Line, this event will be received
    Remote user has enabled/disabled the camera, this event will be received
    Remote user has enabled/disabled the microphone, this event will be received
    Remote user adjusts speaking volume, this event will be received
    Group chat update invitation list, this event will be received
    Being invited to a call, this event will be received
    Event of Call Request
    If the call is not established, all platforms involved in the call will throw this event
    Event thrown when a call is connected
    Receiving this event indicates that the call has ended
    Device list update, this event will be received
    Call type switching, this event will be received

    ERROR

    An error occurred inside the SDK, which can be captured by listening for this event.
    let onError = function(error) {
    console.log(error.code, error.msg);
    };
    tuiCallEngine.on(TUICallEvent.ERROR, onError);
    The parameters are described below:
    Parameter
    Type
    Meaning
    code
    int
    msg
    String
    Error message

    SDK_READY

    This event is received when the SDK enters the ready state.
    let onSDKReady = function(event) {
    console.log(event);
    };
    tuiCallEngine.on(TUICallEvent.SDK_READY, onSDKReady);

    KICKED_OUT

    Duplicate sign-in, receiving this event indicates that the user has been kicked out of the room.
    let handleOnKickedOut = function(event) {
    console.log(event);
    };
    tuiCallEngine.on(TUICallEvent.KICKED_OUT, handleOnKickedOut);

    USER_ACCEPT

    If a user answers, all other users will receive this event, where `userID` is the user who answered.
    1. In a 1v1 call: when the callee answers, the caller will throw this event.
    2. In group calls: if A calls B and C, and B answers, both A and C will throw this event, with the event's `userID` being B. Similarly, if C answers, both A and B will throw this event, with the event's `userID` being C.
    let handleUserAccept = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.USER_ACCEPT, handleUserAccept);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Answering User ID

    USER_ENTER

    If a user agrees to join the call, all other users will receive this event, where `userID` is the user who agreed to join.
    let handleUserEnter = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.USER_ENTER, handleUserEnter);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Entering User ID

    USER_LEAVE

    When a user leaves the call,in the call other users will receive this event, userID is the user who left the call.
    let handleUserLeave = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.USER_LEAVE, handleUserLeave);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Exiting User ID

    REJECT

    Call Rejection Event
    1. In a 1v1 call, only the caller will receive the rejection event, where `userID` is the called party.
    2. In a group call, all invitees can receive this event, where `userID` is the user who declined the call.
    let handleInviteeReject = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.REJECT, handleInviteeReject);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Declining User ID

    NO_RESP

    No Answer Event by Inviting User.
    In a 1v1 call, only the initiator will receive the event of no answer. For example, A invites B, B does not answer, A can receive this event.
    In a group call, all invitees can receive this event. For example, if A invites B and C to join the call and B does not respond, both A and C will receive this event.
    let handleNoResponse = function(event) {
    console.log(event.sponsor, event.userIDList);
    };
    tuiCallEngine.on(TUICallEvent.NO_RESP, handleNoResponse);
    The parameters are described below:
    Parameter
    Type
    Meaning
    sponsor
    String
    Caller's User ID
    userIDList
    Array<String>
    List of Users Who Triggered Timeout Due to No Response

    LINE_BUSY

    Busy Call Event.
    let handleLineBusy = function(event) {
    console.log(event)
    };
    tuiCallEngine.on(TUICallEvent.LINE_BUSY, handleLineBusy);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Busy User ID

    USER_VIDEO_AVAILABLE

    Remote user has enabled/disabled the camera, this event will be received.
    let handleUserVideoChange = function(event) {
    console.log(event.userID, event.isVideoAvailable);
    };
    tuiCallEngine.on(TUICallEvent.USER_VIDEO_AVAILABLE, handleUserVideoChange);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Remote User ID
    isVideoAvailable
    Boolean
    true: Remote User turns Camera On; false: Remote User turns Camera Off

    USER_AUDIO_AVAILABLE

    Remote user has enabled/disabled the microphone, this event will be received.
    let handleUserAudioChange = function(event) {
    console.log(event.userID, event.isAudioAvailable);
    };
    tuiCallEngine.on(TUICallEvent.USER_AUDIO_AVAILABLE, handleUserAudioChange);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Remote User ID
    isAudioAvailable
    Boolean
    true Remote user turns on microphone; false Remote user turns off microphone

    USER_VOICE_VOLUME

    Remote user adjusts speaking volume, this event will be received.
    let handleUserVoiceVolumeChange = function(event) {
    console.log(event.volumeMap);
    };
    tuiCallEngine.on(TUICallEvent.USER_VOICE_VOLUME, handleUserVoiceVolumeChange);
    The parameters are described below:
    Parameter
    Type
    Meaning
    volumeMap
    Array<Object>
    Volume meter, access the volume level for each userid, with the minimum volume at 0 and the maximum volume at 100

    GROUP_CALL_INVITEE_LIST_UPDATE

    Group chat update invitation list, this event will be received.
    let handleGroupInviteeListUpdate = function(event) {
    console.log(event.userIDList);
    };
    tuiCallEngine.on(TUICallEvent.GROUP_CALL_INVITEE_LIST_UPDATE, handleGroupInviteeListUpdate);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userIDList
    Array<String>
    Group update invitation list

    INVITED

    Receiving a new incoming call event, the called party will be notified. By listening to this event, you can decide whether to display the call answering interface.
    Please Note:
    Plan to deprecate in subsequent versions
    let handleNewInvitationReceived = function(event) {
    console.log(event.sponsor, event.userIDList, event.isFromGroup, event.inviteData, event.inviteDate, event.inviteID);
    };
    tuiCallEngine.on(TUICallEvent.INVITED, handleNewInvitationReceived);
    The parameters are described below:
    Parameter
    Type
    Meaning
    sponsor
    String
    Inviter
    userIDList
    Array<String>
    Also Invited Persons
    isFromGroup
    Boolean
    Is it a Group Call
    inviteData
    Object
    Call Data
    inviteID
    String
    Invitation ID, identifying one invitation
    userData
    String
    Extended field: Utilized for amplifying details in the invitation signaling
    callId
    String
    The unique ID for this call.Supported in v1.4.6+
    roomID
    Number
    The Audio/Video Room ID for this call.Supported in v1.4.6+
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call.Supported from version v1.4.6+
    callRole
    String
    role, Enumeration Type: Caller, Called.Supported from version v1.4.6+

    ON_CALL_RECEIVED

    Receiving a new incoming call event, the called party will be notified. By listening to this event, you can decide whether to display the call answering interface.
    Please Note:
    Supported from version v1.4.6+
    let handleOnCallReceived = function(event) {
    console.log(event)
    };
    tuiCallEngine.on(TUICallEvent.ON_CALL_RECEIVED, handleOnCallReceived);
    The parameters are described below:
    Parameter
    Type
    Meaning
    sponsor
    String
    Inviter
    userIDList
    Array<String>
    Also Invited Persons
    isFromGroup
    Boolean
    Is it a Group Call
    inviteData
    Object
    Call Data
    inviteID
    String
    Invitation ID, identifying one invitation
    userData
    String
    Extended field: Utilized for amplifying details in the invitation signaling
    callId
    String
    Unique ID for this call
    roomID
    Number
    Audio-Video Room ID for this call
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call
    callRole
    String
    role, Enumeration Type: Caller, Called

    CALLING_CANCEL

    If the call is not established, this event will be thrown. By listening to this event, you can implement display logic similar to missed calls, reset UI state, etc. Scenarios where the call is not established include:
    Caller Cancelled: The caller throws this event, userID is the caller; the called also throws this event, userID is the called;
    Callee Timeout: The caller will throw both NO_RESP and CALLING_CANCEL events, userID is the caller; the called throws the CALLING_CANCEL event, userID is the called;
    Callee Rejected: The caller will throw both REJECT and CALLING_CANCEL events, userID is the caller; the called throws the CALLING_CANCEL event, userID is the called;
    Callee Busy: The caller will throw both LINE_BUSY and CALLING_CANCEL events, userID is the caller; the callee throws the CALLING_CANCEL event, userID is the callee;
    Please Note:
    Plan to deprecate in subsequent versions
    let handleCallingCancel = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.CALLING_CANCEL, handleCallingCancel);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Cancelled User ID
    callId
    String
    The unique ID for this call.Supported in v1.4.6+
    roomID
    Number
    The Audio/Video Room ID for this call.Supported in v1.4.6+
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call.Supported from version v1.4.6+
    callRole
    String
    role, Enumeration Type: Caller, Called.Supported from version v1.4.6+

    ON_CALL_CANCELED

    If the call is not established, this event will be thrown. By listening to this event, you can implement display logic similar to missed calls, reset UI state, etc. Scenarios where the call is not established include:
    Caller Cancelled: The caller throws this event, userID is the caller; the called also throws this event, userID is the called;
    Callee Timeout: The caller will throw both NO_RESP and CALLING_CANCEL events, userID is the caller; the called throws the CALLING_CANCEL event, userID is the called;
    Callee Rejected: The caller will throw both REJECT and CALLING_CANCEL events, userID is the caller; the called throws the CALLING_CANCEL event, userID is the called;
    Callee Busy: The caller will throw both LINE_BUSY and CALLING_CANCEL events, userID is the caller; the callee throws the CALLING_CANCEL event, userID is the callee;
    Please Note:
    Supported from version v1.4.6+
    let handleOnCallCanceled = function(event) {
    console.log(event.userID);
    };
    tuiCallEngine.on(TUICallEvent.ON_CALL_CANCELED, handleOnCallCanceled);
    The parameters are described below:
    Parameter
    Type
    Meaning
    userID
    String
    Cancelled User ID
    callId
    String
    Unique ID for this call
    roomID
    Number
    Audio-Video Room ID for this call
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call
    callRole
    String
    role, Enumeration Type: Caller, Called

    ON_CALL_BEGIN

    Indicates call connection. Both caller and called can receive it. You can start cloud recording, content review, etc., by listening to this event.
    Please Note:
    Supported from version v1.4.6+
    let handleOnCallBegin = function(event) {
    console.log(event)
    };
    tuiCallEngine.on(TUICallEvent.ON_CALL_BEGIN, handleOnCallBegin);
    The parameters are described below:
    Parameter
    Type
    Meaning
    callId
    String
    Unique ID for this call
    roomID
    Number
    Audio-Video Room ID for this call
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call
    callRole
    String
    role, Type: Caller, Called

    CALLING_END

    Indicates call termination. Both caller and called can trigger this event. You can display information such as call duration, call type, or stop the cloud recording process by listening to this event.
    let handleCallingEnd = function(event) {
    console.log(event.userID, event.);
    };
    tuiCallEngine.on(TUICallEvent.CALLING_END, handleCallingEnd);
    The parameters are described below:
    Parameter
    Type
    Meaning
    roomID
    Number
    Audio-Video Room ID for this call, currently only supports numeric room number, future versions will support character string room numbers
    callMediaType
    Number
    Media Type of the call, Video Call, Voice Call
    callRole
    String
    role, Enumeration Type: Caller ('inviter'), Called ('invitee'), Unknown ('')
    totalTime
    Number
    The duration of this call in seconds
    userID
    String
    userID of the call termination.
    callId
    String
    The unique ID for this call.Supported in v1.4.6+
    callEnd
    Number
    The duration of this call (will be deprecated) in seconds

    DEVICED_UPDATED

    Device list update, this event will be received.
    let handleDeviceUpdated = function({ microphoneList, cameraList, currentMicrophoneID, currentCameraID }) {
    console.log(microphoneList, cameraList, currentMicrophoneID, currentCameraID)
    };
    tuiCallEngine.on(TUICallEvent.DEVICED_UPDATED, handleDeviceUpdated);

    CALL_TYPE_CHANGED

    Call type switching, this event will be received.
    let handleCallTypeChanged = function({ oldCallType, newCallType }) {
    console.log(oldCallType, newCallType)
    };
    tuiCallEngine.on(TUICallEvent.CALL_TYPE_CHANGED, handleDeviceUpdated);
    The parameters are described below:
    Parameter
    Type
    Meaning
    oldCallType
    Number
    Old call type
    newCallType
    Number
    New call type
    
    
    
    
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support