How to play two different source video, when one end, then switch to the next one and loop the step?
<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Sequential Movies&lt;/title&gt;
    &lt;script type="text/javascript"&gt;
        // listener function changes src
        function myNewSrc() {
            var myVideo = document.getElementsByTagName('video')[0];
            myVideo.src = "2.m4v";
            myVideo.load();
            myVideo.play();
        myVideo.addEventListener('ended', myAddListener, false);
        }
        // add a listener function to the ended event

        function myAddListener(){
            var myVideo = document.getElementsByTagName('video')[0];
        myVideo.src = "1.m4v";
            myVideo.load();
            myVideo.play();
            myVideo.addEventListener('ended', myNewSrc, false);
        }
    &lt;/script&gt;
&lt;/head&gt;
&lt;body onload="myAddListener()"&gt;
    &lt;video controls
           src="1.m4v"&gt;
    &lt;/video&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>It seems the problem is video1 can switch to video2, but video2 can't switch back to video1.
How can I write a script to loop 1 > 2 > 1 > 2 > 1 > 2 > 1?
IS it possible to switch more than three video source?
I don't know what the bottom link talking about but it seems useful to help me.</p>

<p><a href="http://stackoverflow.com/questions/10668399/play-next-video-in-an-array-on-ended">play next video in an array on &quot;ended&quot;</a></p>
