回调事件
回调事件目前包括8个事件,即用户进入课堂事件,讲师上课事件,讲师下课事件和生成回放事件,文档转码事件,生成回放下载地址回调,用户预览课堂回放数据统计回调,用户离开课堂后回调。此回调事件方便客户了解创建课堂的状态和情况,根据事件回调提醒,处理自身业务。
详细介绍:
1、用户进入课堂的回调事件(type为join) 事件触发后,微吼课堂API服务器会以post方式,传递 6 个参数(class_id、custom_id、role_type、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
class_id | string | 是 | 课程 ID |
custom_id | string | 是 | 调用直播链接的自定义 ID |
role_type | string | 是 | 角色类型 1:讲师;2:学员;3:助教;4:嘉宾;5:督课; |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
2、讲师上课的回调事件(type为start) 事件触发后,微吼课堂API服务器会以post方式,传递 5 个参数(class_id、custom_id、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
class_id | string | 是 | 课程 ID |
custom_id | string | 是 | 调用直播链接的自定义 ID |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
3、讲师下课的回调事件(type为stop) 事件触发后,微吼课堂API服务器会以post方式,传递 5 个参数(class_id、custom_id、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
class_id | string | 是 | 课程 ID |
custom_id | string | 是 | 调用直播链接的自定义 ID |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
4、生成回放的回调事件(type为record) 事件触发后,微吼课堂API服务器会以post方式,传递 8 个参数(class_id、custom_id、duration、storage、type、record_id、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
class_id | string | 是 | 课程 ID |
custom_id | string | 是 | 调用直播链接的自定义 ID |
duration | string | 是 | 视频时长 |
storage | int | 是 | 占据空间大小单位KB |
type | string | 是 | 回调事件类型 |
record_id | int | 是 | 回调视频ID |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
5、文档转码完成的回调事件(type为trans-over) 事件触发后,微吼课堂API服务器会以post方式,传递 9 个参数(doc_id、status、doc_transcoding_type、size、page、converted_page、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
doc_id | int | 是 | 文档 ID |
status | int | 是 | 1,等待转码 2,正在转码 3,转码成功 4,转码失败 |
doc_transcoding_type | string | 是 | 'static' 为静态转码 'dynamic' 为动态转码 |
size | string | 是 | 文档大小 |
page | int | 是 | 文档页数 |
converted_page | int | 是 | 文档已转码页数 |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
6、生成回放下载地址回调(type为event-download-record) 事件触发后,微吼课堂API服务器会以post方式,传递 6 个参数(record_id、status、url、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
record_id | int | 是 | 回放 ID |
status | int | 是 | 0等待转码 1 转码完成 2 正在转码 3转码失败 |
percent | int | 是 | 转码进度 |
url | string | 是 | 当status为 1 时,url为回放视频的完整下载地址,否则为空字符串 |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
7、用户预览课堂回放数据统计回调(type为record-preview-statics) 事件触发后,微吼课堂API服务器会以post方式,传递 12 个参数(student_custom_id、student_nick_name、teacher_nick_name、record_id、class_id、record_title、entry_time、leave_time、duration、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
student_custom_id | string | 是 | 用户自定义custom_id |
student_nick_name | string | 是 | 学生昵称 |
teacher_nick_name | string | 是 | 老师昵称 |
record_id | int | 是 | 回放id |
class_id | string | 是 | 课程id |
record_title | string | 是 | 课程标题 |
entry_time | string | 是 | 用户开始预览时间 |
leave_time | string | 是 | 用户停止预览时间 |
duration | int | 是 | 用户停留时间(单位秒) |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
8、用户离开课堂后回调(type为leave) 事件触发后,微吼课堂API服务器会以post方式,传递 6 个参数(class_id、custom_id、role_type、type、signed_at、signature)至客户配置的回调地址。
参数名 | 类型 | 必选 | 说明 |
---|---|---|---|
class_id | string | 是 | 课程id |
custom_id | string | 是 | 调用直播链接的自定义 ID |
role_type | string | 是 | 角色类型 1:讲师;2:学员;3:助教;4:嘉宾;5:督课; |
type | string | 是 | 回调事件类型 |
signed_at | int | 是 | 当前unix时间戳 |
signature | string | 是 | 校验签名 点击查看签名校验规则 |
API 使用方接收到回调,可以根据不同的 type 来处理逻辑。
设置回调地址
在增值服务api中设置回调地址,点击查看 如果不设置回调地址,不会进行回调。
回调重试机制
当用户接收到回调数据时,需响应json串{status:200} ,否则会视为用户方服务异常,数据未接收成功,会每隔10秒钟进行一次回调重试,最多重试5次。如果用户不响应系统会每隔10s发送一次回调数据,连续5次。