Add Fast-Forward and Rewind 15 Second Buttons

InstructorLindsey Kopacz

Share this video with your friends

Send Tweet

We will create two buttons labeled "rewind 15 seconds" and "fast forward 15 seconds." Then, we created two functions, onRewind and onFastForward, to adjust the current time of a media by 15 seconds. The onRewind function will use Math.max to ensure that the time does not go into negative, and the onFastForward function will use Math.min to set a max limit. These functions will be added to the click events of the corresponding buttons. Finally, it sets the new time for the media state and the audio reference.

Think about: Why do you need the second parameter for math.max and math.min?