

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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);
- Related Questions & Answers
- HTML DOM Video duration Property
- Commonly used Video formats while using HTML5 video
- Display video inside HTML5 canvas
- HTML5 video not playing in Firefox
- HTML5 video full preload in JavaScript
- Play local (hard-drive) video file with HTML5 video tag?
- Why I am facing a problem using the field 'from' in SQL query?
- Play infinitely looping video on-load in HTML5
- I am facing problem in using include directive tag in jsp. Please share a working example.
- Playing MP4 video in WebView using HTML5 in Android
- HTML5 inline video on iPhone vs iPad/Browser
- Converting video to HTML5 ogg / ogv and mpg4
- Using FFMPEG with HTML5 for online video hosting
- HTML5 Video Tag in Chrome - Why is currentTime ignored when video downloaded from my webserver?
- Streaming a video file to an HTML5 video player with Node.js so that the video controls continue to work
Advertisements