hookehuyr

fix 修复音频播放显示问题

...@@ -272,6 +272,7 @@ var spotInfo = [ ...@@ -272,6 +272,7 @@ var spotInfo = [
272 name: '观音殿', 272 name: '观音殿',
273 note: '', 273 note: '',
274 url: 'https://mp.weixin.qq.com/s/-b29FEPxZyE3Lu1KucmPcw', 274 url: 'https://mp.weixin.qq.com/s/-b29FEPxZyE3Lu1KucmPcw',
275 + audio: '',
275 }, 276 },
276 ], 277 ],
277 }, 278 },
......
...@@ -93,20 +93,24 @@ export default { ...@@ -93,20 +93,24 @@ export default {
93 }, 93 },
94 infoWindow(val) { 94 infoWindow(val) {
95 if (val) { 95 if (val) {
96 - // 存放到pinia里面控制 96 + if (this.info?.details[this.isActive]['audio']) {
97 - this.changeAudio(this.audio); 97 + // 存放到pinia里面控制
98 - // 加载录音 98 + this.changeAudio(this.audio);
99 - this.audio.src = this.info?.details[this.isActive]['audio']; 99 + this.changeAudioStatus('pause');
100 - let play_status = this.audio.play() // 播放 100 + // 加载录音
101 - if (play_status) { 101 + this.audio.src = this.info?.details[this.isActive]['audio'];
102 - play_status.then(() => { 102 + let play_status = this.audio.play() // 播放
103 - // 音频的播放需要耗时 103 + if (play_status) {
104 - this.audio.pause(); 104 + play_status.then(() => {
105 - this.play_time = this.getAudioTime(this.audio.duration) 105 + // 音频的播放需要耗时
106 - }).catch((e) => { 106 + this.is_play = false;
107 - // 失败 107 + this.audio.pause();
108 - console.log('Operation is too fast, audio play fails') 108 + this.play_time = this.getAudioTime(this.audio.duration)
109 - }) 109 + }).catch((e) => {
110 + // 失败
111 + console.log('Operation is too fast, audio play fails')
112 + })
113 + }
110 } 114 }
111 } 115 }
112 }, 116 },
......