Good morning; It is possible to obtain the duration of a video by capturing it with input type="file"
<input type="file" class="" id="mivideo" name="mivideo>
either with JavaScript or jQuery or PHP
Good morning; It is possible to obtain the duration of a video by capturing it with input type="file"
<input type="file" class="" id="mivideo" name="mivideo>
either with JavaScript or jQuery or PHP
You can use duration
to get the duration of a video:
var x = document.getElementById("myVideo").duration;
You get the duration in seconds, so in your case you should evaluate that it does not exceed 180 seconds (3 minutes).
I'll attach an example:
function myFunction() {
var x = document.getElementById("video").duration;
document.getElementById("demo").innerHTML = x;
}
<html>
<body>
<video id="video" width="320" height="240" controls controlsList="nodownload">
<source src="http://html5facil.com/demos/videos/big_buck_bunny.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="http://html5facil.com/demos/videos/big_buck_bunny.mp4" type='video/mp4; codecs="avc1,mp4a"'>
</video>
<p>
<button onclick="myFunction()">Obtener duración</button>
<p id="demo"></p>
</body>
</html>
I hope I help you.