play_videos.html 1.04 KB
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
<html>
<head>
<title>Videos</title>
</head>
<body>
    <div id="videos" />
    <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() {
24
            if (next[this.id]) {
boklm's avatar
boklm committed
25
                document.getElementById(next[this.id]).play();
26
27
28
29
30
31
            } else {
                var result = document.createElement('div');
                result.innerHTML = 'OK';
                result.setAttribute("id", "test_result");
                document.getElementsByTagName("body")[0].appendChild(result);
            }
boklm's avatar
boklm committed
32
33
34
35
36
37
38
39
40
41
    }, 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>