Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Facing Problem in retrieving HTML5 video duration
To get the video duration, query the readyState attribute. It has a series from 0 to 4. When the metadata has loaded, the value you will get is 1.
Therefore, you need to do something like −
window.setInterval(function(tm) {
// Using readyState attriute
if (video.readyState > 0) {
var duration = $('#duration').get(0);
// for video duration
var video_duration = Math.round(video.duration);
duration.firstChild.nodeValue = video_duration;
clearInterval(tm);
}
},1000); Advertisements
