I need detect all frames changes of a video in HTML 5, i tried the follow code, but i can't get all changes, only i can get eight or nine updates per second..
<body>
<canvas id=Canvas width=800 height=450 style=position:absolute; left:5; top:5>Can't Load Canvas</canvas>
<video id=videoPlay muted controls>
<source src=assets/soccer.webm type=video/webm>
<source src=assets/soccer.mp4 type=video/mp4>
Your browser does not support the video tag.
</video>
</body>
<script type=text/javascript>
videoPlay.addEventListener('timeupdate', function (){
putOverlay();
});
function putOverlay(){
console.log(videoPlay.currentTime);
console.log(another frame);
}
</script>
</html>
I tried the following code too, but with a timer there is a loss of synchronization between the frame and the value given by the timer, over time..
<body>
<canvas id=LeCanvas width=800 height=450 style=position:absolute; left:5; top:5>Can't Load Canvas</canvas>
<!-- Video -->
<video id=videoPlay controls>
<source src=assets/soccer.webm type=video/webm>
<source src=assets/soccer.mp4 type=video/mp4>
Your browser does not support the video tag.
</video>
</body>
<!-- Play Video-->
<script>
//Play Damn Video
var videoPlay = $('#videoPlay')[0];
videoPlay.play(1);
</script>
<!-- Canvas Animation -->
<script>
//Animation
function animate() {
console.log(frame change);
}
setInterval(animate, 1000/29.97);
</script>
Any suggestions for my problem?
Sorry my english
regards
Alex