diff --git a/src/app/admin/datasets/[id]/entries/[entryId]/page.tsx b/src/app/admin/datasets/[id]/entries/[entryId]/page.tsx index cbd0276..74cf58a 100644 --- a/src/app/admin/datasets/[id]/entries/[entryId]/page.tsx +++ b/src/app/admin/datasets/[id]/entries/[entryId]/page.tsx @@ -117,7 +117,7 @@ export default async function DatasetEntryPage({ params }: DatasetEntryPageProps {(() => { const fileExtension = entry.fileName.substring(entry.fileName.lastIndexOf('.')); const src = `/public/datasets/${datasetIdNum}/${entry.externalId}${fileExtension}`; - return ; + return ; })()} diff --git a/src/components/AnnotationDistribution.tsx b/src/components/AnnotationDistribution.tsx index 6889712..291d8f9 100644 --- a/src/components/AnnotationDistribution.tsx +++ b/src/components/AnnotationDistribution.tsx @@ -3,7 +3,6 @@ import { useEffect, useState } from 'react'; import { getAnnotationDistribution, DistributionDimension, DistributionData, DistributionItem, getAnnotatedSamples, AnnotatedSample } from '@/app/actions/annotation-stats'; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; -import WaveformPlayer from './WaveformPlayer'; interface AnnotationDistributionProps { experimentId: number; diff --git a/src/components/AnnotationViews/SingleChoiceBinaryEntryView.tsx b/src/components/AnnotationViews/SingleChoiceBinaryEntryView.tsx index 79be103..0d63228 100644 --- a/src/components/AnnotationViews/SingleChoiceBinaryEntryView.tsx +++ b/src/components/AnnotationViews/SingleChoiceBinaryEntryView.tsx @@ -58,8 +58,8 @@ export default function SingleChoiceBinaryEntryView({ {/* Waveform player */} setFullyPlayed(true)} + playMode='pause' /> {/* Must-listen hint */} diff --git a/src/components/AnnotationViews/SingleChoiceEntryView.tsx b/src/components/AnnotationViews/SingleChoiceEntryView.tsx index 34ee079..01161a3 100644 --- a/src/components/AnnotationViews/SingleChoiceEntryView.tsx +++ b/src/components/AnnotationViews/SingleChoiceEntryView.tsx @@ -60,6 +60,7 @@ export default function SingleChoiceEntryView({ setFullyPlayed(true)} + playMode='pause' /> {/* Must-listen hint */} diff --git a/src/components/CalibrationViews/CalibrationEntryView.tsx b/src/components/CalibrationViews/CalibrationEntryView.tsx index f787366..1137c13 100644 --- a/src/components/CalibrationViews/CalibrationEntryView.tsx +++ b/src/components/CalibrationViews/CalibrationEntryView.tsx @@ -83,6 +83,7 @@ export default function CalibrationEntryView({ setFullyPlayed(true)} + playMode='pause' /> {/* Must-listen hint */} diff --git a/src/components/DatasetEntriesList.tsx b/src/components/DatasetEntriesList.tsx index fe30a6a..9e56b28 100644 --- a/src/components/DatasetEntriesList.tsx +++ b/src/components/DatasetEntriesList.tsx @@ -517,7 +517,7 @@ export default function DatasetEntriesList({ {(() => { const fileExtension = entry.fileName.substring(entry.fileName.lastIndexOf('.')); const src = `/public/datasets/${datasetId}/${entry.externalId}${fileExtension}`; - return ; + return ; })()} diff --git a/src/components/ParticipantDetailView.tsx b/src/components/ParticipantDetailView.tsx index f9a3223..dd7d88a 100644 --- a/src/components/ParticipantDetailView.tsx +++ b/src/components/ParticipantDetailView.tsx @@ -168,7 +168,7 @@ export default function ParticipantDetailView({ participant, experimentId }: Par {(() => { const fileExtension = selectedAnnotation.fileName.substring(selectedAnnotation.fileName.lastIndexOf('.')); const src = `/public/datasets/${selectedAnnotation.datasetId}/${selectedAnnotation.externalId}${fileExtension}`; - return ; + return ; })()} diff --git a/src/components/WaveformPlayer.tsx b/src/components/WaveformPlayer.tsx index 9cc42c7..8dcdca6 100644 --- a/src/components/WaveformPlayer.tsx +++ b/src/components/WaveformPlayer.tsx @@ -13,6 +13,7 @@ interface WaveformPlayerProps { // Display options showWaveform?: boolean; // defaults to true; if false, shows simple player button + playMode?: 'pause' | 'stop'; // defaults to 'pause'; determines play/pause vs play/stop behavior } const BAR_COUNT = 120; @@ -22,6 +23,7 @@ export default function WaveformPlayer({ onPlay, onFullyPlayed, showWaveform = true, + playMode = 'pause', }: WaveformPlayerProps) { const { currentAudioId, setCurrentAudio } = useAudio(); @@ -74,11 +76,14 @@ export default function WaveformPlayer({ if (!audio) return; setCurrentAudio(playerId); onPlay?.(); - audio.currentTime = 0; + // Only reset to start if in stop mode; in pause mode, resume from paused position + if (playMode === 'stop') { + audio.currentTime = 0; + } audio.play(); setIsPlaying(true); rafRef.current = requestAnimationFrame(tick); - }, [playerId, onPlay, tick]); + }, [playerId, onPlay, tick, playMode]); const handlePause = useCallback(() => { const audio = audioRef.current; @@ -190,19 +195,25 @@ export default function WaveformPlayer({ onEnded={handleEnded} />