Spaces:
Sleeping
Sleeping
Update bot/server/templates/player.html
Browse files- bot/server/templates/player.html +104 -192
bot/server/templates/player.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
-
<title>
|
| 5 |
|
| 6 |
<meta charset="UTF-8">
|
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
@@ -15,287 +15,199 @@
|
|
| 15 |
|
| 16 |
<style>
|
| 17 |
:root {
|
| 18 |
-
--primary-color: #
|
| 19 |
-
--hover-color: #
|
| 20 |
-
--text-color: #
|
| 21 |
-
--
|
| 22 |
-
--
|
| 23 |
-
--control-hover: rgba(99, 102, 241, 0.9);
|
| 24 |
}
|
| 25 |
-
|
| 26 |
-
* {
|
| 27 |
-
margin: 0;
|
| 28 |
-
padding: 0;
|
| 29 |
-
box-sizing: border-box;
|
| 30 |
-
font-family: 'Poppins', sans-serif;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
html, body {
|
| 34 |
margin: 0;
|
| 35 |
height: 100%;
|
| 36 |
-
|
| 37 |
-
color:
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
.player-container {
|
| 41 |
-
height: 100%;
|
| 42 |
-
width: 100%;
|
| 43 |
-
position: relative;
|
| 44 |
overflow: hidden;
|
| 45 |
-
display: flex;
|
| 46 |
-
justify-content: center;
|
| 47 |
-
align-items: center;
|
| 48 |
}
|
| 49 |
|
| 50 |
#stream-media {
|
| 51 |
height: 100%;
|
| 52 |
width: 100%;
|
| 53 |
-
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
#error-message {
|
| 57 |
-
|
| 58 |
-
top: 50%;
|
| 59 |
-
left: 50%;
|
| 60 |
-
transform: translate(-50%, -50%);
|
| 61 |
-
color: #ef4444;
|
| 62 |
font-size: 1.25rem;
|
| 63 |
text-align: center;
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
border-radius: 0.5rem;
|
| 67 |
-
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 68 |
-
max-width: 90%;
|
| 69 |
}
|
| 70 |
|
| 71 |
-
/*
|
| 72 |
.plyr--full-ui input[type=range] {
|
| 73 |
color: var(--primary-color);
|
| 74 |
}
|
| 75 |
|
| 76 |
-
.plyr--video .plyr__control.plyr__tab-focus,
|
| 77 |
-
.plyr--video .plyr__control:hover,
|
| 78 |
-
.plyr--video .plyr__control[aria-expanded=true] {
|
| 79 |
-
background: var(--hover-color);
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
.plyr__control--overlaid {
|
| 83 |
-
background: var(--
|
| 84 |
-
|
| 85 |
-
transition:
|
|
|
|
| 86 |
}
|
| 87 |
|
| 88 |
.plyr__control--overlaid:hover {
|
| 89 |
-
background: var(--
|
| 90 |
-
transform: scale(1.1)
|
| 91 |
}
|
| 92 |
|
| 93 |
-
.
|
| 94 |
-
background:
|
| 95 |
-
|
| 96 |
}
|
| 97 |
|
| 98 |
-
.
|
| 99 |
-
|
| 100 |
-
border-radius: 0.5rem !important;
|
| 101 |
}
|
| 102 |
|
| 103 |
-
.
|
| 104 |
-
|
| 105 |
-
color: var(--text-color) !important;
|
| 106 |
}
|
| 107 |
|
| 108 |
-
.
|
| 109 |
-
|
| 110 |
}
|
| 111 |
|
| 112 |
-
/*
|
| 113 |
-
.
|
| 114 |
position: absolute;
|
| 115 |
-
width:
|
| 116 |
-
height:
|
| 117 |
-
background-color: var(--
|
| 118 |
border-radius: 50%;
|
| 119 |
-
|
| 120 |
-
|
|
|
|
| 121 |
color: var(--text-color);
|
| 122 |
z-index: 10;
|
| 123 |
transition: all 0.3s ease;
|
| 124 |
-
|
| 125 |
-
border: 2px solid rgba(255, 255, 255, 0.1);
|
| 126 |
-
backdrop-filter: blur(5px);
|
| 127 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 128 |
}
|
| 129 |
|
| 130 |
-
.
|
| 131 |
-
|
| 132 |
-
|
| 133 |
}
|
| 134 |
|
| 135 |
-
.plyr__video-wrapper .
|
| 136 |
-
|
| 137 |
-
right: 72px;
|
| 138 |
}
|
| 139 |
|
| 140 |
-
.
|
| 141 |
-
|
| 142 |
-
|
| 143 |
}
|
| 144 |
|
| 145 |
-
.
|
| 146 |
-
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
.plyr, .plyr__video-wrapper, .plyr__video-embed iframe {
|
| 150 |
height: 100%;
|
| 151 |
-
border-radius:
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
/* Loading animation */
|
| 155 |
-
.loading-overlay {
|
| 156 |
-
position: absolute;
|
| 157 |
-
top: 0;
|
| 158 |
-
left: 0;
|
| 159 |
-
width: 100%;
|
| 160 |
-
height: 100%;
|
| 161 |
-
background-color: var(--dark-bg);
|
| 162 |
-
display: flex;
|
| 163 |
-
justify-content: center;
|
| 164 |
-
align-items: center;
|
| 165 |
-
z-index: 20;
|
| 166 |
-
opacity: 1;
|
| 167 |
-
transition: opacity 0.5s ease;
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
.loading-overlay.hidden {
|
| 171 |
-
opacity: 0;
|
| 172 |
-
pointer-events: none;
|
| 173 |
}
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
border: 5px solid rgba(255, 255, 255, 0.1);
|
| 179 |
-
border-radius: 50%;
|
| 180 |
-
border-top-color: var(--primary-color);
|
| 181 |
-
animation: spin 1s ease-in-out infinite;
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
@keyframes spin {
|
| 185 |
-
to { transform: rotate(360deg); }
|
| 186 |
}
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
height: 36px;
|
| 193 |
-
line-height: 36px;
|
| 194 |
-
}
|
| 195 |
}
|
| 196 |
</style>
|
| 197 |
</head>
|
| 198 |
|
| 199 |
<body>
|
| 200 |
-
<
|
| 201 |
-
<
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
<source src="" type="">
|
| 207 |
-
<p class="vjs-no-js">
|
| 208 |
-
To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
|
| 209 |
-
</p>
|
| 210 |
-
</video>
|
| 211 |
|
| 212 |
-
|
| 213 |
-
</div>
|
| 214 |
|
| 215 |
<script>
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
-
//
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
speed: {selected: 1, options: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 3]},
|
| 224 |
-
seekTime: 10,
|
| 225 |
-
keyboard: { focused: true, global: true },
|
| 226 |
-
tooltips: { controls: true, seek: true },
|
| 227 |
-
disableContextMenu: false,
|
| 228 |
-
quality: { default: 720, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240] }
|
| 229 |
});
|
| 230 |
|
| 231 |
-
|
| 232 |
-
const mediaLink = "{{ mediaLink }}";
|
| 233 |
|
| 234 |
if (mediaLink) {
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
// Hide loading overlay
|
| 241 |
-
setTimeout(() => {
|
| 242 |
-
loadingOverlay.classList.add('hidden');
|
| 243 |
-
}, 600);
|
| 244 |
-
|
| 245 |
-
// Add download button
|
| 246 |
-
const downloadButton = document.createElement('div');
|
| 247 |
-
downloadButton.className = 'custom-button plyr-download-button';
|
| 248 |
downloadButton.innerHTML = '<i class="fas fa-download"></i>';
|
| 249 |
-
|
| 250 |
downloadButton.onclick = function(event) {
|
| 251 |
event.stopPropagation();
|
| 252 |
-
|
| 253 |
link.href = mediaLink;
|
| 254 |
link.download = mediaLink.split('/').pop();
|
| 255 |
-
link.setAttribute('download', '');
|
| 256 |
document.body.appendChild(link);
|
| 257 |
link.click();
|
| 258 |
document.body.removeChild(link);
|
| 259 |
};
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
shareButton
|
|
|
|
| 264 |
shareButton.innerHTML = '<i class="fas fa-share-alt"></i>';
|
| 265 |
-
|
| 266 |
shareButton.onclick = function(event) {
|
| 267 |
event.stopPropagation();
|
| 268 |
if (navigator.share) {
|
| 269 |
navigator.share({
|
| 270 |
-
title: "
|
| 271 |
-
url:
|
| 272 |
-
}).catch(err => {
|
| 273 |
-
console.error('Share failed:', err);
|
| 274 |
});
|
| 275 |
} else {
|
| 276 |
// Fallback for browsers that don't support Web Share API
|
| 277 |
-
|
|
|
|
|
|
|
| 278 |
}
|
| 279 |
};
|
| 280 |
-
|
| 281 |
-
// Add buttons to player
|
| 282 |
-
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(downloadButton);
|
| 283 |
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(shareButton);
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
// Restart player to load the source
|
| 287 |
-
player.restart();
|
| 288 |
} else {
|
| 289 |
-
|
| 290 |
-
loadingOverlay.classList.add('hidden');
|
| 291 |
-
document.getElementById('error-message').innerHTML = '<i class="fas fa-exclamation-triangle"></i> Media URL not provided. Please try again later.';
|
| 292 |
}
|
| 293 |
-
|
| 294 |
-
// Add error handling
|
| 295 |
-
player.on('error', function() {
|
| 296 |
-
loadingOverlay.classList.add('hidden');
|
| 297 |
-
document.getElementById('error-message').innerHTML = '<i class="fas fa-exclamation-triangle"></i> Error loading media. Please try again later.';
|
| 298 |
-
});
|
| 299 |
</script>
|
| 300 |
</body>
|
| 301 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
+
<title>Modern Media Player</title>
|
| 5 |
|
| 6 |
<meta charset="UTF-8">
|
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
| 15 |
|
| 16 |
<style>
|
| 17 |
:root {
|
| 18 |
+
--primary-color: #4F46E5;
|
| 19 |
+
--hover-color: #6366F1;
|
| 20 |
+
--text-color: #F9FAFB;
|
| 21 |
+
--background-overlay: rgba(17, 24, 39, 0.8);
|
| 22 |
+
--background-hover: rgba(79, 70, 229, 0.9);
|
|
|
|
| 23 |
}
|
| 24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
html, body {
|
| 26 |
margin: 0;
|
| 27 |
height: 100%;
|
| 28 |
+
font-family: 'Poppins', sans-serif;
|
| 29 |
+
background-color: #0F172A;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
#stream-media {
|
| 34 |
height: 100%;
|
| 35 |
width: 100%;
|
| 36 |
+
border-radius: 8px;
|
| 37 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
| 38 |
}
|
| 39 |
|
| 40 |
#error-message {
|
| 41 |
+
color: #EF4444;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
font-size: 1.25rem;
|
| 43 |
text-align: center;
|
| 44 |
+
margin-top: 1.25rem;
|
| 45 |
+
font-weight: 500;
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
|
| 48 |
+
/* Custom player styling */
|
| 49 |
.plyr--full-ui input[type=range] {
|
| 50 |
color: var(--primary-color);
|
| 51 |
}
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
.plyr__control--overlaid {
|
| 54 |
+
background: var(--background-overlay);
|
| 55 |
+
color: var(--text-color);
|
| 56 |
+
transition: background 0.3s ease;
|
| 57 |
+
border-radius: 50%;
|
| 58 |
}
|
| 59 |
|
| 60 |
.plyr__control--overlaid:hover {
|
| 61 |
+
background: var(--background-hover);
|
| 62 |
+
transform: scale(1.1);
|
| 63 |
}
|
| 64 |
|
| 65 |
+
.plyr__menu__container {
|
| 66 |
+
background: var(--background-overlay);
|
| 67 |
+
border-radius: 8px;
|
| 68 |
}
|
| 69 |
|
| 70 |
+
.plyr__control {
|
| 71 |
+
color: var(--text-color);
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
+
.plyr__control:hover {
|
| 75 |
+
background: var(--hover-color);
|
|
|
|
| 76 |
}
|
| 77 |
|
| 78 |
+
.plyr__control.plyr__tab-focus {
|
| 79 |
+
box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.5);
|
| 80 |
}
|
| 81 |
|
| 82 |
+
/* Action buttons */
|
| 83 |
+
.player-action-button {
|
| 84 |
position: absolute;
|
| 85 |
+
width: 40px;
|
| 86 |
+
height: 40px;
|
| 87 |
+
background-color: var(--background-overlay);
|
| 88 |
border-radius: 50%;
|
| 89 |
+
display: flex;
|
| 90 |
+
align-items: center;
|
| 91 |
+
justify-content: center;
|
| 92 |
color: var(--text-color);
|
| 93 |
z-index: 10;
|
| 94 |
transition: all 0.3s ease;
|
| 95 |
+
opacity: 0;
|
|
|
|
|
|
|
| 96 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 97 |
}
|
| 98 |
|
| 99 |
+
.player-action-button:hover {
|
| 100 |
+
background-color: var(--background-hover);
|
| 101 |
+
transform: scale(1.1);
|
| 102 |
}
|
| 103 |
|
| 104 |
+
.plyr__video-wrapper:hover .player-action-button {
|
| 105 |
+
opacity: 1;
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
+
.plyr-download-button {
|
| 109 |
+
top: 20px;
|
| 110 |
+
right: 20px;
|
| 111 |
}
|
| 112 |
|
| 113 |
+
.plyr-share-button {
|
| 114 |
+
top: 20px;
|
| 115 |
+
right: 70px;
|
| 116 |
}
|
| 117 |
|
| 118 |
.plyr, .plyr__video-wrapper, .plyr__video-embed iframe {
|
| 119 |
height: 100%;
|
| 120 |
+
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
}
|
| 122 |
+
|
| 123 |
+
/* Fix for the empty center element */
|
| 124 |
+
.plyr__poster {
|
| 125 |
+
background-size: cover !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
| 127 |
+
|
| 128 |
+
.plyr--video .plyr__controls {
|
| 129 |
+
padding: 20px;
|
| 130 |
+
background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 100%);
|
| 131 |
+
border-radius: 0 0 8px 8px;
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
</style>
|
| 134 |
</head>
|
| 135 |
|
| 136 |
<body>
|
| 137 |
+
<video id="stream-media" controls preload="auto">
|
| 138 |
+
<source src="" type="">
|
| 139 |
+
<p class="vjs-no-js">
|
| 140 |
+
To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
|
| 141 |
+
</p>
|
| 142 |
+
</video>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
+
<div id="error-message"></div>
|
|
|
|
| 145 |
|
| 146 |
<script>
|
| 147 |
+
var player = new Plyr('#stream-media', {
|
| 148 |
+
controls:['play-large', 'rewind', 'play', 'fast-forward', 'progress', 'current-time', 'mute', 'volume', 'settings', 'pip', 'fullscreen'],
|
| 149 |
+
settings:['quality', 'speed', 'loop'],
|
| 150 |
+
speed:{selected:1, options:[0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]},
|
| 151 |
+
seekTime: 10,
|
| 152 |
+
keyboard: { focused: true, global: true },
|
| 153 |
+
hideControls: true,
|
| 154 |
+
resetOnEnd: true,
|
| 155 |
+
fullscreen: { enabled: true, fallback: true, iosNative: true },
|
| 156 |
+
tooltips: { controls: true, seek: true },
|
| 157 |
+
});
|
| 158 |
|
| 159 |
+
// Remove any unwanted elements that might be in the center
|
| 160 |
+
player.on('ready', function() {
|
| 161 |
+
const unwantedElements = document.querySelectorAll('.plyr__control--overlaid:not(:first-child)');
|
| 162 |
+
unwantedElements.forEach(el => el.remove());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
});
|
| 164 |
|
| 165 |
+
var mediaLink = "{{ mediaLink }}";
|
|
|
|
| 166 |
|
| 167 |
if (mediaLink) {
|
| 168 |
+
document.querySelector('#stream-media source').setAttribute('src', mediaLink);
|
| 169 |
+
player.restart();
|
| 170 |
+
|
| 171 |
+
var downloadButton = document.createElement('div');
|
| 172 |
+
downloadButton.className = 'player-action-button plyr-download-button';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
downloadButton.innerHTML = '<i class="fas fa-download"></i>';
|
| 174 |
+
|
| 175 |
downloadButton.onclick = function(event) {
|
| 176 |
event.stopPropagation();
|
| 177 |
+
var link = document.createElement('a');
|
| 178 |
link.href = mediaLink;
|
| 179 |
link.download = mediaLink.split('/').pop();
|
|
|
|
| 180 |
document.body.appendChild(link);
|
| 181 |
link.click();
|
| 182 |
document.body.removeChild(link);
|
| 183 |
};
|
| 184 |
+
|
| 185 |
+
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(downloadButton);
|
| 186 |
+
|
| 187 |
+
var shareButton = document.createElement('div');
|
| 188 |
+
shareButton.className = 'player-action-button plyr-share-button';
|
| 189 |
shareButton.innerHTML = '<i class="fas fa-share-alt"></i>';
|
| 190 |
+
|
| 191 |
shareButton.onclick = function(event) {
|
| 192 |
event.stopPropagation();
|
| 193 |
if (navigator.share) {
|
| 194 |
navigator.share({
|
| 195 |
+
title: "Modern Media Player",
|
| 196 |
+
url: mediaLink
|
|
|
|
|
|
|
| 197 |
});
|
| 198 |
} else {
|
| 199 |
// Fallback for browsers that don't support Web Share API
|
| 200 |
+
navigator.clipboard.writeText(mediaLink)
|
| 201 |
+
.then(() => alert('Link copied to clipboard!'))
|
| 202 |
+
.catch(err => console.error('Could not copy link: ', err));
|
| 203 |
}
|
| 204 |
};
|
| 205 |
+
|
|
|
|
|
|
|
| 206 |
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(shareButton);
|
| 207 |
+
|
|
|
|
|
|
|
|
|
|
| 208 |
} else {
|
| 209 |
+
document.getElementById('error-message').textContent = 'Error: Media URL not provided';
|
|
|
|
|
|
|
| 210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
</script>
|
| 212 |
</body>
|
| 213 |
</html>
|