play_videos.html 908 Bytes
Newer Older
boklm's avatar
boklm committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<html>
<head>
<title>Videos</title>
</head>
<body>
    <div id="videos" />
    <div id="finished" />
    <script>

const videos = [ 
        "videos/320x240.ogg",
        "videos/320x240.skeleton+cmml.ogv",
        "videos/seek.webm",
        ];
//      "videos/gizmo.mp4",

var next = {};

for (var i = 0; i < videos.length; i++) {
    var v = document.createElement('video');
    v.id = 'videos_' + i;
    v.src = videos[i];
    v.controls = 1;
    v.addEventListener("ended", function() {
            if (next[this.id])
                document.getElementById(next[this.id]).play();
            else
                document.getElementById("finished").innerHTML = 'finished';
    }, true);
    if (i + 1 < videos.length)
        next[v.id] = 'videos_' + (i + 1).toString();
    document.getElementById("videos").appendChild(v);
}
document.getElementById("videos_0").play();

    </script>
</body>
</html>