JCMediaChannelCallback 对象,用于回调多方通话相关事件

interface JCMediaChannelCallback {
    onChannelMessageReceive?: ((type: string, content: string, fromUserId: string) => void);
    onInviteSipUserResult?: ((operationId: number, result: boolean, reason: number) => void);
    onJoin?: ((result: boolean, reason: number, channelId: string) => void);
    onLeave?: ((reason: number, channelId: string) => void);
    onMediaChannelPropertyChange?: ((propChangeParam: PropChangeParam) => void);
    onMediaChannelStateChange?: ((state: number, oldState: number) => void);
    onParticipantJoin?: ((participant: JCMediaChannelParticipant) => void);
    onParticipantLeft?: ((participant: JCMediaChannelParticipant) => void);
    onParticipantUpdate?: ((participant: JCMediaChannelParticipant, changeParam: ChannelChangeParam) => void);
    onParticipantVolumeChange?: ((participant: JCMediaChannelParticipant) => void);
    onQuery?: ((operationId: number, result: boolean, reason: number, queryInfo: JCMediaChannelQueryInfo) => void);
    onStop?: ((result: boolean, reason: number) => void);
}

Properties

onChannelMessageReceive?: ((type: string, content: string, fromUserId: string) => void)

接收频道消息的回调

Type declaration

    • (type, content, fromUserId): void
    • Parameters

      • type: string

        消息类型,对应 sendMessage 方法中的 type 参数

      • content: string

        消息内容,对应 sendMessage 方法中的 content 参数

      • fromUserId: string

        消息发送成员的userId

      Returns void

onInviteSipUserResult?: ((operationId: number, result: boolean, reason: number) => void)

邀请Sip用户操作结果回调

成功后会触发 onParticipantJoin 回调

Type declaration

    • (operationId, result, reason): void
    • Parameters

      • operationId: number

        操作id,由 inviteSipUser 接口返回

      • result: boolean

        邀请用户是否成功

        • true:成功
        • false:失败
      • reason: number

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

      Returns void

onJoin?: ((result: boolean, reason: number, channelId: string) => void)

加入频道结果回调

Type declaration

    • (result, reason, channelId): void
    • Parameters

      • result: boolean

        加入频道是否成功

        • true:成功
        • false:失败
      • reason: number

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

      • channelId: string

        频道标识符

      Returns void

onLeave?: ((reason: number, channelId: string) => void)

离开频道结果回调

Type declaration

    • (reason, channelId): void
    • Parameters

      Returns void

onMediaChannelPropertyChange?: ((propChangeParam: PropChangeParam) => void)

属性变化回调

Type declaration

    • (propChangeParam): void
    • Parameters

      • propChangeParam: PropChangeParam

        JCMediaChannel.PropChangeParam 变化标识集合

      Returns void

onMediaChannelStateChange?: ((state: number, oldState: number) => void)

自身频道状态变化回调

状态:

Type declaration

    • (state, oldState): void
    • Parameters

      • state: number

        当前状态

      • oldState: number

        变化前状态

      Returns void

onParticipantJoin?: ((participant: JCMediaChannelParticipant) => void)

新成员加入回调

Type declaration

onParticipantLeft?: ((participant: JCMediaChannelParticipant) => void)

成员离开回调

Type declaration

onParticipantUpdate?: ((participant: JCMediaChannelParticipant, changeParam: ChannelChangeParam) => void)

成员更新回调

Type declaration

    • (participant, changeParam): void
    • Parameters

      Returns void

onParticipantVolumeChange?: ((participant: JCMediaChannelParticipant) => void)

成员声音变化

收到此回调需要先设置volumeChangeNotify 为ture

Type declaration

onQuery?: ((operationId: number, result: boolean, reason: number, queryInfo: JCMediaChannelQueryInfo) => void)

查询频道信息结果回调

Type declaration

    • (operationId, result, reason, queryInfo): void
    • Parameters

      • operationId: number

        操作id,由 query 接口返回

      • result: boolean

        查询频道信息是否成功

        • true:查询成功
        • false:查询失败
      • reason: number

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

      • queryInfo: JCMediaChannelQueryInfo

        JCMediaChannelQueryInfo 对象,查询到的频道信息,当失败时只需关注 getChannelId 获取的 channelId

      Returns void

onStop?: ((result: boolean, reason: number) => void)

解散频道结果回调

Type declaration

    • (result, reason): void
    • Parameters

      • result: boolean

        解散频道是否成功

        • true:成功
        • false:失败
      • reason: number

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

      Returns void