Users are going to be uploading video contents to my WordPress site.
How do I reject content if more than 1 minute or 60 seconds. They will be uploading via html or ajax form. Which is better to achieve this, JavaScript or php?
Users are going to be uploading video contents to my WordPress site.
How do I reject content if more than 1 minute or 60 seconds. They will be uploading via html or ajax form. Which is better to achieve this, JavaScript or php?
You can get the video duration like that:
var vid = document.getElementById("video");
var duration = document.getElementById("duration");
vid.addEventListener('loadedmetadata', function() {
duration.innerHTML = vid.duration;
});
<div id="duration"></div>
<video src="http://media.w3.org/2010/05/sintel/trailer.mp4" width=300 height=200 id="video"></video>
Otherwise, to get the video duration when the user select the file in the File Browser, you can check the already answered question here: https://stackoverflow.com/a/29285597/1738016