更新记录
1.0.9(2025-03-12)
优化
1.0.8(2025-03-09)
优化
1.0.7(2025-03-09)
优化
查看更多平台兼容性
uni-app x
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| - | - | 5.0 | × | - | - |
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;// 帧数据 可为空
}

收藏人数:
购买普通授权版(
试用
使用 HBuilderX 导入示例项目
赞赏(0)
下载 7175
赞赏 70
下载 10669514
赞赏 1797
赞赏
京公网安备:11010802035340号