|
@ -111,7 +111,7 @@ const playNextAudio = () => { |
|
|
src: [audioInfo.url], |
|
|
src: [audioInfo.url], |
|
|
html5: false, |
|
|
html5: false, |
|
|
format: ["mp3", "acc"], |
|
|
format: ["mp3", "acc"], |
|
|
// rate: 1.2, |
|
|
|
|
|
|
|
|
// rate: 2, |
|
|
retryCount: 0, |
|
|
retryCount: 0, |
|
|
onplay: () => { |
|
|
onplay: () => { |
|
|
audioStore.isPlaying = true; |
|
|
audioStore.isPlaying = true; |
|
@ -214,7 +214,6 @@ const addToAudioQueue = (url, name) => { |
|
|
"当前队列顺序:", |
|
|
"当前队列顺序:", |
|
|
audioQueue.value.map((item) => `${item.name}(${item.order})`) |
|
|
audioQueue.value.map((item) => `${item.name}(${item.order})`) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// 只有在确实没有音频在播放且这是第一个音频时才开始播放 |
|
|
// 只有在确实没有音频在播放且这是第一个音频时才开始播放 |
|
|
if ( |
|
|
if ( |
|
|
!isPlayingAudio.value && |
|
|
!isPlayingAudio.value && |
|
@ -275,6 +274,12 @@ const toggleVoiceForUser = (index) => { |
|
|
chatStore.messages[chatStore.currentUserIndex].audioStatus = false; |
|
|
chatStore.messages[chatStore.currentUserIndex].audioStatus = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 强制停止所有音频实例(移动端兼容) |
|
|
|
|
|
if (audioStore.soundInstance) { |
|
|
|
|
|
audioStore.soundInstance.stop(); |
|
|
|
|
|
audioStore.soundInstance = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
audioPreloadStatus.one = { loaded: false, url: null }; |
|
|
audioPreloadStatus.one = { loaded: false, url: null }; |
|
|
audioPreloadStatus.two = { loaded: false, url: null }; |
|
|
audioPreloadStatus.two = { loaded: false, url: null }; |
|
|
audioPreloadStatus.three = { loaded: false, url: null }; |
|
|
audioPreloadStatus.three = { loaded: false, url: null }; |
|
@ -301,20 +306,22 @@ const toggleVoiceForUser = (index) => { |
|
|
audioStore.soundInstance = null; |
|
|
audioStore.soundInstance = null; |
|
|
currentPlayIndex = 0; |
|
|
currentPlayIndex = 0; |
|
|
isCallingPlayNext = false; |
|
|
isCallingPlayNext = false; |
|
|
addToAudioQueue(chatStore.messages[index].audioArray[0], "API1-第一个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[1], "API2-第二个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[2], "API3-第三个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[3], "API4-第四个"); |
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[0], "API1-第一个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[1], "API2-第二个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[2], "API3-第三个"); |
|
|
|
|
|
addToAudioQueue(chatStore.messages[index].audioArray[3], "API4-第四个"); |
|
|
|
|
|
|
|
|
if (!audioStore.isVoiceEnabled) { |
|
|
|
|
|
audioStore.toggleVoice(); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (audioStore.currentAudioUrl || audioStore.ttsUrl) { |
|
|
|
|
|
audioStore.togglePlayPause(); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
if (!audioStore.isVoiceEnabled) { |
|
|
audioStore.toggleVoice(); |
|
|
audioStore.toggleVoice(); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (audioStore.currentAudioUrl || audioStore.ttsUrl) { |
|
|
|
|
|
// audioStore.togglePlayPause(); |
|
|
|
|
|
} else { |
|
|
|
|
|
audioStore.toggleVoice(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, 100); // 100ms延迟足够移动端清理音频实例 |
|
|
} else { |
|
|
} else { |
|
|
if (!audioStore.isVoiceEnabled) { |
|
|
if (!audioStore.isVoiceEnabled) { |
|
|
console.log("1111"); |
|
|
console.log("1111"); |
|
|