Serve different video crops based on viewport size
This video uses the media attribute on <source> elements
to serve different video crops based on your viewport size. Resize your browser to see the effect.
<video controls poster="poster.jpg">
<!-- Vertical video for mobile -->
<source
src="video-vertical.mp4"
type="video/mp4"
media="(max-width: 767px) and (orientation: portrait)"
/>
<!-- Square video for tablet -->
<source
src="video-square.mp4"
type="video/mp4"
media="(min-width: 768px) and (max-width: 1023px)"
/>
<!-- Widescreen for desktop -->
<source
src="video-widescreen.mp4"
type="video/mp4"
media="(min-width: 1024px)"
/>
<!-- Fallback -->
<source src="video-standard.mp4" type="video/mp4" />
</video>
<source> whose media query matches.
Different screen sizes have different optimal aspect ratios and compositions. Art direction ensures your video content looks intentional and professional on every device: