mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 03:03:41 +00:00
解决语音播放不释放的问题
This commit is contained in:
parent
a494709177
commit
50f5b7fcf7
@ -27,6 +27,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
audioSubscribe: null,
|
audioSubscribe: null,
|
||||||
audioPlay: false,
|
audioPlay: false,
|
||||||
|
audioTimer: null,
|
||||||
audioId: 0,
|
audioId: 0,
|
||||||
audioSrc: null,
|
audioSrc: null,
|
||||||
callback: null,
|
callback: null,
|
||||||
@ -46,6 +47,16 @@ export default {
|
|||||||
if (typeof this.callback === "function") {
|
if (typeof this.callback === "function") {
|
||||||
this.callback(play)
|
this.callback(play)
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
this.audioTimer && clearTimeout(this.audioTimer);
|
||||||
|
if (!play) {
|
||||||
|
this.audioTimer = setTimeout(_ => {
|
||||||
|
if (!play) {
|
||||||
|
this.$refs.audio.src = null
|
||||||
|
this.audioSrc = null
|
||||||
|
}
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -61,9 +72,6 @@ export default {
|
|||||||
if (typeof msg === "boolean") {
|
if (typeof msg === "boolean") {
|
||||||
if (msg && !ended) {
|
if (msg && !ended) {
|
||||||
audio.pause()
|
audio.pause()
|
||||||
audio.src = null
|
|
||||||
this.audioSrc = null
|
|
||||||
this.audioPlay = false;
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -74,9 +82,6 @@ export default {
|
|||||||
audio.play()
|
audio.play()
|
||||||
} else {
|
} else {
|
||||||
audio.pause();
|
audio.pause();
|
||||||
audio.src = null
|
|
||||||
this.audioSrc = null
|
|
||||||
this.audioPlay = false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.audioId = id;
|
this.audioId = id;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user