QNMediaRecorder
QNMediaRecorder
可以通过 TrackModeSession 对象的 recorder
属性获取,用于音视频录制。
setMimeType(mimeType: string)
设置录制格式。
string
mimeType: 格式参考 mimeType。
boolean
返回:当返回值为 true,表示表示当前浏览器支持设置的格式。
start(tracks: Track[])
开始录制。
Track>
tracks: Array<指定要录制的 tracks。注意,最多仅支持录制一个音频 Track 和一路视频 Track。
pause()
暂停录制。
resume()
恢复录制。
stop()
停止录制。
Blob
返回值:当前录制完成的音频数据。
play(container: HTMLElement, muted = true)
播放已录制音频。 当录制完成后,当前录制好的音频数据会在在当前对象中缓存,此时可以调用 play 方法来完成播放。
HTMLElement
container: 通过在 container 中创建 audioElement 来实现播放。
boolean
muted: 为防止浏览器自动播放策略阻止播放,将音频设置为 mute 状态。
download(filename: string)
下载音频数据到本地文件。
string
filename: 指定音频数据文件名称。
release()
释放 recorder,清空数据缓存。