add preview for original file

This commit is contained in:
Joel Mathew Thomas
2025-03-18 15:29:12 +05:30
parent 8bd1cc4abb
commit 2ba08d7d92
+13 -1
View File
@@ -25,6 +25,7 @@ function ResultsPage() {
console.log("Extracted files are", extractedFiles); console.log("Extracted files are", extractedFiles);
// const [isPlaying, setIsPlaying] = useState(false); // const [isPlaying, setIsPlaying] = useState(false);
const audioRefs = [useRef(null), useRef(null), useRef(null),useRef(null)]; const audioRefs = [useRef(null), useRef(null), useRef(null),useRef(null)];
const mediaFileRef = useRef(null);
const audioClass = response.audio_class const audioClass = response.audio_class
const isVideo = mediaFile?.type.includes('video'); const isVideo = mediaFile?.type.includes('video');
@@ -71,11 +72,22 @@ function ResultsPage() {
controls controls
/> />
) : ( ) : (
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', p: 4, bgcolor: 'rgba(0, 0, 0, 0.04)', borderRadius: 2 }}> <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', p: 4, bgcolor: 'rgba(0, 0, 0, 0.04)', borderRadius: 2 }}>
<VolumeUpIcon color="primary" sx={{ fontSize: 80, mb: 2 }} /> <VolumeUpIcon color="primary" sx={{ fontSize: 80, mb: 2 }} />
<Typography variant="h6" gutterBottom> <Typography variant="h6" gutterBottom>
{mediaFile.name} (Processed) {mediaFile.name} (Processed)
</Typography> </Typography>
<Box sx={{ width: '100%', mt: 2, mb: 2 }}>
<Typography variant="body2" color="textSecondary" sx={{ mb: 1 }}>
Original: {mediaFile.name}
</Typography>
<audio
ref={mediaFileRef}
src={mediaFile.url}
style={{ width: '100%' }}
controls
/>
</Box>
{audioClass === "Music" ? ( {audioClass === "Music" ? (
extractedFiles.map((file, index) => ( extractedFiles.map((file, index) => (
<Box key={index} sx={{ width: '100%', mt: 2 }}> <Box key={index} sx={{ width: '100%', mt: 2 }}>