GuidePlayback
Show timeline thumbnail previews
Preview frames along the timeline while the user scrubs, powered by a storyboard track.
Show preview frames along the timeline while the user scrubs, like YouTube’s seek previews.
Recommended approach
Add a <track kind="metadata" label="thumbnails" default> whose cues reference storyboard images. Then put a slider thumbnail inside the <media-time-slider>. Scrubbing shows the frame under the pointer. The slider thumbnail reads the pointer time from the slider, so you never pass time; it otherwise accepts the same attributes as the standalone <media-thumbnail>.
<media-slider-thumbnail> draws its own image unless you supply an <img> child. Set crossorigin, loading, or fetchpriority on the element itself or on that image.
How it works
- Previews come from a storyboard: a
kind="metadata"text track labeledthumbnailswhose WebVTT cues map time ranges to image URLs (optionally with sprite coordinates). The text track feature exposes this track asthumbnailsTrack, with itscuesandsrc. - The slider thumbnail renders the storyboard frame for the slider’s pointer position. While the pointer is over the slider, the slider sets
data-pointingand the--media-slider-pointerCSS variable; the example’s CSS uses them to reveal the preview and position it over the pointer. - To render a storyboard frame outside the slider — a fixed preview for a chapter list, for example — use the standalone
<media-thumbnail>element with an explicittime.
Each cue’s text is an image URL. An optional #xywh=x,y,w,h fragment crops one frame out of a sprite sheet:
Availability and constraints
- Thumbnails require a storyboard asset generated alongside the media; the player doesn’t extract frames from the video itself.
- Cross-origin storyboards need CORS headers, and
crossoriginon the media component for the track to load. - Cues load asynchronously. The track appears before its cues are parsed, so previews fill in when the track finishes loading.
- Storyboard images download on demand; oversized sprite sheets hurt seek-preview responsiveness more than they help quality.
Common variations
Customize the skin’s thumbnail image
Inside a packaged skin, an <img slot="thumbnail"> replaces the image the skin carries, so image attributes go on it:
Troubleshooting
Thumbnails don’t appear while scrubbing
Confirm the storyboard track is kind="metadata" with label="thumbnails" and has the default attribute — the browser leaves a non-default track disabled and never loads its cues. Then confirm the VTT loads (network panel) and cross-origin assets have CORS headers with crossorigin set on the media component.
Thumbnails are blurry or slow
Regenerate the storyboard with a larger frame size, or split giant sprite sheets into smaller images.