Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Goldberg
407 PointsVideo fallback for full width hero video when using CMS component?
Hey all,
Wondering what the best solution is for providing fallback for video if not supported.
<div class="container"> <video autoplay="" loop="" preload="" poster="https://cms.com/file.jpg"> <source src="https://example.com/file.mp4" type="video/mp4"> <source src="https://example.com/file.webm" type="video/webm"> <source src="https://example.com/file.ogv" type="video/ogg"> </video> </div>
You could degrade gracefully by putting a background on the container but the background would be supplied via the CMS, so it would be different per new instance/post.
I guess you could:
- Inline the background css on the container
- Use Javascript to check for video support and set the background styles using a data attribute
- Insert an image into the markup and show/hide image using Javascript to figure out video support
Anyone have any preferred solutions or suggestions?