File size: 1,543 Bytes
8a4d760
 
 
 
 
efb9bf1
8a4d760
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b49cb20
8a4d760
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>why? cause we're playing bendy</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        html, body {
            height: 100%;
            background: black;
        }
        video {
            position: fixed;
            top: 50%;
            left: 50%;
            min-width: 100%;
            min-height: 100%;
            width: auto;
            height: auto;
            transform: translate(-50%, -50%);
            object-fit: cover;
        }
    </style>
</head>
<body>

    <video id="myVideo" autoplay playsinline>
        <source src="https://i.yourimageshare.com/xdpwPMMmXy.mp4" type="video/mp4">
        <!-- add more formats if you want -->
        <!-- <source src="yourvideo.webm" type="video/webm"> -->
    </video>

    <script>
        const video = document.getElementById('myVideo');

        // when video finishes playing, close the tab
        video.addEventListener('ended', () => {
            window.close();
        });

        // optional: make it loop once before closing if you want, but you said close when it finishes
        // video.loop = false; // default is already false

        // force video to play (some browsers are strict)
        video.play().catch(e => {
            console.log("autoplay blocked, user needs to interact");
        });
    </script>

</body>
</html>