Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Responsive Media in HTML5

You're reading from   Responsive Media in HTML5 Learn effective administration of responsive media within your website or CMS system using practical techniques

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781849696968
Length 128 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alex Libby Alex Libby
Author Profile Icon Alex Libby
Alex Libby
Arrow right icon
View More author details
Toc

Table of Contents (7) Chapters Close

Preface 1. Working with Responsive Images FREE CHAPTER 2. Adding Responsive Video Content 3. Mixing Content 4. Testing Responsive Media 5. Using Frameworks Index

Determining an available viewport for use

If you have spent any time developing content for responsive layouts, you will have no doubt come across media queries. The same applied to videos; you could typically see something akin to the following (simplified) example:

<video controls>
  <source src="the-sky-is-calling-large.mp4" media="screen and (min-width:800px)">
  <source src="the-sky-is-calling-small.mp4" media="screen and (max-width:799px)">
</video>

Unfortunately, most browsers have since removed support for media queries. This is largely due to the poor user experience we get if the video is suddenly interrupted when resizing the screen. Fortunately, we can produce similar effects, although we need to resort to JavaScript or jQuery to achieve this. In this next example, we're going to show a small video if the screen is resized to a small window, or hide it when displayed in full screen. Let's take a look at...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime