# 录制直播
# 开始录制
使用Promise (opens new window)Manis.startRecord()
发起开始录制请求,
接收三个参数,
channel
、streamId
和recordType
, 返回一个Promise对象实例
名称 | 类型 | 说明 | 备注 |
---|---|---|---|
channel | string (opens new window) | 需要录制的频道ID | |
streamId | string (opens new window) | 需要录制的流ID | |
recordType | string (opens new window) | 录制的流类型 | 录制类型(固定字符串,all 表示录制音频和视频,video 表示只录制视 频,audio 表示只录制音频) |
示例:
const channel = 'xxxxxx'
const stream = 'xxxx'
const type = 'all'
Manis.startRecord(channel, stream, type).then(resp => {
console.log('handleRecordResp: ', resp)
if (resp.code === 200) {
console.log('录制请求成功')
} else {
console.error('录制请求失败, ' + resp.msg)
}
}).catch(e => {
console.error(e)
})
# 结束录制
使用Promise (opens new window)Manis.stopRecord()
结束当前录制,
接收两个参数,
channel
和recordId
, 返回一个Promise对象实例
名称 | 类型 | 说明 | 备注 |
---|---|---|---|
channel | string (opens new window) | 录制的频道ID | |
recordId | string (opens new window) | 开始录制请求成功后返回的录制ID |
示例:
const channel = 'xxxxxx'
const recorderId = 'xxxx'
Manis.stopRecord(channel, recorderId).then(resp => {
console.log('结束录制: ', resp)
}).catch(err => {
console.error(err)
})
# 删除录制
- 文档持续更新中。。。
← 桌面分享