当调用 startRecording 方法时,视频会暂时冻结
作者: winddamage创建于 2025年10月30日更新于 2025年10月30日
// 开始 this.recorder = new RecordRTCPromisesHandler(this.videoEl.srcObject.clone(), { type: 'video', mimeType: 'video/mp4', checkForInactiveTracks: true }) this.recorder.stream = this.videoEl.srcObject.clone() this.recorder.startRecording() this.isRecording = true // 结束 this.isRecording = false this.recorder .stopRecording() .then(async () => { const blob = await this.recorder.getBlob() invokeSaveAsDialog(blob, 'test.mp4') }) .catch(err => { console.error(err.toString()) }) .finally(async () => { this.recorder.stream.getTracks(t => t.stop()) await this.recorder.reset() await this.recorder.destroy() this.recorder = null })
内容来源: muaz-khan/RecordRTC