D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
skyconb
/
newsyacine
/
Filename :
embed.php
back
Copy
<?php // =============================================== // embed.php (مشغل الفيديو المُضَمَّن) // =============================================== // 1. الاتصال بقاعدة البيانات (يفترض أن هذا هو السطر 9 أو قريب منه) include 'db_connect.php'; // 2. جلب معرف الفيديو (ID) $video_id = $_GET['id'] ?? null; $video = null; if ($video_id) { // 3. استعلام آمن لجلب بيانات الفيديو (بما في ذلك رابط M3U8) $stmt = $conn->prepare("SELECT m3u8_link, title FROM videos WHERE id = ?"); $stmt->bind_param("i", $video_id); $stmt->execute(); $result = $stmt->get_result(); $video = $result->fetch_assoc(); $stmt->close(); } $conn->close(); // 4. عرض مشغل الفيديو if (!empty($video['iframe_link'])) { // اعرض كود iframe المخزن echo $video['iframe_link']; } elseif (!empty($video['m3u8_link'])) { // اعرض مشغل HLS الافتراضي // ... كود HLS.js هنا ... } else { // خطأ } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Video Player</title> <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> <style> body { margin: 0; background-color: #000; } #videoPlayer { width: 100%; height: 100vh; display: block; } </style> </head> <body> <video id="videoPlayer" controls autoplay></video> <script> var video = document.getElementById('videoPlayer'); var videoSrc = '<?php echo $m3u8_link; ?>'; if (Hls.isSupported()) { var hls = new Hls(); hls.loadSource(videoSrc); hls.attachMedia(video); hls.on(Hls.Events.MANIFEST_PARSED, function() { video.play(); }); } // else if (video.canPlayType('application/vnd.apple.mpegurl')) { // // تشغيل أصلي على متصفحات Safari // video.src = videoSrc; // video.addEventListener('loadedmetadata', function() { // video.play(); // }); // } else { // رسالة خطأ alert('Your browser does not support HLS playback.'); } </script> </body> </html> <?php else: ?> <!DOCTYPE html> <html> <head><title>Video Not Found</title></head> <body style="background-color: #000; color: #fff; text-align: center; padding-top: 50px;"> <h1>Error</h1> <p>Video not found or link is missing.</p> </body> </html> <?php endif; ?>