Display stream of Images like a video in HTML
<p>I have created a PHP file extract images from MySQL database and display them as a sequence of images updated every half second. So every half second the page gets updated and a new picture comes up using setInterval method in JavaScript. </p>

<pre><code>$(document).ready(function(){
setInterval(function() {
    var myImageElement = document.getElementById('myImage');
    myImageElement.src ='http://145.71.111.87/getImage.php?id='+ counter;
}, 500);});
</code></pre>

<p>counter is an id changed every time and the image that match this id get fetched every time. I want to display this stream in a similar way to a video in YouTube for instance, so I could stop, play and move the playing slider. Obviously by having the counter we can get any image in any position of the sequence. </p>