From the course: Learning Web Audio and Video

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Program button controls

Program button controls

From the course: Learning Web Audio and Video

Start my 1-month free trial

Program button controls

- [Instructor] We've created a set of button elements representing core playback functions, but even though these buttons are stylized nicely, they will not yet respond to user interaction. We'll change that through use of the media API. Let's go down to where we created our different event listeners and we'll find our play and pause functions that play and pause our media. For each of these, we'll want to add a line in between the curly brackets, this is where our function commands are going to go, and it's actually super simple to get the media to play and pause. All we need to do is refer to our video element variable, which we've named media, and for media we'll just say play for play media, and we're going to do something very similar for pause media, we'll say media pause, and that's really all there is to it. Let's test it out in the web browser. If I hit play. (waves crash) There it goes. And pause. The media API already has direct access to the play and pause functions. We've…

Contents