Update Saqel Platform: 2026-08-29 22:05:41
This commit is contained in:
@@ -789,6 +789,13 @@ class StudentPortal
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- NEW: Video Version Selector -->
|
||||
<div id="video_version_selector_container" style="display: none; margin-bottom: 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; padding: 12px;">
|
||||
<label style="font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; display: block;">اختر مصدر الشرح (المعلم):</label>
|
||||
<select id="video_version_select" onchange="switchVideoVersion(this.value)" style="width: 100%; background: var(--bg-card); color: #FFF; border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; outline: none; font-family: inherit; font-size: 13px;">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="video-container">
|
||||
<video id="lesson_video_player" class="video-element" controls poster="/assets/images/saqel_logo.jpg" preload="metadata">
|
||||
<?php if ($activeLesson && !empty($activeLesson['video_uuid'])): ?>
|
||||
@@ -1250,6 +1257,19 @@ class StudentPortal
|
||||
badge.textContent = `الفحص السقراطي الذكي نشط (${checkpoints.length} نقاط فحص) 🧠`;
|
||||
}
|
||||
|
||||
// Populate Video Versions
|
||||
const versions = data.data.available_versions || [];
|
||||
const selContainer = document.getElementById('video_version_selector_container');
|
||||
const selElement = document.getElementById('video_version_select');
|
||||
window.currentAvailableVersions = versions;
|
||||
|
||||
if (versions.length > 1) {
|
||||
selContainer.style.display = 'block';
|
||||
selElement.innerHTML = versions.map((v, idx) => `<option value="${idx}">${v.label}</option>`).join('');
|
||||
} else {
|
||||
selContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
// Update AI Video Button
|
||||
const aiAssetsContainer = document.getElementById('ai_assets_container');
|
||||
if (aiAssetsContainer && les) {
|
||||
@@ -1311,6 +1331,32 @@ class StudentPortal
|
||||
}
|
||||
}
|
||||
|
||||
function switchVideoVersion(idx) {
|
||||
const version = window.currentAvailableVersions[idx];
|
||||
if (!version || !version.playback) return;
|
||||
const pb = version.playback;
|
||||
|
||||
const video = document.getElementById('lesson_video_player');
|
||||
if (video && pb) {
|
||||
video.pause();
|
||||
video.removeAttribute('src');
|
||||
video.load();
|
||||
if (pb.hls_url && window.Hls && Hls.isSupported()) {
|
||||
if (hlsInstance) hlsInstance.destroy();
|
||||
hlsInstance = new Hls({ enableWorker: true });
|
||||
hlsInstance.loadSource(pb.hls_url);
|
||||
hlsInstance.attachMedia(video);
|
||||
video.play().catch(e => console.log(e));
|
||||
} else if (pb.stream_url) {
|
||||
video.src = pb.stream_url;
|
||||
video.play().catch(e => console.log(e));
|
||||
} else if (pb.video_url) {
|
||||
video.src = pb.video_url;
|
||||
video.play().catch(e => console.log(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(secs) {
|
||||
const m = Math.floor(secs / 60).toString().padStart(2, '0');
|
||||
const s = (secs % 60).toString().padStart(2, '0');
|
||||
|
||||
Reference in New Issue
Block a user