stream.html 2.78 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<!--
Copyright (C) 2023 Stefy Lanza <stefy@nexlab.net> and SexHack.me

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
-->
17 18 19 20
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
21 22
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Video Stream</title>
23
    <style>
24
        body, html {
25 26
            margin: 0;
            padding: 0;
27
            height: 100%;
28 29 30 31
            overflow: hidden;
        }
        #videoContainer {
            width: 100%;
32
            height: 100%;
33
        }
34
        video {
35 36
            width: 100% !important;
            height: 100% !important;
37
            object-fit: contain;
38 39 40 41 42
        }
    </style>
</head>
<body>
    <div id="videoContainer">
43
        <video id="videoPlayer" autoplay muted playsinline>
44
            <source type="video/mp4">
45 46 47 48 49
            Your browser does not support the video tag.
        </video>
    </div>
    <script src="https://vjs.zencdn.net/7.20.3/video.min.js"></script>
    <script>
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
   	window.onload = function() {
      	var player = videojs('videoPlayer', {
              html5: {
                  vhs: {
                   overrideNative: !videojs.browser.IS_SAFARI
                  },
              nativeAudioTracks: false,
              nativeVideoTracks: false,
              autoplay: true,
				  muted: true,
				  controls: false,
              fluid: true,
              respomsive: true
              }});
      	player.src({ src: '{{ stream_url }}', type: 'application/x-mpegURL'});
      	player.play();
   	};
67

68 69 70 71 72 73 74
        // Function to handle resize
        function handleResize() {
            var videoContainer = document.getElementById('videoContainer');
            var video = document.getElementById('videoPlayer');
            video.style.width = videoContainer.clientWidth + 'px';
            video.style.height = videoContainer.clientHeight + 'px';
        }
75

76 77 78
        // Call handleResize initially and on window resize
        handleResize();
        window.addEventListener('resize', handleResize);
79

80 81 82 83
        // Listen for messages from the parent window
        window.addEventListener('message', function(event) {
            if (event.data === 'resize') {
                handleResize();
84
            }
85
        }, false);
86 87 88
    </script>
</body>
</html>