Overview
Audio experiences are central to many modern applications, from healthcare analytics to media platforms. For Innovaccer, building robust and intuitive user interfaces that handle complex data, like audio, is crucial. This problem challenges you to develop an interactive audio player component with a visual waveform representation, simulating a common feature in medical transcription review or data annotation tools.
What you need to do / Task
Your task is to build a React component that functions as a fully interactive audio player.
- Core Playback Controls: Implement play/pause functionality.
- Seek/Scrub Functionality: Allow users to click or drag on a progress bar/waveform to seek to a specific point in the audio.
- Time Display: Display the current playback time and total duration of the audio in
MM:SS format.
- Volume Control: Implement a slider to adjust the audio volume.
- Waveform Visualization:
- Render a simplified, static waveform visualization of the audio on a
<canvas> element. You will be provided with mock waveform data (an array of numbers representing amplitude peaks).
- The waveform should visually indicate the current playback position.
- When seeking, the waveform's playback indicator should update instantly.
UI/UX expectations
- The audio player should have a clear, functional layout.
- Controls (play/pause, volume slider) should be easily accessible.
- The waveform visualization should be prominent and interactive for seeking.
- Ensure a responsive and smooth user experience for playback and seeking.
- Consider basic accessibility for interactive elements (e.g., button states).
Acceptance criteria
- Clicking a play/pause button toggles audio playback.
- The current time and total duration update accurately during playback.
- Dragging or clicking on the waveform/progress bar seeks the audio to the selected position.
- The volume slider correctly adjusts the audio output level.
- A static waveform is rendered on a canvas element using the provided mock data.
- A visual indicator (e.g., a vertical line) on the waveform accurately reflects the current playback position and updates on seek/play.