Implement audio player component with HTML5 audio and download functionality
This commit is contained in:
36
frontend/src/components/AudioPlayerSection.tsx
Normal file
36
frontend/src/components/AudioPlayerSection.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
interface AudioPlayerSectionProps {
|
||||
audioUrl: string;
|
||||
onDownload: () => void;
|
||||
}
|
||||
|
||||
export default function AudioPlayerSection({
|
||||
audioUrl,
|
||||
onDownload
|
||||
}: AudioPlayerSectionProps) {
|
||||
return (
|
||||
<div className="w-full max-w-4xl mx-auto p-6">
|
||||
<h2 className="text-2xl font-bold mb-6">Your Audiobook is Ready!</h2>
|
||||
|
||||
<div className="bg-white rounded-lg shadow-md p-6 mb-6">
|
||||
<h3 className="text-lg font-semibold mb-4">Listen to your audiobook</h3>
|
||||
<audio
|
||||
controls
|
||||
src={audioUrl}
|
||||
className="w-full"
|
||||
preload="metadata"
|
||||
>
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<button
|
||||
onClick={onDownload}
|
||||
className="px-6 py-3 bg-green-600 hover:bg-green-700 text-white font-semibold rounded-lg transition-colors cursor-pointer"
|
||||
>
|
||||
Download audiobook
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user