File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ type StreamingAudioState = {
1616
1717let standByAudio : HTMLAudioElement | null = null ;
1818let isStandByAudioPlaying = false ;
19- function playStandByAudio ( ) {
19+ async function playStandByAudio ( ) {
2020 if ( ! standByAudio ) {
2121 standByAudio = new Audio ( `/plugins/AdminForthAgentPlugin/agentAudio/agent-processing.mp3` ) ;
2222 standByAudio . addEventListener ( 'ended' , ( ) => {
@@ -26,7 +26,7 @@ function playStandByAudio() {
2626 } ) ;
2727 }
2828 standByAudio . currentTime = 0 ;
29- standByAudio . play ( )
29+ await standByAudio . play ( ) ;
3030 isStandByAudioPlaying = true ;
3131}
3232
@@ -215,7 +215,7 @@ export const useAgentAudio = defineStore('agentAudio', () => {
215215 }
216216 }
217217
218- function setIsPlaying ( value : boolean ) {
218+ async function setIsPlaying ( value : boolean ) {
219219 isPlaying = value ;
220220
221221 if ( ! currentAudio ) {
@@ -228,7 +228,7 @@ export const useAgentAudio = defineStore('agentAudio', () => {
228228 return ;
229229 }
230230 agentAudioMode . value = 'playingAgentResponse' ;
231- void currentAudio . play ( ) . catch ( ( error ) => {
231+ await void currentAudio . play ( ) . catch ( ( error ) => {
232232 console . error ( 'Failed to play audio:' , error ) ;
233233 } ) ;
234234 }
You can’t perform that action at this time.
0 commit comments