RecorderManager.onPause
监听录音暂停事件。
语法
RecorderManager.onPause(callback)
参数说明
Function callback
代码示例
<!-- index.ttml -->
<button type="primary" bindtap="startRecord">开始录音</button>
<button type="primary" bindtap="pauseRecord">暂停录音</button>
<view>录音状态:{{status}}</view>
// index.js
Page({
data: {
status: "暂未开始",
},
startRecord() {
this.recorderManager = tt.getRecorderManager();
const options = {
duration: 60000,
sampleRate: 12000,
numberOfChannels: 1,
encodeBitRate: 25000,
frameSize: 100,
};
this.recorderManager.onPause(() => {
tt.showModal({
title: "录音暂停",
showCancel: false,
});
this.setData({
status: "录音暂停",
});
});
this.recorderManager.start(options);
tt.showToast({ title: "开始录音" });
this.setData({
status: "正在录音",
});
},
pauseRecord() {
this.recorderManager && this.recorderManager.pause();
},
});
Bug & Tip
暂无
点击纠错
评价此篇文档