Update Saqel Platform: 2026-09-05 00:11:09
This commit is contained in:
@@ -545,23 +545,47 @@ class VideoController
|
||||
$storageType = $lesson['storage_type'] ?? 'bunny_stream';
|
||||
$playbackInfo = [];
|
||||
|
||||
if ($storageType === 'api_upload') {
|
||||
if ($storageType === 'api_upload' && !empty($lesson['video_uuid'])) {
|
||||
$playbackInfo = [
|
||||
'storage_type' => 'api_upload',
|
||||
'stream_url' => '/api/videos/stream/' . $lesson['video_uuid'],
|
||||
'hls_url' => $lesson['hls_url'] ?: ('/api/videos/hls/' . $lesson['video_uuid'] . '/index.m3u8'),
|
||||
'video_url' => $lesson['hls_url'] ?: ('/api/videos/stream/' . $lesson['video_uuid']),
|
||||
'video_uuid' => $lesson['video_uuid'],
|
||||
'is_direct' => true
|
||||
'is_direct' => true,
|
||||
'is_ready' => true,
|
||||
];
|
||||
} elseif (!empty($lesson['bunny_video_id'])) {
|
||||
// Bunny Stream Signed Playback
|
||||
$bunnyId = $lesson['bunny_video_id'];
|
||||
$signedData = VideoService::generateBunnySignedPlayback($bunnyId, 10800); // 3-hour token
|
||||
$playbackInfo = array_merge(['storage_type' => 'bunny_stream', 'is_ready' => true], $signedData);
|
||||
} elseif (!empty($lesson['ai_video_url'])) {
|
||||
$playbackInfo = [
|
||||
'storage_type' => 'direct_url',
|
||||
'video_url' => $lesson['ai_video_url'],
|
||||
'hls_url' => $lesson['ai_video_url'],
|
||||
'stream_url' => $lesson['ai_video_url'],
|
||||
'is_ready' => true,
|
||||
];
|
||||
} elseif (!empty($lesson['hls_url'])) {
|
||||
$playbackInfo = [
|
||||
'storage_type' => 'hls_stream',
|
||||
'video_url' => $lesson['hls_url'],
|
||||
'hls_url' => $lesson['hls_url'],
|
||||
'stream_url' => $lesson['hls_url'],
|
||||
'is_ready' => true,
|
||||
];
|
||||
} else {
|
||||
// Bunny Stream Signed Playback
|
||||
$bunnyId = $lesson['bunny_video_id'] ?: '';
|
||||
if ($bunnyId === '') {
|
||||
$response->status(409)->json(['status' => 'error', 'message' => 'الفيديو لم يجهز للبث بعد']);
|
||||
return;
|
||||
}
|
||||
$signedData = VideoService::generateBunnySignedPlayback($bunnyId, 10800); // 3-hour token
|
||||
$playbackInfo = array_merge(['storage_type' => 'bunny_stream'], $signedData);
|
||||
// Socratic Interactive Chalkboard Mode (Video synchronizing or pending upload)
|
||||
$playbackInfo = [
|
||||
'storage_type' => 'interactive_chalkboard',
|
||||
'video_url' => '',
|
||||
'hls_url' => '',
|
||||
'stream_url' => '',
|
||||
'is_ready' => false,
|
||||
'notice' => 'فيديو الشرح قيد المزامنة والتجهيز؛ تم تفعيل لوحة الشرح التفاعلية الذكية وبنك الأسئلة السقراطي',
|
||||
];
|
||||
}
|
||||
|
||||
$chapters = !empty($lesson['timeline_chapters_json']) ? json_decode($lesson['timeline_chapters_json'], true) : [];
|
||||
|
||||
Reference in New Issue
Block a user