@@ -338,6 +338,7 @@ function handleAudioAttachment(cAttachment, assetUrl, pMessage, msg) {
338338
339339 // Create hidden audio element for playback control
340340 const audPreview = document . createElement ( 'audio' ) ;
341+ audPreview . crossOrigin = 'anonymous' ;
341342 audPreview . preload = 'metadata' ;
342343 audPreview . src = assetUrl ;
343344 audPreview . style . display = 'none' ;
@@ -390,7 +391,7 @@ function handleAudioAttachment(cAttachment, assetUrl, pMessage, msg) {
390391 function initAudioAnalyser ( ) {
391392 if ( audioContext ) return ;
392393
393- audioContext = new ( window . AudioContext || window . webkitAudioContext ) ( ) ;
394+ audioContext = new AudioContext ( ) ;
394395 analyser = audioContext . createAnalyser ( ) ;
395396 analyser . fftSize = 256 ; // Increased for better frequency resolution
396397 analyser . smoothingTimeConstant = 0.85 ; // Slightly more smoothing for visual appeal
@@ -495,7 +496,6 @@ function handleAudioAttachment(cAttachment, assetUrl, pMessage, msg) {
495496 customPlayer . appendChild ( playBtn ) ;
496497 customPlayer . appendChild ( waveform ) ;
497498 customPlayer . appendChild ( timeDisplay ) ;
498- customPlayer . appendChild ( transcribeBtn ) ;
499499
500500 audioContainer . appendChild ( audPreview ) ;
501501 audioContainer . appendChild ( customPlayer ) ;
@@ -664,6 +664,9 @@ function handleAudioAttachment(cAttachment, assetUrl, pMessage, msg) {
664664
665665 // Only add transcription UI for supported formats
666666 if ( [ 'wav' , 'mp3' , 'flac' ] . includes ( cAttachment . extension ) ) {
667+ // Display the Transcribe button
668+ customPlayer . appendChild ( transcribeBtn ) ;
669+
667670 // Add transcribe button container
668671 const transcribeContainer = document . createElement ( 'div' ) ;
669672 transcribeContainer . classList . add ( 'transcribe-container' ) ;
0 commit comments