'how to get a video's duration in both php and javascript?
I want to get the duration of the video while user uploading the video. I dont want to put the video tag in html. I want the getting video duration code in both php and javascript or jquery. thank you
Solution 1:[1]
In HTML5 you can simply get a video's duration in Javascript with the duration function. For example:
document.getElementById("video").duration();
Do check if it has loaded already by using the following: (else you get an error)
document.getElementById("video").currentTime > 0;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mwaning |
