
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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 Articles
- HTML DOM Video duration Property
- Get video duration using OpenCV Python
- HTML5 video not playing in Firefox
- HTML5 video full preload in JavaScript
- Commonly used Video formats while using HTML5 video
- Display video inside HTML5 canvas
- How to display video control in HTML5?
- Play local (hard-drive) video file with HTML5 video tag?
- Play infinitely looping video on-load in HTML5
- Playing MP4 video in WebView using HTML5 in Android
- Why I am facing a problem using the field 'from' in SQL query?
- I am facing problem in using include directive tag in jsp. Please share a working example.
- HTML5 Video Tag in Chrome - Why is currentTime ignored when video downloaded from my webserver?
- HTML5 inline video on iPhone vs iPad/Browser
- Converting video to HTML5 ogg / ogv and mpg4

Advertisements