Overview
Modern web applications often require more than just basic video playback. Custom video player controls enable unique branding, enhanced accessibility features, and tailored user experiences that standard browser controls might not offer. In this problem, you will build a set of essential custom controls for an HTML5 video element, focusing on core playback functionality and user interaction.
What you need to do / Task
Your task is to implement a custom control bar for a given HTML5 video element. You must provide the following functionalities:
- Play/Pause Toggle: A button that allows users to start and stop video playback.
- Progress Bar: A visual indicator that displays the current playback position and allows users to seek to different parts of the video by dragging or clicking.
- Time Display: Show the current playback time and the total duration of the video (e.g.,
0:30 / 2:15).
- Volume Control: A slider to adjust the video's volume.
- Mute/Unmute Toggle: A button to quickly mute and unmute the video.
UI/UX expectations
- The custom controls should be clearly visible and interactable, positioned below or overlaid on the video element.
- The Play/Pause button should visually reflect the current playback state (e.g., changing from a 'Play' icon to a 'Pause' icon).
- The progress bar should update smoothly as the video plays and allow for intuitive seeking.
- The time display should be formatted for readability.
- The volume control should accurately reflect and change the video's audio level, with the mute button toggling the sound without affecting the volume slider's position (when unmuted, volume should return to its previous state).
Acceptance criteria
- Video plays when the 'Play' button is clicked and pauses when the 'Pause' button is clicked.
- The Play/Pause button icon accurately reflects the current playback state.
- The progress bar updates in real-time as the video plays.
- Clicking or dragging the progress bar seeks the video to the corresponding position.
- The current time and total duration are displayed and updated correctly.
- The volume slider adjusts the video's audio level between 0% and 100%.
- Clicking the mute button toggles the video's muted state.
- When unmuted, the volume returns to its previous level before muting (if applicable).