|
@ -1477,6 +1477,13 @@ const playNextAudio = () => { |
|
|
emotionAudioStore.isPlaying = true; |
|
|
emotionAudioStore.isPlaying = true; |
|
|
console.log(`开始播放${audioInfo.name}音频`); |
|
|
console.log(`开始播放${audioInfo.name}音频`); |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前股票的音频播放状态为播放中 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: true, isPaused: false }); |
|
|
|
|
|
console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 如果是第一个音频且需要启动打字机效果,则启动 |
|
|
// 如果是第一个音频且需要启动打字机效果,则启动 |
|
|
if ( |
|
|
if ( |
|
|
currentPlayIndex === 0 && |
|
|
currentPlayIndex === 0 && |
|
@ -1484,26 +1491,46 @@ const playNextAudio = () => { |
|
|
parsedConclusion.value |
|
|
parsedConclusion.value |
|
|
) { |
|
|
) { |
|
|
console.log("🎬 第一个音频开始播放,同时启动打字机效果"); |
|
|
console.log("🎬 第一个音频开始播放,同时启动打字机效果"); |
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
const stockId = currentStock?.stockInfo?.code || currentStock?.stockInfo?.symbol; |
|
|
const stockId = currentStock?.stockInfo?.code || currentStock?.stockInfo?.symbol; |
|
|
startTypewriterEffect(parsedConclusion.value, stockId, audioInfo.onComplete); |
|
|
startTypewriterEffect(parsedConclusion.value, stockId, audioInfo.onComplete); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onpause: () => { |
|
|
onpause: () => { |
|
|
|
|
|
emotionAudioStore.isPlaying = false; |
|
|
emotionAudioStore.isPaused = true; |
|
|
emotionAudioStore.isPaused = true; |
|
|
console.log(`${audioInfo.name}音频暂停播放`); |
|
|
|
|
|
|
|
|
// 保存当前播放位置 |
|
|
|
|
|
if (audio && audio.seek) { |
|
|
|
|
|
emotionAudioStore.playbackPosition = audio.seek() || 0; |
|
|
|
|
|
} |
|
|
|
|
|
console.log(`${audioInfo.name}音频暂停播放,位置:`, emotionAudioStore.playbackPosition); |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前股票的音频播放状态为暂停 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: false, isPaused: true }); |
|
|
|
|
|
console.log('设置当前股票音频状态为暂停:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onresume: () => { |
|
|
onresume: () => { |
|
|
|
|
|
emotionAudioStore.isPlaying = true; |
|
|
emotionAudioStore.isPaused = false; |
|
|
emotionAudioStore.isPaused = false; |
|
|
console.log(`${audioInfo.name}音频继续播放`); |
|
|
|
|
|
|
|
|
// 如果有保存的播放位置,从该位置继续播放 |
|
|
|
|
|
if (emotionAudioStore.playbackPosition > 0 && audio && audio.seek) { |
|
|
|
|
|
audio.seek(emotionAudioStore.playbackPosition); |
|
|
|
|
|
} |
|
|
|
|
|
console.log(`${audioInfo.name}音频继续播放,位置:`, emotionAudioStore.playbackPosition); |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前股票的音频播放状态为播放中 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: true, isPaused: false }); |
|
|
|
|
|
console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onend: () => { |
|
|
onend: () => { |
|
|
console.log(`${audioInfo.name}音频播放完成,准备播放下一个`); |
|
|
console.log(`${audioInfo.name}音频播放完成,准备播放下一个`); |
|
|
emotionAudioStore.isPlaying = false; |
|
|
|
|
|
emotionAudioStore.isPaused = false; |
|
|
emotionAudioStore.isPaused = false; |
|
|
emotionAudioStore.playbackPosition = 0; |
|
|
emotionAudioStore.playbackPosition = 0; |
|
|
isAudioPlaying.value = false; |
|
|
|
|
|
isPlayingQueueAudio.value = false; |
|
|
|
|
|
|
|
|
|
|
|
// 移动到下一个音频索引 |
|
|
// 移动到下一个音频索引 |
|
|
currentPlayIndex++; |
|
|
currentPlayIndex++; |
|
@ -1513,14 +1540,30 @@ const playNextAudio = () => { |
|
|
console.log( |
|
|
console.log( |
|
|
`队列中还有音频,500ms后播放下一个 (索引:${currentPlayIndex})` |
|
|
`队列中还有音频,500ms后播放下一个 (索引:${currentPlayIndex})` |
|
|
); |
|
|
); |
|
|
|
|
|
// 重置调用标志,但保持播放状态,直到所有音频播放完成 |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
isCallingPlayNext = false; |
|
|
isCallingPlayNext = false; |
|
|
|
|
|
isPlayingQueueAudio.value = false; // 重置队列播放状态,允许播放下一个音频 |
|
|
|
|
|
// 保持emotionAudioStore.isPlaying为true,确保喇叭图片保持voice状态 |
|
|
|
|
|
emotionAudioStore.isPlaying = true; |
|
|
|
|
|
// 设置下一个音频的URL,确保togglePlayPause能正确工作 |
|
|
|
|
|
const nextAudioInfo = audioQueue.value[currentPlayIndex]; |
|
|
|
|
|
if (nextAudioInfo && nextAudioInfo.url) { |
|
|
|
|
|
emotionAudioStore.setCurrentAudioUrl(nextAudioInfo.url); |
|
|
|
|
|
} |
|
|
playNextAudio(); |
|
|
playNextAudio(); |
|
|
}, 500); |
|
|
}, 500); |
|
|
} else { |
|
|
} else { |
|
|
console.log("🎉 所有音频播放完成"); |
|
|
console.log("🎉 所有音频播放完成"); |
|
|
emotionAudioStore.nowSound = null; |
|
|
emotionAudioStore.nowSound = null; |
|
|
isCallingPlayNext = false; |
|
|
isCallingPlayNext = false; |
|
|
|
|
|
|
|
|
|
|
|
// 重置音频store的播放状态 |
|
|
|
|
|
emotionAudioStore.isPlaying = false; |
|
|
|
|
|
emotionAudioStore.isPaused = false; |
|
|
|
|
|
emotionAudioStore.playbackPosition = 0; |
|
|
|
|
|
isAudioPlaying.value = false; |
|
|
|
|
|
isPlayingQueueAudio.value = false; |
|
|
|
|
|
|
|
|
// 重置当前股票的音频播放状态(所有音频播放完成后按钮应该变暗) |
|
|
// 重置当前股票的音频播放状态(所有音频播放完成后按钮应该变暗) |
|
|
const currentStock = emotionStore.activeStock; |
|
|
const currentStock = emotionStore.activeStock; |
|
@ -1768,6 +1811,13 @@ function playAudio(url) { |
|
|
isAudioPlaying.value = true; |
|
|
isAudioPlaying.value = true; |
|
|
emotionAudioStore.isPlaying = true; |
|
|
emotionAudioStore.isPlaying = true; |
|
|
console.log("开始播放场景应用语音"); |
|
|
console.log("开始播放场景应用语音"); |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前股票的音频播放状态为播放中 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: true, isPaused: false }); |
|
|
|
|
|
console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
// 音频开始播放时的自动滚动已移除 |
|
|
// 音频开始播放时的自动滚动已移除 |
|
|
}, |
|
|
}, |
|
|
onend: () => { |
|
|
onend: () => { |
|
@ -1776,16 +1826,37 @@ function playAudio(url) { |
|
|
emotionAudioStore.isPaused = false; |
|
|
emotionAudioStore.isPaused = false; |
|
|
emotionAudioStore.playbackPosition = 0; |
|
|
emotionAudioStore.playbackPosition = 0; |
|
|
console.log("场景应用语音播放结束"); |
|
|
console.log("场景应用语音播放结束"); |
|
|
|
|
|
|
|
|
|
|
|
// 重置当前股票的音频播放状态 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: false, isPaused: false }); |
|
|
|
|
|
console.log('重置当前股票音频状态:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onstop: () => { |
|
|
onstop: () => { |
|
|
isAudioPlaying.value = false; |
|
|
isAudioPlaying.value = false; |
|
|
emotionAudioStore.isPlaying = false; |
|
|
emotionAudioStore.isPlaying = false; |
|
|
console.log("场景应用语音播放停止"); |
|
|
console.log("场景应用语音播放停止"); |
|
|
|
|
|
|
|
|
|
|
|
// 重置当前股票的音频播放状态 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: false, isPaused: false }); |
|
|
|
|
|
console.log('重置当前股票音频状态:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onpause: () => { |
|
|
onpause: () => { |
|
|
isAudioPlaying.value = false; |
|
|
isAudioPlaying.value = false; |
|
|
emotionAudioStore.isPlaying = false; |
|
|
emotionAudioStore.isPlaying = false; |
|
|
console.log("场景应用语音播放暂停"); |
|
|
console.log("场景应用语音播放暂停"); |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前股票的音频播放状态为暂停 |
|
|
|
|
|
const currentStock = emotionStore.activeStock; |
|
|
|
|
|
if (currentStock) { |
|
|
|
|
|
setStockAudioState(currentStock, { isPlaying: false, isPaused: true }); |
|
|
|
|
|
console.log('设置当前股票音频状态为暂停:', currentStock.stockInfo?.name); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onerror: (error) => { |
|
|
onerror: (error) => { |
|
|
isAudioPlaying.value = false; |
|
|
isAudioPlaying.value = false; |
|
|