I'm capturing screen by using media recorder and making video from blob but that video is not showing it's duration i have tried all way but not able to get the duration. I used get getID3(PHP) but not working i used many other ways but only one way works for me which where two steps i have defined below:|
var vid = document.createElement("video");
vid.src = url;
object.addEventListener("loadedmetadata", function() {
if(vid.duration === Infinity) {
vid.currentTime = 1000000000;
}
});
var duration = 0;
var speed_factor = 0.0;
object.addEventListener("timeupdate", function() {
duration = vid.duration;
if(duration <= 10.0)
{
speed_factor = 1.0;
}else if(duration <= 30.0)
{
speed_factor = 1.5;
}else if(duration <= 60.0)
{
speed_factor = 2.0;
}else if(duration <= 120.0)
{
speed_factor = 3.0;
}else if(duration <= 180.0)
{
speed_factor = 4.0;
}else if(duration <= 240.0)
{
speed_factor = 5.0;
}else{
speed_factor = 10.0;
}
$("#source1").attr("src", url);
$("#source2").attr("src", url);
$("#videoplayer").get(0).defaultPlaybackRate = speed_factor;
console.log("The video duration is "+ duration+" and speed factor is "+speed_factor);
$('#videoplayer').get(0).load();
$('#videoplayer').get(0).play();
});