欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

electron-vite_1 构建项目

最编程 2024-10-11 07:00:02
...
js前端录音下载wav本地播放导出file

海淀江城: 感谢楼主,确实很好用,我有一点补充,就是这个使用示例其实可以更浅显一点,让使用者上手更加简单 [code=javascript] // 创建 SoundRecording 类的实例 const mySoundRecording = new SoundRecording(); // 开始录音的函数 const startRecording = async () => { try { const result = await mySoundRecording.create(); if (result.code === 1) { await mySoundRecording.start(); console.log('录音开始'); } } catch (err) { console.error('录音创建或开始失败:', err); } }; // 停止录音并下载的函数 const stopRecordingAndDownload = async () => { try { await mySoundRecording.stop(); console.log('录音停止,开始下载'); await mySoundRecording.download(); // 下载录音文件 } catch (err) { console.error('录音停止或下载失败:', err); } }; [/code]