The previous article introduces some work that needs to be done in the initialization of the html5 tag video (player), how to use the html5 player simply and quickly. This article will focus on how to use JS to operate the video tag, that is, how to do some simple and basic operations on the video, including player playback, pause, volume reading, setting and other writing operations, thereby starting the player's expansion path.
Table of contents of this article:1. Get the total video duration
2. Play, pause
3. Get the playback time and set the playback point of the video
4. Get and set volume
First, get the total video timeWhen operating a player (video), the first thing you need to get is some information about the video, one of which is the total duration. In addition to the content, the total duration is also displayed as soon as possible. Before operating on video, add an ID to the video tag, so that we can get the video element
Copy the code