Skip to content

Commit 09bce70

Browse files
fix:voice的setInterval失效
1 parent 9677e61 commit 09bce70

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎pages/API/voice/voice.vue‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@
9898
console.log('recorder start');
9999
100100
this.recording = true;
101-
recordTimeInterval = setInterval(() => {
102-
this.recordTime += 1;
103-
this.formatedRecordTime = util.formatTime(this.recordTime);
104-
}, 1000)
105101
});
106102
recorderManager.onStop((res) => {
107103
console.log('on stop');
@@ -122,6 +118,11 @@
122118
return;
123119
}
124120
// #endif
121+
122+
recordTimeInterval = setInterval(() => {
123+
this.recordTime += 1;
124+
this.formatedRecordTime = util.formatTime(this.recordTime);
125+
}, 1000)
125126
126127
// TODO ios 在没有请求过权限之前无法得知是否有相关权限,这种状态下需要直接调用录音,但没有状态或回调判断用户拒绝
127128
recorderManager.start({
@@ -134,11 +135,11 @@
134135
},
135136
playVoice() {
136137
console.log('play voice');
137-
this.playing = true;
138138
playTimeInterval = setInterval(() => {
139139
this.playTime += 1;
140140
this.formatedPlayTime = util.formatTime(this.playTime);
141141
}, 1000)
142+
this.playing = true;
142143
music.play();
143144
},
144145
stopVoice() {

0 commit comments

Comments
 (0)