Overview
At Stripe, rich media like video demonstrations are crucial for product showcases, user education, and internal training. A seamless and intuitive video playback experience is essential for engaging our users and employees. This problem focuses on building a custom, accessible set of controls for an HTML5 video element, allowing for a tailored user experience that goes beyond browser defaults.
What you need to do / Task
Your primary task is to create a custom video player UI that allows users to interact with an HTML5 <video> element. You will implement the following core functionalities:
- Video Rendering: Display a standard HTML5
<video> element with a provided source.
- Play/Pause Toggle: Implement a button that toggles the video's playback state (play/pause).
- Time Display: Show the current playback time and the total duration of the video, formatted clearly (e.g.,
0:00 / 2:30). These values should update dynamically during playback.
- Seek Bar (Progress Slider): Create a slider input that visually represents the video's current progress and allows the user to click or drag to seek to a different position in the video.
- Volume Control: Implement a slider input to control the video's volume level.
- Full-Screen Toggle: Add a button to toggle the video element into and out of full-screen mode.
UI/UX expectations
The video player should present a clean and functional interface.
- The video element should be clearly visible.
- Controls (play/pause, time, seek bar, volume, fullscreen) should be grouped logically below the video.
- The seek bar should provide clear visual feedback as the video plays and when the user interacts with it.
- Volume slider should intuitively adjust the sound output.
- All interactive elements (buttons, sliders) should be clearly distinguishable and respond to user input.
- Accessibility: Ensure basic keyboard accessibility for the primary controls (e.g.,
Space key to toggle play/pause, arrow keys for seeking/volume adjustment if time permits).
Acceptance criteria
Your solution will be evaluated based on the following observable behaviors:
- Clicking the play/pause button accurately toggles the video's playback state.
- The current time and total duration display updates smoothly and correctly during playback.
- The seek bar visually reflects the video's progress and allows users to scrub to any point in the video.
- The volume slider correctly controls the video's audio level.
- Clicking the full-screen button toggles the video element into and out of browser full-screen mode.
- Primary controls (e.g., play/pause) are operable using keyboard input.