I want to prevent the video from uploading more than 1 minute in react js .
I searched a lot but I couldn't find it.
I guess you have to let the user select the video in from pc or phone, when it is loaded on the browser not uploaded yet make sure your upload button is inactive at this time and you have some message showing the user that you are busy working on the vide. That time try this
// Assume "video" is the video node
var i = setInterval(function() {
if(video.readyState > 0) {
var minutes = parseInt(video.duration / 60, 10);
var seconds = video.duration % 60;
// (Put the minutes and seconds in the display)
clearInterval(i);
}
}, 200);
[Link to full post on video operations in the browser][1]
I hope you find this helpful.
[1]: https://davidwalsh.name/html5-video-duration#:~:text=The%20JavaScript&text=To%20display%20the%20duration%20in,)%3B%20var%20seconds%20%3D%20video.