更新记录
1.1.7(2025-07-20)
优化
1.1.6(2025-07-19)
优化
1.1.5(2025-07-19)
优化
查看更多平台兼容性
uni-app(4.06)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
- | - | √ | - | √ | √ | √ | √ | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x(4.06)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | - | - | - | - |
xtf-mic_recorder
uniappx
import { RecorderData, getAppDir, start,stop,deleteAllLocalTempAudio,fileToBase64,pcmToWavFile } from '@/uni_modules/xtf-micrecorder
getAppDir();// 获取app 可用的缓存目录
deleteAllLocalTempAudio(getAppDir()); // 删除缓存目录所有录音文件 推荐开启前清空一下
// 开启录制
start({
perialTime:10,
callback:function(res:string){
console.log(res)
},
path:getAppDir(),
} as RecorderData)
stop(); // 停止录制
// 将文件转换为base64
fileToBase64("xxxx.pcm",function(res:string){
})
// pcm 文件转换为wav格式文件
pcmToWavFile("xxxx.pcm",function(res:string){
})
deleteFile("xxx.pcm");// 删除单个文件
uniapp
import { getAppDir, start,stop,deleteAllLocalTempAudio,fileToBase64,pcmToWavFile } from '@/uni_modules/xtf-micrecorder
getAppDir();// 获取app 可用的缓存目录
deleteAllLocalTempAudio(getAppDir()); // 删除缓存目录所有录音文件 推荐开启前清空一下
// 开启录制
start({
perialTime:10,
callback:function(res){
console.log(res)
},
path:getAppDir(),
} )
stop(); // 停止录制
// 将文件转换为base64
fileToBase64("xxxx.pcm",function(res){
})
// pcm 文件转换为wav格式文件
pcmToWavFile("xxxx.pcm",function(res){
})
deleteFile("xxx.pcm");// 删除单个文件
RecorderData
export type RecorderData={
perialTime:number,// 循环间隔
path:string,// 录制路径
recorderRate?:number,//可为空 默认44100
callback?:(d:string)=>void; // 可为空 录制回调,回调为pcm 文件的路径
frameBack?:(d:string)=>void;// 帧数据 可为空
}