From d01fbe8171b1c90d7f7410be111913cc972c433e Mon Sep 17 00:00:00 2001 From: bdim404 Date: Thu, 5 Feb 2026 23:13:43 +0800 Subject: [PATCH] feat: Enhance AudioPlayer download functionality for mobile devices and update dialog styles --- .../src/components/AudioPlayer.tsx | 16 +++++++++++----- .../src/components/ui/alert-dialog.tsx | 2 +- qwen3-tts-frontend/src/components/ui/dialog.tsx | 2 +- qwen3-tts-frontend/src/index.css | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/qwen3-tts-frontend/src/components/AudioPlayer.tsx b/qwen3-tts-frontend/src/components/AudioPlayer.tsx index 805d153..1356548 100644 --- a/qwen3-tts-frontend/src/components/AudioPlayer.tsx +++ b/qwen3-tts-frontend/src/components/AudioPlayer.tsx @@ -85,11 +85,15 @@ const AudioPlayer = memo(({ audioUrl, jobId }: AudioPlayerProps) => { }, []) const handleDownload = useCallback(() => { - const link = document.createElement('a') - link.href = blobUrl || audioUrl - link.download = `tts-${jobId}-${Date.now()}.wav` - link.click() - }, [blobUrl, audioUrl, jobId]) + if (useMobileMode) { + window.open(blobUrl || audioUrl, '_blank') + } else { + const link = document.createElement('a') + link.href = blobUrl || audioUrl + link.download = `tts-${jobId}-${Date.now()}.wav` + link.click() + } + }, [blobUrl, audioUrl, jobId, useMobileMode]) if (isLoading) { return ( @@ -131,6 +135,8 @@ const AudioPlayer = memo(({ audioUrl, jobId }: AudioPlayerProps) => { customVolumeControls={[]} showJumpControls={false} volume={1} + preload="metadata" + autoPlayAfterSrcChange={false} /> ) diff --git a/qwen3-tts-frontend/src/components/ui/alert-dialog.tsx b/qwen3-tts-frontend/src/components/ui/alert-dialog.tsx index 8722561..82cbd5f 100644 --- a/qwen3-tts-frontend/src/components/ui/alert-dialog.tsx +++ b/qwen3-tts-frontend/src/components/ui/alert-dialog.tsx @@ -34,7 +34,7 @@ const AlertDialogContent = React.forwardRef<