File size: 2,612 Bytes
83f6fc8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571af37
 
83f6fc8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Icon Button Video Selector</title>
    <style>
        .icon-container {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }
        .icon-button {
            cursor: pointer;
            border: none;
            background: none;
            padding: 10px;
        }
        .icon-button img {
            width: 50px; /* Adjust the size as needed */
            height: auto;
        }
    </style>
</head>
<body>
    <div class="icon-container">
        <button class="icon-button" onclick="showVideo('https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video1.mov')">
            <img src="https://huggingface.co/spaces/tonyassi/g/resolve/main/icon/fish.png" alt="Fish Icon">
        </button>
        <button class="icon-button" onclick="showVideo('https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video2.mov')">
            <img src="https://huggingface.co/spaces/tonyassi/g/resolve/main/icon/david.png" alt="David Icon">
        </button>
    </div>

    <div id="videoContainer" style="margin-top: 20px; display: none;">
        <video id="videoPlayer" width="600" controls loop>
            <source id="videoSource" src="" type="video/mp4">
            Your browser does not support the video tag.
        </video>
    </div>

    <script>
        function showVideo(videoUrl) {
            const videoContainer = document.getElementById('videoContainer');
            const videoPlayer = document.getElementById('videoPlayer');
            const videoSource = document.getElementById('videoSource');

            videoSource.src = videoUrl;
            videoPlayer.load();
            videoPlayer.play();
            //videoContainer.style.display = 'block'; // Show the video container
        }

        // Add event listeners for focus and blur to detect fullscreen exit
        const videoPlayer = document.getElementById('videoPlayer');
        videoPlayer.addEventListener('webkitendfullscreen', hideVideoOnExit); // Specific to iOS Safari
        videoPlayer.addEventListener('pause', hideVideoOnExit); // Additional fallback for mobile
        videoPlayer.addEventListener('ended', hideVideoOnExit); // Hide when video ends (optional)

        function hideVideoOnExit() {
            const videoContainer = document.getElementById('videoContainer');
            videoContainer.style.display = 'none'; // Hide the video container
        }
    </script>
</body>
</html>