Understanding HTML5 video and audio
Video: Understanding HTML5 video and audioAt this point with all the discussion around it, it would be hard to believe that you've never heard of HTML5 video. Still I think to dive into what HTML5 video is exactly would be useful. HTML5 video is the future of video playback on the web. You can see in this chart that I believe somewhere around 2015 HTML5 video will be the primary method for video playback on the web. Looking back, when video started with plug-ins like Real Player, QuickTime and Windows Media Player, there wasn't a clearly dominant plug-in at the time so what developers would often try to support all three, to make sure video could reach as much of their audience as possible.
- Further exploration
Viewers: in countries Watching now:
- Understanding the differences in media formats
- Preloading, autoplaying, and looping in HTML5
- Setting a video's width and height attributes
- Displaying subtitles and captions
- Generating embed code with an embed code builder
- Encoding files using HandBrake, Firefogg, and VLC
- Creating a load progress bar
- Recognizing Android and iOS issues
Understanding HTML5 video and audio
At this point with all the discussion around it, it would be hard to believe that you've never heard of HTML5 video. Still I think to dive into what HTML5 video is exactly would be useful. HTML5 video is the future of video playback on the web. You can see in this chart that I believe somewhere around 2015 HTML5 video will be the primary method for video playback on the web. Looking back, when video started with plug-ins like Real Player, QuickTime and Windows Media Player, there wasn't a clearly dominant plug-in at the time so what developers would often try to support all three, to make sure video could reach as much of their audience as possible.
Then Flash came on the scene and was able to gain a high enough level of user adoption that Web developers could support almost all their audience just through Flash. To this day Flash has a solid lead over other plug-ins in both user support and web developers using it for video playback. Now very much thanks to Flash video has become an integral part of the web. According to comScore, 83.5% of Internet users viewed online video in March 2011. During the rise of Flash and video on the web, browser developers recognized the importance of video and started tossing around the idea of making video a native part of HTML and the browser experience just like text and images.
In 2007, the developers of the Opera web browser released a version of Opera that included support for a video tag that mimicked the image tag and would play back video in the browser using a built-in video player as opposed to a plug-in. From this the specification for an HTML video tag was born. In the following years rather developers and other interested parties continue to refine the specification and other browsers besides Opera began building in their own video players and support for the video tag. Now a very important distinction should be pulled from this.
With HTML5 video each web browser is building their own video player, which means one browser's video player could be very different from the next. One of the benefits of Flash is that since it's a plug-in, it's basically the same code running in each browser and from the most part you can expect Flash video in Internet Explorer to work the same as it does in Firefox. With HTML5 video, video could work differently in each browser because each browser vendor is building their own player. Different styles of controls in each browser illustrate this point.
You can see they look very different. But despite the fact that they look different, they all have the same basic controls and work as expected. This is where the importance of standards comes in. That specification for the HTML video tag that I mentioned is instructions for browser developers on how the video tag should work. And for the most part, they've all done a great job of following these instructions, aside from certain browsers not supporting specific features quite yet. When they do support a feature, they all support it in basically same way. So we can expect the video tag to work the same in all browsers.
This is great because we all know what it's like when browsers don't work the same way. If you're interested you can read the video tag specifications on either the W3C site or the WHATWG site. Both are basically the same and they are actually maintained by the same person. WHATWG site I believe tends to have the most recent information, but is also more likely to change, whereas the W3C version is more locked down. But remember these are instructions for the browser developers and not necessarily for us as web developers, though it's a great resource for us to see how the video tag should work.
So I have talked a lot about HTML5 video specifically but what about HTML5 audio? So it's called HTML5: Video and Audio in Depth, right? Well, HTML5 audio is basically the little brother of HTML5 video. They are both built on top of the same parent element, the media element, which means they share the same DNA. In fact I don't believe there's any attribute of the audio element that can't be found in the video element as well, except for these specific file types that the audio element supports. Which makes sense because videos also have audio in them, but there are a number of attributes that the video element has and audio doesn't. And they all center around the fact that you're also viewing something at the same time.
It includes things like an option for poster frame or setting the width and height of the viewable area. So there may be times where I focus on video and don't mention audio just because so much of what applies to video also applies to audio and in those cases you can assume that what I am talking about also applies to audio. But I'll be sure to include discussions and examples of audio whenever it would be helpful and especially wherever there are differences. So that's a pretty good background on what HTML5 video and audio are and there is a good chance a lot of that isn't new to you.
But what can be unclear is where HTML5 is in the process of becoming that primary media playback technology and what workarounds are required to make it a reality today. So next, I am going to discuss the state of HTML5 video and audio.
There are currently no FAQs about HTML5: Video and Audio in Depth.