多方通话相关事件回调

interface JRTCCallCallback {
    onJoin?: (result: boolean, reasonCode: JRTCReasonCode) => void;
    onLeave?: (serialId: string, reasonCode: JRTCReasonCode) => void;
    onInviteResult?: (
        operatorId: number,
        result: boolean,
        reason: string,
    ) => void;
    onCancelInviteResult?: (
        operatorId: number,
        result: boolean,
        reason: string,
    ) => void;
    onAcceptInviteResult?: (
        operatorId: number,
        result: boolean,
        reason: string,
    ) => void;
    onRejectInviteResult?: (
        operatorId: number,
        result: boolean,
        reason: string,
    ) => void;
    onInviteReceived?: (param: JRTCCallExtraParam) => void;
    onInviteCanceled?: (param: JRTCCallExtraParam) => void;
    onInviteAccepted?: (param: JRTCCallExtraParam) => void;
    onInviteRejected?: (param: JRTCCallExtraParam) => void;
    onParticipantJoin?: (participant: JRTCRoomParticipant) => void;
    onParticipantLeft?: (
        participant: JRTCRoomParticipant,
        reason: JRTCReasonCode,
    ) => void;
    onParticipantUpdate?: (
        participant: JRTCRoomParticipant,
        changeParam: JRTCRoomParticipantChangeParam,
    ) => void;
    onKickUserResult?: (result: boolean) => void;
    onCallPropertyChanged?: (propChangeParam: JRTCRoomPropChangeParam) => void;
    onMessageSendResult?: (
        operatorId: number,
        result: boolean,
        error: JRTCError,
    ) => void;
    onMessageReceived?: (
        content: string,
        contentType: string,
        messageType: JRTCCallCenterMessageType,
        fromUserId: string,
    ) => void;
    onDeliveryAbort?: (
        isShutDown: boolean,
        deliveryUserId: string,
        reason: string,
    ) => void;
}

Properties

onJoin?: (result: boolean, reasonCode: JRTCReasonCode) => void

加入通话结果回调

调用 join 接口成功后,会收到此回调。

Type declaration

    • (result: boolean, reasonCode: JRTCReasonCode): void
    • Parameters

      • result: boolean

        加入通话是否成功 - true: 成功 - false: 失败

      • reasonCode: JRTCReasonCode

        加入失败原因,当 result 为 false 时该值有效。失败原因参见:错误码

      Returns void

onLeave?: (serialId: string, reasonCode: JRTCReasonCode) => void

离开通话结果回调

调用 leave 接口成功后,会收到此回调。

Type declaration

onInviteResult?: (operatorId: number, result: boolean, reason: string) => void

邀请结果回调

Type declaration

    • (operatorId: number, result: boolean, reason: string): void
    • Parameters

      • operatorId: number

        操作id,对应 JRTCCall#invite?:(String, JRTCCallExtraParam) invite 的返回值

      • result: boolean

        加入通话是否成功 - true: 成功 - false: 失败

      • reason: string

        邀请失败原因

      Returns void

onCancelInviteResult?: (
    operatorId: number,
    result: boolean,
    reason: string,
) => void

取消邀请结果回调

Type declaration

    • (operatorId: number, result: boolean, reason: string): void
    • Parameters

      • operatorId: number

        操作id,对应 () invite 的返回值

      • result: boolean

        加入通话是否成功 - true: 成功 - false: 失败

      • reason: string

        取消邀请失败原因

      Returns void

onAcceptInviteResult?: (
    operatorId: number,
    result: boolean,
    reason: string,
) => void

接受邀请结果回调

Type declaration

    • (operatorId: number, result: boolean, reason: string): void
    • Parameters

      • operatorId: number

        操作id,对应 (boolean) acceptInvite 的返回值

      • result: boolean

        加入通话是否成功 - true: 成功 - false: 失败

      • reason: string

        接受邀请失败原因

      Returns void

onRejectInviteResult?: (
    operatorId: number,
    result: boolean,
    reason: string,
) => void

拒绝邀请结果回调

Type declaration

    • (operatorId: number, result: boolean, reason: string): void
    • Parameters

      • operatorId: number

        操作id,对应 () rejectInvite 的返回值

      • result: boolean

        加入通话是否成功 - true: 成功 - false: 失败

      • reason: string

        拒绝邀请失败原因

      Returns void

onInviteReceived?: (param: JRTCCallExtraParam) => void

收到邀请通知

Type declaration

JRTCCallExtraParam

onInviteCanceled?: (param: JRTCCallExtraParam) => void

对方取消邀请通知

Type declaration

JRTCCallExtraParam

onInviteAccepted?: (param: JRTCCallExtraParam) => void

对方接受邀请通知

Type declaration

JRTCCallExtraParam

onInviteRejected?: (param: JRTCCallExtraParam) => void

对方拒绝邀请通知

Type declaration

JRTCCallExtraParam

onParticipantJoin?: (participant: JRTCRoomParticipant) => void

新成员加入回调

Type declaration

onParticipantLeft?: (
    participant: JRTCRoomParticipant,
    reason: JRTCReasonCode,
) => void

成员离开回调

Type declaration

onParticipantUpdate?: (
    participant: JRTCRoomParticipant,
    changeParam: JRTCRoomParticipantChangeParam,
) => void

成员更新回调

Type declaration

onKickUserResult?: (result: boolean) => void

成员踢出会议结果

Type declaration

    • (result: boolean): void
    • Parameters

      • result: boolean

        操作结果 true表示成功,false表示失败

      Returns void

onCallPropertyChanged?: (propChangeParam: JRTCRoomPropChangeParam) => void

通话属性改变,重点关注屏幕共享

Type declaration

onMessageSendResult?: (
    operatorId: number,
    result: boolean,
    error: JRTCError,
) => void

消息发送结果回调

Type declaration

    • (operatorId: number, result: boolean, error: JRTCError): void
    • Parameters

      • operatorId: number

        操作id,对应 sendMessage 的返回值

      • result: boolean

        发送结果是否成功 - true:发送成功 - false:发送失败

      • error: JRTCError

        发送失败错误码

      Returns void

onMessageReceived?: (
    content: string,
    contentType: string,
    messageType: JRTCCallCenterMessageType,
    fromUserId: string,
) => void

收到消息回调

通话中的成员可调用 (string, string, string | undefined) sendMessage} 接口给通话中的指定成员或全体成员发送文本消息,接收消息的成员会收到此回调,由此获取消息具体信息。

Type declaration

    • (
          content: string,
          contentType: string,
          messageType: JRTCCallCenterMessageType,
          fromUserId: string,
      ): void
    • Parameters

      • content: string

        消息内容

      • contentType: string

        消息内容类型

      • messageType: JRTCCallCenterMessageType

        消息归属类型

        • JRTCCallCenterMessageType#UNKNOWN : 未知消息类型
        • JRTCCallCenterMessageType#ONE_TO_ONE : 一对一消息
        • JRTCCallCenterMessageType#GROUP : 群发消息(发送给通话中所有成员)
      • fromUserId: string

        发送方的用户ID

      Returns void

onDeliveryAbort?: (
    isShutDown: boolean,
    deliveryUserId: string,
    reason: string,
) => void

录制异常回调

远程录制异常退出时会上报此回调。

Type declaration

    • (isShutDown: boolean, deliveryUserId: string, reason: string): void
    • Parameters

      • isShutDown: boolean

        录制异常时服务器是否自动结束通话

        • true: 自动结束通话
        • false: 不自动结束通话
      • deliveryUserId: string

        录制异常的用户ID

      • reason: string

        录制异常的原因

      Returns void