const i = setInterval(function() { if(video.readyState > 0) { var minutes = parseInt(video.duration / 60, 10); var seconds = video.duration % 60; clearInterval(i); } }, 200);