Home > Web Front-end > H5 Tutorial > HTML5 video event application example_html5 tutorial skills

HTML5 video event application example_html5 tutorial skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 15:47:31
Original
1498 people have browsed it
1. Get the video time length

When the video is loaded into the video, use the onloadedmetadata event to get the video time length.

Copy code
The code is as follows:

video.onloadedmetadata = function () {
var vLength = video.duration;
console.log(vLength);
}

2. Playback progress of the current video

When the video starts playing, you can use the ontimeupdate event to get the current playback progress of the video. The ontimeupdate event is triggered when the currentTime property of the video object changes. The currentTime property is a floating point decimal number that can take up to 12 digits of decimal places.

Copy code
The code is as follows:

video.ontimeupdate = function () {
var vTime = video.currentTime;
console.log(vTime);
};
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
html5 validation for symfony 2.1
From 1970-01-01 08:00:00
0
0
0
The difference between HTML and HTML5
From 1970-01-01 08:00:00
0
0
0
html5 show hide
From 1970-01-01 08:00:00
0
0
0
Can PDF files run HTML5 and Javascript?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template