Spaces:
Running
Running
File size: 35,991 Bytes
5711d28 |
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MegaFlix Ultra - Streaming Automatisé</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Player JS -->
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/dashjs/dist/dash.all.min.js"></script>
<style>
.film-card:hover .play-icon {
opacity: 1;
transform: scale(1.2);
transition: all 0.3s ease;
}
.player-container {
aspect-ratio: 16/9;
background: #000;
}
.server-status.online {
background-color: #10B981;
box-shadow: 0 0 10px #10B981;
}
.server-status.offline {
background-color: #EF4444;
}
.server-status.loading {
background-color: #F59E0B;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
.auto-import-progress {
height: 4px;
background: linear-gradient(90deg, #EC4899, #8B5CF6);
animation: progress 2s ease infinite;
background-size: 200% 100%;
}
@keyframes progress {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
#videoElement {
width: 100%;
height: 100%;
}
</style>
</head>
<body class="bg-gray-900 text-white font-sans">
<!-- Barre de navigation avancée -->
<nav class="bg-black py-3 px-6 shadow-xl sticky top-0 z-50">
<div class="container mx-auto flex flex-col md:flex-row justify-between items-center">
<div class="flex items-center space-x-8 w-full md:w-auto">
<div class="flex items-center">
<i class="fas fa-film text-red-500 text-2xl mr-2"></i>
<h1 class="text-2xl font-extrabold bg-gradient-to-r from-red-500 to-purple-600 bg-clip-text text-transparent">MegaFlix Ultra</h1>
</div>
<div class="hidden lg:flex space-x-6">
<a href="#" class="hover:text-red-400 flex items-center">
<i class="fas fa-home mr-2"></i> Accueil
</a>
<a href="#" class="hover:text-red-400 flex items-center">
<i class="fas fa-bolt mr-2"></i> Tendances
</a>
<a href="#" class="hover:text-red-400 flex items-center">
<i class="fas fa-cloud-upload-alt mr-2"></i> Import Auto
</a>
<a href="#" class="hover:text-red-400 flex items-center">
<i class="fas fa-server mr-2"></i> Serveurs
</a>
</div>
</div>
<div class="flex items-center space-x-4 mt-4 md:mt-0 w-full md:w-auto justify-between">
<div class="relative flex-grow max-w-xl mr-4">
<input type="text" placeholder="Rechercher 975K+ films..."
class="bg-gray-800 rounded-full py-2 px-4 pl-10 focus:outline-none focus:ring-2 focus:ring-red-500 w-full">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<div class="flex space-x-3">
<button class="bg-gradient-to-r from-red-600 to-purple-600 hover:from-red-700 hover:to-purple-700 py-2 px-4 rounded-full font-medium flex items-center">
<i class="fas fa-user-circle mr-2"></i> Connexion
</button>
<button id="darkModeToggle" class="bg-gray-800 hover:bg-gray-700 p-2 rounded-full">
<i class="fas fa-moon"></i>
</button>
</div>
</div>
</div>
</nav>
<!-- Dashboard d'administration -->
<div class="container mx-auto px-4 py-6">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 mb-8">
<!-- Stat Serveurs -->
<div class="bg-gray-800 rounded-xl p-5 shadow-lg border-l-4 border-red-500">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400">Serveurs actifs</p>
<h3 class="text-2xl font-bold">14/16</h3>
</div>
<i class="fas fa-server text-red-400 text-2xl"></i>
</div>
<div class="mt-4">
<div class="flex items-center text-sm">
<span class="server-status online w-3 h-3 rounded-full mr-2"></span>
<span>Cluster EU-1: 5/5</span>
</div>
<div class="flex items-center text-sm mt-1">
<span class="server-status online w-3 h-3 rounded-full mr-2"></span>
<span>Cluster US-1: 4/5</span>
</div>
<div class="flex items-center text-sm mt-1">
<span class="server-status loading w-3 h-3 rounded-full mr-2"></span>
<span>Cluster ASIA-1: 3/4</span>
</div>
<div class="flex items-center text-sm mt-1">
<span class="server-status offline w-3 h-3 rounded-full mr-2"></span>
<span>Backup-1: 2/2</span>
</div>
</div>
</div>
<!-- Stat Films -->
<div class="bg-gray-800 rounded-xl p-5 shadow-lg border-l-4 border-purple-500">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400">Films disponibles</p>
<h3 class="text-2xl font-bold" id="totalMovies">975,623</h3>
</div>
<i class="fas fa-film text-purple-400 text-2xl"></i>
</div>
<div class="mt-4">
<div class="text-sm flex justify-between">
<span>FR: 423,156</span>
<span>VO: 552,467</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2 mt-2">
<div class="bg-gradient-to-r from-purple-500 to-pink-500 h-2 rounded-full" style="width: 43%"></div>
</div>
</div>
</div>
<!-- Import Auto -->
<div class="bg-gray-800 rounded-xl p-5 shadow-lg border-l-4 border-blue-500">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400">Import automatique</p>
<h3 class="text-2xl font-bold">Actif</h3>
</div>
<i class="fas fa-robot text-blue-400 text-2xl"></i>
</div>
<div class="mt-4">
<p class="text-sm">Dernier import: <span class="font-medium" id="lastImport">2 min ago</span></p>
<p class="text-sm mt-1">Prochain scan: <span class="font-medium" id="nextScan">dans 58 min</span></p>
<div class="auto-import-progress rounded-full mt-2"></div>
</div>
</div>
<!-- Lecteur -->
<div class="bg-gray-800 rounded-xl p-5 shadow-lg border-l-4 border-green-500">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400">Lecteur Ultra HD</p>
<h3 class="text-2xl font-bold">4K HDR</h3>
</div>
<i class="fas fa-play-circle text-green-400 text-2xl"></i>
</div>
<div class="mt-4">
<p class="text-sm">Formats supportés:</p>
<div class="flex flex-wrap gap-1 mt-1">
<span class="bg-gray-700 px-2 py-1 rounded text-xs">HLS</span>
<span class="bg-gray-700 px-2 py-1 rounded text-xs">DASH</span>
<span class="bg-gray-700 px-2 py-1 rounded text-xs">MP4</span>
<span class="bg-gray-700 px-2 py-1 rounded text-xs">MKV</span>
<span class="bg-gray-700 px-2 py-1 rounded text-xs">AV1</span>
<span class="bg-gray-700 px-2 py-1 rounded text-xs">HEVC</span>
</div>
</div>
</div>
</div>
<!-- Lecteur vidéo avancé -->
<section class="mb-12 bg-black rounded-xl overflow-hidden shadow-2xl">
<div class="player-container" id="ultraPlayer">
<video id="videoElement" controls autoplay muted></video>
</div>
<!-- Contrôles du lecteur -->
<div class="bg-gray-800 p-4 flex flex-wrap items-center justify-between">
<div class="flex items-center space-x-4">
<button id="playBtn" class="bg-red-600 hover:bg-red-700 p-3 rounded-full">
<i class="fas fa-pause"></i>
</button>
<div class="flex items-center space-x-2">
<button class="text-gray-400 hover:text-white">
<i class="fas fa-step-backward"></i>
</button>
<button class="text-gray-400 hover:text-white">
<i class="fas fa-step-forward"></i>
</button>
</div>
<span id="currentTime" class="text-sm">00:00:00</span>
<span class="text-gray-400">/</span>
<span id="duration" class="text-sm">00:00:00</span>
</div>
<div class="flex items-center space-x-4 mt-2 sm:mt-0">
<div class="hidden sm:flex items-center space-x-2">
<button class="text-gray-400 hover:text-white">
<i class="fas fa-closed-captioning"></i>
</button>
<button class="text-gray-400 hover:text-white">
<i class="fas fa-cog"></i>
</button>
</div>
<div class="flex items-center space-x-2">
<button id="qualityBtn" class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm">
Auto (4K)
</button>
<div class="relative">
<button id="serverBtn" class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm flex items-center">
<i class="fas fa-server mr-1"></i> EU-1
</button>
<div id="serverDropdown" class="hidden absolute right-0 mt-1 w-48 bg-gray-800 rounded shadow-lg z-10">
<div class="p-2 border-b border-gray-700">
<p class="text-xs text-gray-400">Serveurs disponibles</p>
</div>
<div class="max-h-60 overflow-y-auto">
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-700 flex items-center">
<span class="server-status online w-2 h-2 rounded-full mr-2"></span>
EU-1 (Ping: 12ms)
</a>
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-700 flex items-center">
<span class="server-status online w-2 h-2 rounded-full mr-2"></span>
EU-2 (Ping: 18ms)
</a>
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-700 flex items-center">
<span class="server-status online w-2 h-2 rounded-full mr-2"></span>
US-1 (Ping: 42ms)
</a>
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-700 flex items-center">
<span class="server-status loading w-2 h-2 rounded-full mr-2"></span>
ASIA-1 (Ping: 128ms)
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Catalogue de films -->
<section class="mb-12">
<div class="flex justify-between items-center mb-6">
<h3 class="text-2xl font-bold flex items-center">
<i class="fas fa-bolt text-red-500 mr-3"></i>
<span>Nouveautés ajoutées automatiquement</span>
</h3>
<div class="flex items-center text-sm bg-gray-800 px-3 py-1 rounded-full">
<i class="fas fa-sync-alt text-gray-400 mr-2 animate-spin"></i>
<span>Mise à jour en temps réel</span>
</div>
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-6" id="moviesGrid">
<!-- Les films seront chargés ici par JavaScript -->
</div>
</section>
<!-- Système d'import automatique -->
<section class="mb-12 bg-gray-800 rounded-xl p-6 shadow-lg">
<div class="flex justify-between items-center mb-6">
<h3 class="text-2xl font-bold flex items-center">
<i class="fas fa-robot text-blue-500 mr-3"></i>
<span>Système d'import automatique</span>
</h3>
<button id="toggleAutoImport" class="bg-gradient-to-r from-green-600 to-blue-600 hover:from-green-700 hover:to-blue-700 py-2 px-4 rounded-full font-medium flex items-center">
<i class="fas fa-power-off mr-2"></i> Actif
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-gray-700 rounded-lg p-4">
<div class="flex justify-between items-center mb-3">
<h4 class="font-semibold">Sources configurées</h4>
<span class="bg-blue-600 text-white px-2 py-0.5 rounded text-xs">12/12</span>
</div>
<div class="space-y-2">
<div class="flex items-center justify-between text-sm">
<span>Torrents FR</span>
<span class="text-green-400"><i class="fas fa-check-circle"></i></span>
</div>
<div class="flex items-center justify-between text-sm">
<span>Usenet</span>
<span class="text-green-400"><i class="fas fa-check-circle"></i></span>
</div>
<div class="flex items-center justify-between text-sm">
<span>DDL</span>
<span class="text-green-400"><i class="fas fa-check-circle"></i></span>
</div>
<div class="flex items-center justify-between text-sm">
<span>FTP Premium</span>
<span class="text-green-400"><i class="fas fa-check-circle"></i></span>
</div>
</div>
</div>
<div class="bg-gray-700 rounded-lg p-4">
<div class="flex justify-between items-center mb-3">
<h4 class="font-semibold">Derniers imports</h4>
<span class="bg-purple-600 text-white px-2 py-0.5 rounded text-xs">42 aujourd'hui</span>
</div>
<div class="space-y-2">
<div class="flex items-center justify-between text-sm">
<span class="truncate">Interstellar.2014.4K.HDR.FR.mkv</span>
<span class="text-gray-400 whitespace-nowrap">12 min</span>
</div>
<div class="flex items-center justify-between text-sm">
<span class="truncate">Inception.2010.REMUX.1080p.FR.mkv</span>
<span class="text-gray-400 whitespace-nowrap">27 min</span>
</div>
<div class="flex items-center justify-between text-sm">
<span class="truncate">The.Dark.Knight.2008.4K.HDR.FR.mkv</span>
<span class="text-gray-400 whitespace-nowrap">1h 03</span>
</div>
<div class="flex items-center justify-between text-sm">
<span class="truncate">Pulp.Fiction.1994.CC.1080p.FR.mkv</span>
<span class="text-gray-400 whitespace-nowrap">1h 22</span>
</div>
</div>
</div>
<div class="bg-gray-700 rounded-lg p-4">
<div class="flex justify-between items-center mb-3">
<h4 class="font-semibold">Statistiques</h4>
<span class="bg-green-600 text-white px-2 py-0.5 rounded text-xs">+12%</span>
</div>
<div class="space-y-3">
<div>
<div class="flex justify-between text-xs mb-1">
<span>Espace disque</span>
<span>1.2PB / 2PB</span>
</div>
<div class="w-full bg-gray-600 rounded-full h-2">
<div class="bg-gradient-to-r from-green-500 to-blue-500 h-2 rounded-full" style="width: 60%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-xs mb-1">
<span>Bande passante</span>
<span>42Gbps / 50Gbps</span>
</div>
<div class="w-full bg-gray-600 rounded-full h-2">
<div class="bg-gradient-to-r from-yellow-500 to-red-500 h-2 rounded-full" style="width: 84%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-xs mb-1">
<span>Nouveaux films/jour</span>
<span>Moy: 38</span>
</div>
<div class="w-full bg-gray-600 rounded-full h-2">
<div class="bg-gradient-to-r from-purple-500 to-pink-500 h-2 rounded-full" style="width: 76%"></div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Pied de page -->
<footer class="bg-black py-12 px-6 border-t border-gray-800">
<div class="container mx-auto grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<div class="flex items-center mb-4">
<i class="fas fa-film text-red-500 text-2xl mr-2"></i>
<h4 class="text-xl font-extrabold bg-gradient-to-r from-red-500 to-purple-600 bg-clip-text text-transparent">MegaFlix Ultra</h4>
</div>
<p class="text-gray-400 text-sm">La plateforme de streaming français la plus avancée avec système d'import automatique et lecteur 8K HDR.</p>
<div class="flex space-x-4 mt-4 text-xl">
<a href="#" class="text-gray-400 hover:text-red-500"><i class="fab fa-discord"></i></a>
<a href="#" class="text-gray-400 hover:text-blue-400"><i class="fab fa-telegram"></i></a>
<a href="#" class="text-gray-400 hover:text-red-500"><i class="fab fa-youtube"></i></a>
</div>
</div>
<div>
<h5 class="font-semibold mb-4 text-lg">Navigation</h5>
<ul class="space-y-3 text-gray-400">
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-red-500"></i> Accueil</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-red-500"></i> Films</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-red-500"></i> Séries</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-red-500"></i> Nouveautés</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-red-500"></i> Serveurs</a></li>
</ul>
</div>
<div>
<h5 class="font-semibold mb-4 text-lg">Ressources</h5>
<ul class="space-y-3 text-gray-400">
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-blue-500"></i> API Developer</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-blue-500"></i> Documentation</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-blue-500"></i> Status Serveurs</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-blue-500"></i> Changelog</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-blue-500"></i> Blog Tech</a></li>
</ul>
</div>
<div>
<h5 class="font-semibold mb-4 text-lg">Support</h5>
<ul class="space-y-3 text-gray-400">
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-green-500"></i> Centre d'aide</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-green-500"></i> FAQ</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-green-500"></i> Contact</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-green-500"></i> Discord</a></li>
<li><a href="#" class="hover:text-white flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-green-500"></i> Twitter</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-800 mt-12 pt-8">
<div class="container mx-auto flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-500 text-sm">© 2023 MegaFlix Ultra. Tous droits réservés.</p>
<div class="flex space-x-6 mt-4 md:mt-0">
<a href="#" class="text-gray-500 hover:text-white text-sm">CGU</a>
<a href="#" class="text-gray-500 hover:text-white text-sm">Confidentialité</a>
<a href="#" class="text-gray-500 hover:text-white text-sm">Cookies</a>
<a href="#" class="text-gray-500 hover:text-white text-sm">DMCA</a>
</div>
</div>
</div>
</footer>
<script>
// Configuration de l'API TMDB
const TMDB_API_KEY = 'fb437b10727a5a4eb8d9134e29c82ae0';
const TMDB_BASE_URL = 'https://api.themoviedb.org/3';
const TMDB_IMAGE_BASE = 'https://image.tmdb.org/t/p/w500';
// Variables globales
let currentMovies = [];
let currentVideoIndex = 0;
let videoPlayer;
let autoPlayInterval;
document.addEventListener('DOMContentLoaded', function() {
// Initialisation
initPlayer();
loadTrendingMovies();
// Mode sombre/clair
const darkModeToggle = document.getElementById('darkModeToggle');
darkModeToggle.addEventListener('click', function() {
document.documentElement.classList.toggle('dark');
const icon = darkModeToggle.querySelector('i');
if (document.documentElement.classList.contains('dark')) {
icon.classList.replace('fa-sun', 'fa-moon');
} else {
icon.classList.replace('fa-moon', 'fa-sun');
}
});
// Gestion des serveurs
const serverBtn = document.getElementById('serverBtn');
const serverDropdown = document.getElementById('serverDropdown');
serverBtn.addEventListener('click', function(e) {
e.stopPropagation();
serverDropdown.classList.toggle('hidden');
});
document.addEventListener('click', function() {
serverDropdown.classList.add('hidden');
});
// Contrôles du lecteur
const playBtn = document.getElementById('playBtn');
playBtn.addEventListener('click', togglePlayPause);
// Système d'import automatique
const toggleAutoImport = document.getElementById('toggleAutoImport');
let autoImportActive = true;
toggleAutoImport.addEventListener('click', function() {
autoImportActive = !autoImportActive;
if (autoImportActive) {
toggleAutoImport.innerHTML = '<i class="fas fa-power-off mr-2"></i> Actif';
toggleAutoImport.classList.remove('bg-gradient-to-r', 'from-red-600', 'to-yellow-600');
toggleAutoImport.classList.add('bg-gradient-to-r', 'from-green-600', 'to-blue-600');
console.log("Système d'import automatique activé");
} else {
toggleAutoImport.innerHTML = '<i class="fas fa-power-off mr-2"></i> Inactif';
toggleAutoImport.classList.remove('bg-gradient-to-r', 'from-green-600', 'to-blue-600');
toggleAutoImport.classList.add('bg-gradient-to-r', 'from-red-600', 'to-yellow-600');
console.log("Système d'import automatique désactivé");
}
});
});
// Initialiser le lecteur vidéo
function initPlayer() {
videoPlayer = document.getElementById('videoElement');
// Mettre à jour le temps actuel
videoPlayer.addEventListener('timeupdate', function() {
document.getElementById('currentTime').textContent = formatTime(videoPlayer.currentTime);
});
// Mettre à jour la durée totale
videoPlayer.addEventListener('loadedmetadata', function() {
document.getElementById('duration').textContent = formatTime(videoPlayer.duration);
});
// Passer au film suivant quand la vidéo se termine
videoPlayer.addEventListener('ended', playNextMovie);
// Démarrer l'autoplay
startAutoPlay();
}
// Charger les films tendances depuis TMDB
async function loadTrendingMovies() {
try {
const response = await fetch(`${TMDB_BASE_URL}/trending/movie/day?api_key=${TMDB_API_KEY}&language=fr-FR`);
const data = await response.json();
currentMovies = data.results.slice(0, 12); // Prendre les 12 premiers films
document.getElementById('totalMovies').textContent = data.total_results.toLocaleString();
// Afficher les films
displayMovies(currentMovies);
// Charger le premier film
if (currentMovies.length > 0) {
loadMovieVideo(currentMovies[0].id);
}
} catch (error) {
console.error('Erreur lors du chargement des films:', error);
}
}
// Afficher les films dans la grille
function displayMovies(movies) {
const moviesGrid = document.getElementById('moviesGrid');
moviesGrid.innerHTML = '';
movies.forEach((movie, index) => {
const movieCard = document.createElement('div');
movieCard.className = 'film-card relative group rounded-xl overflow-hidden shadow-lg transition-transform duration-300 hover:scale-105';
movieCard.innerHTML = `
<div class="relative cursor-pointer" onclick="playMovie(${index})">
<img src="${movie.poster_path ? TMDB_IMAGE_BASE + movie.poster_path : 'https://via.placeholder.com/300x450'}"
alt="${movie.title}" class="w-full h-64 object-cover">
<div class="absolute inset-0 bg-gradient-to-t from-black via-transparent to-transparent opacity-70"></div>
<div class="absolute bottom-0 left-0 p-3">
<span class="bg-red-600 text-white px-2 py-0.5 rounded text-xs">Nouveau</span>
</div>
<div class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition">
<div class="play-icon bg-red-600 rounded-full p-4 opacity-0 transform transition group-hover:opacity-100">
<i class="fas fa-play text-white text-xl"></i>
</div>
</div>
</div>
<div class="p-3 bg-gray-800">
<h4 class="font-semibold truncate">${movie.title}</h4>
<div class="flex justify-between items-center mt-2 text-sm text-gray-400">
<span>${movie.release_date ? movie.release_date.substring(0, 4) : 'N/A'}</span>
<div class="flex space-x-1">
<span class="bg-red-600 text-white px-1.5 py-0.5 rounded text-xs">HD</span>
<span class="bg-blue-600 text-white px-1.5 py-0.5 rounded text-xs">FR</span>
</div>
</div>
</div>
`;
moviesGrid.appendChild(movieCard);
});
}
// Charger la vidéo d'un film
async function loadMovieVideo(movieId) {
try {
// En réalité, vous utiliseriez votre propre système de streaming ici
// Pour la démo, nous utilisons une vidéo de test
const videoUrl = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8';
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(videoUrl);
hls.attachMedia(videoPlayer);
hls.on(Hls.Events.MANIFEST_PARSED, function() {
videoPlayer.play();
});
} else if (videoPlayer.canPlayType('application/vnd.apple.mpegurl')) {
videoPlayer.src = videoUrl;
videoPlayer.addEventListener('loadedmetadata', function() {
videoPlayer.play();
});
}
// Mettre à jour l'interface
document.getElementById('playBtn').innerHTML = '<i class="fas fa-pause"></i>';
} catch (error) {
console.error('Erreur lors du chargement de la vidéo:', error);
}
}
// Jouer un film spécifique
function playMovie(index) {
currentVideoIndex = index;
const movie = currentMovies[index];
loadMovieVideo(movie.id);
}
// Jouer le film suivant
function playNextMovie() {
currentVideoIndex = (currentVideoIndex + 1) % currentMovies.length;
const nextMovie = currentMovies[currentVideoIndex];
loadMovieVideo(nextMovie.id);
}
// Basculer entre lecture et pause
function togglePlayPause() {
if (videoPlayer.paused) {
videoPlayer.play();
document.getElementById('playBtn').innerHTML = '<i class="fas fa-pause"></i>';
} else {
videoPlayer.pause();
document.getElementById('playBtn').innerHTML = '<i class="fas fa-play"></i>';
}
}
// Démarrer l'autoplay
function startAutoPlay() {
// Vérifier toutes les 30 secondes si la vidéo est bloquée
autoPlayInterval = setInterval(() => {
if (videoPlayer.readyState > 0 && videoPlayer.paused && !videoPlayer.ended) {
videoPlayer.play().catch(e => console.log('Auto-play was prevented:', e));
}
}, 30000);
}
// Formater le temps (HH:MM:SS)
function formatTime(seconds) {
const h = Math.floor(seconds / 3600);
const m = Math.floor((seconds % 3600) / 60);
const s = Math.floor(seconds % 60);
return [h, m, s].map(v => v < 10 ? '0' + v : v).join(':');
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=docto41/megaflix-ultra" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |