jwyu 2 éve
szülő
commit
4c23c45e17
2 módosított fájl, 6 hozzáadás és 4 törlés
  1. 1 0
      pages-voice/addVoice.vue
  2. 5 4
      pages/voice/voice.vue

+ 1 - 0
pages-voice/addVoice.vue

@@ -316,6 +316,7 @@ export default {
             })
             innerAudioContext.onEnded(()=>{
                 console.log('录音播放自然结束');
+                this.temAudio.curTime=this.temAudio.duration
                 this.temAudio.paused=true
                 innerAudioContext.src=''
             })

+ 5 - 4
pages/voice/voice.vue

@@ -74,7 +74,7 @@ import {apiVoiceList,apiVoiceSectionList,apiVoicePlayRecord,apiVoiceDel} from '@
 import {apiGetSceneToParams} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 const moment=require('@/utils/moment-with-locales.min')
-const innerAudioContext = uni.createInnerAudioContext();//播放音频实例
+let innerAudioContext = uni.createInnerAudioContext();//播放音频实例
 export default {
     components:{
         noAuth
@@ -288,7 +288,7 @@ export default {
         handlePlay(item){
             
             //没有初始化时
-            if(!innerAudioContext.src){
+            if(this.temAudio.id==0){
                 this.listenAudio()
                 this.temAudio.id=item.BroadcastId
                 this.temAudio.duration=item.VoicePlaySeconds
@@ -326,13 +326,14 @@ export default {
             })
             innerAudioContext.onEnded(()=>{
                 console.log('录音播放自然结束');
-                this.temAudio.paused=true
                 setTimeout(() => {
+                    this.temAudio.paused=true
                     this.temAudio.id=0
+                    innerAudioContext.src=''
                 }, 100);
-                innerAudioContext.src=''
             })
             innerAudioContext.onTimeUpdate(()=>{
+                // console.log('时间更新');
                 this.temAudio.curTime=parseInt(this.temAudio.duration)-parseInt(innerAudioContext.currentTime)
             })
         },