更新记录
1.0.0(2026-04-05)
1.0.0
平台兼容性
uni-app(4.75)
| Vue2 |
Vue2插件版本 |
Vue3 |
Vue3插件版本 |
Chrome |
Safari |
app-vue |
app-vue插件版本 |
app-nvue |
Android |
Android插件版本 |
iOS |
鸿蒙 |
| √ |
1.0.0 |
√ |
1.0.0 |
× |
× |
√ |
1.0.0 |
× |
5.0 |
1.0.0 |
× |
× |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
小红书小程序 |
快应用-华为 |
快应用-联盟 |
| × |
× |
× |
× |
× |
× |
× |
× |
× |
× |
- |
× |
uni-app x(4.75)
| Chrome |
Safari |
Android |
Android插件版本 |
iOS |
鸿蒙 |
微信小程序 |
| × |
× |
5.0 |
1.0.0 |
× |
× |
× |
yao-recorded-frame
开发文档
UTS API插件
使用实例
<template>
<view class="content">
<button class="btn" @click="start">开始</button>
<button class="btn" @click="Pause">暂停</button>
<button class="btn" @click="Resume">继续</button>
<button class="btn" @click="stop">停止</button>
<button class="btn" @click="play">播放</button>
实时回调:{{buffer}}
</view>
</template>
<script setup>
import { ref,onMounted } from 'vue';
import {recordStart,recordPause,recordResume,recordStop,onFrameRecorded} from '@/uni_modules/yao-recorded-sharding';
var filePath = ref("");
var buffer = ref([]);
var AudioContext = uni.createInnerAudioContext();
const start = () => {
var options = {
sampleRate:16000,//采用率
numberOfChannels:16,//声道(16=单声道)(12=立体声)
frameSize:1280,//指定帧大小
audioSource:6,//音频来源(1=手机麦克风)(6=默认麦克风)
};
//开启录音
recordStart(options,(prompt)=>{
console.log("recordStart",prompt)
if(prompt=="success"){
//录音成功
}else{
//录音失败请检查是否获取麦克风权限
uni.showToast({
title:"录音失败请检查是否获取麦克风权限",
icon:"none"
})
}
});
}
const Pause = () => {
recordPause();
}
const Resume = () => {
recordResume();
}
const stop = () => {
//录音停止
recordStop((path)=>{
console.log('音频地址',path);
filePath.value = path;
});
}
const play = () => {
AudioContext.src = filePath.value;
AudioContext.onPlay(() => {
console.log("播放成功")
})
AudioContext.onError((err) => {
console.log("播放错误+" + filePath.value, err)
})
AudioContext.play();
}
//实时回调
onFrameRecorded((frameBuffer)=>{
console.log("onFrameRecorded",frameBuffer);
buffer.value = frameBuffer;
})
onMounted(()=>{
console.log("生命周期load")
})
</script>
<style>
.content{
padding:40rpx;
}
.btn{
}
</style>