录制相关事件回调接口

提供视频录制、分片上传等功能的回调方法

interface JRTCRecordCallback {
    onVideoCaptureRecordEnd?: (filePath: string, duration: number) => void;
    onVideoCaptureRecordFileSlice?: (filePath: string, isLast: boolean) => void;
    onVideoCaptureRecordError?: (error: string) => void;
    onRequestSliceUploadInfoResponse?: (
        operatorId: number,
        result: boolean,
        url: string,
        token: string,
        requestTimestamp: number,
        extraInfo: string,
        serverOid: string,
        reason: string,
    ) => void;
    onCompleteSliceUploadResponse?: (
        operatorId: number,
        result: boolean,
        fileName: string,
        fileSize: number,
        fileMd5sum: string,
        extraInfo: string,
        missFileList: ArrayList<String>,
        reason: string,
    ) => void;
}

Properties

onVideoCaptureRecordEnd?: (filePath: string, duration: number) => void

本地视频录制完成通知

Type declaration

    • (filePath: string, duration: number): void
    • Parameters

      • filePath: string

        录制文件本地路径

      • duration: number

        录制文件时长,单位毫秒

      Returns void

分片录制情况下,filePath 表示第一个录制文件的文件路径, duration 表示所有分片录制文件的总时长

onVideoCaptureRecordFileSlice?: (filePath: string, isLast: boolean) => void

分片录制文件录制完成回调

Type declaration

    • (filePath: string, isLast: boolean): void
    • Parameters

      • filePath: string

        录制文件本地路径

      • isLast: boolean

        是否最后一个录制文件

        • true: 是最后一个录制文件
        • false: 不是最后一个录制文件

      Returns void

onVideoCaptureRecordError?: (error: string) => void

视频录制异常回调

Type declaration

    • (error: string): void
    • Parameters

      • error: string

        异常描述信息

      Returns void

onRequestSliceUploadInfoResponse?: (
    operatorId: number,
    result: boolean,
    url: string,
    token: string,
    requestTimestamp: number,
    extraInfo: string,
    serverOid: string,
    reason: string,
) => void

请求分片录制文件上传信息响应

Type declaration

    • (
          operatorId: number,
          result: boolean,
          url: string,
          token: string,
          requestTimestamp: number,
          extraInfo: string,
          serverOid: string,
          reason: string,
      ): void
    • Parameters

      • operatorId: number

        操作ID,对应 JRTCRecord.requestSliceUploadInfo 的返回值

      • result: boolean

        请求是否成功

        • true: 请求成功
        • false: 请求失败
      • url: string

        上传地址,首次请求分片上传信息时有效

      • token: string

        文件上传所需token,用于校验上传合法性,需要在上传文件的时候携带

      • requestTimestamp: number

        本次请求发起时间戳,用于控制上传地址有效期,需要在上传文件的时候携带

      • extraInfo: string

        其他随路参数

      • serverOid: string

        上传目标服务Oid

      • reason: string

        请求失败原因描述,当 result 为 false 时有效

      Returns void

onCompleteSliceUploadResponse?: (
    operatorId: number,
    result: boolean,
    fileName: string,
    fileSize: number,
    fileMd5sum: string,
    extraInfo: string,
    missFileList: ArrayList<String>,
    reason: string,
) => void

完成分片录制文件上传响应

Type declaration

    • (
          operatorId: number,
          result: boolean,
          fileName: string,
          fileSize: number,
          fileMd5sum: string,
          extraInfo: string,
          missFileList: ArrayList<String>,
          reason: string,
      ): void
    • Parameters

      • operatorId: number

        操作ID,对应 JRTCRecord.completeSliceUpload 的返回值

      • result: boolean

        请求是否成功

        • true: 请求成功
        • false: 请求失败
      • fileName: string

        服务器合并后的文件名

      • fileSize: number

        服务器合并后的文件大小

      • fileMd5sum: string

        服务器合并后的文件的Md5信息

      • extraInfo: string

        其他随路参数

      • missFileList: ArrayList<String>

        缺失文件列表,当 result 为 false 且 errorCode 为 713045J65时有效

      • reason: string

        请求失败原因描述,当 result 为 false 时有效

      Returns void