This commit is contained in:
parent
637c7d0c47
commit
cb3032513c
|
@ -93,6 +93,7 @@ async function handleCopy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let playIndex = 0;
|
let playIndex = 0;
|
||||||
|
let playing = false;
|
||||||
async function radioPlay() {
|
async function radioPlay() {
|
||||||
console.log('播放', props.mp3)
|
console.log('播放', props.mp3)
|
||||||
const socket = new WebSocket('wss://chat.lihaink.cn/zhanti/tts');
|
const socket = new WebSocket('wss://chat.lihaink.cn/zhanti/tts');
|
||||||
|
@ -128,7 +129,7 @@ async function radioPlay() {
|
||||||
onAudioEnd(playIndex)
|
onAudioEnd(playIndex)
|
||||||
})
|
})
|
||||||
audioElements.push(a)
|
audioElements.push(a)
|
||||||
if(playIndex==0) playAudio()
|
if(playing==false) playAudio()
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (let i = 0; i < props.mp3.length; i++) {
|
// for (let i = 0; i < props.mp3.length; i++) {
|
||||||
|
@ -143,8 +144,10 @@ async function radioPlay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onAudioEnd = (index: any) => {
|
const onAudioEnd = (index: any) => {
|
||||||
if (index + 1 < audioElements.length)
|
if (index + 1 < audioElements.length&&playing==false){
|
||||||
audioElements[index + 1].play()
|
audioElements[index + 1].play()
|
||||||
|
playing = true;
|
||||||
|
}else playing = false;
|
||||||
}
|
}
|
||||||
// 创建音频对象的数组
|
// 创建音频对象的数组
|
||||||
const audioElements = reactive([])
|
const audioElements = reactive([])
|
||||||
|
|
Loading…
Reference in New Issue