From the course: Learning Web Audio and Video

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Overview of media API

Overview of media API

- [Instructor] Both audio and video elements can tap into the HTML 5 media API. We'll make use of this application programming interface to not only wire up expected playback controls, but also to read certain media properties, and respond to various events. What we'll need to do is to create a script tag within our content here. So let's go all the way down to the bottom of our body, and we'll insert a script tag. Adding any JavaScript at the end of our body is going to insure that all of these different items have rendered already, and are addressable via JavaScript. One additional change we'll need to make, is to put an ID on our video element, so that we can address it through the API. We'll set ID equal to videoelement. And there we are. Going back down to our script tag here, all we're going to do is set up and define a bunch of variables that point to some of these specific document elements. We'll create a new variable with the keyword var, and the variable name is going to be…

Contents