HTML and CSS Reference
In-Depth Information
n
Note
It's always a good practice to check whether the browser supports
<audio>
and
<video>
tags before
you attempt to play the media files. As discussed in Chapter 1, you can use Modernizr library for that purpose. A
sample check looks like this:
$(document).ready(function () {
if (!Modernizr.audio) {
alert("This browser doesn't support HTML5 audio!");
}
if (!Modernizr.video) {
alert("This browser doesn't support HTML5 video!");
}
});
Creating a Custom Video Player Using the Video API
To see the properties, methods, and events of the
<video>
element in action, let's build a custom video
player in an ASP.NET MVC application. The video player looks like the one shown in Figure 3-7.
Figure 3-7.
A custom video player