Add YouTube video slide type
CI / Deploy / test (push) Successful in 46s
CI / Deploy / deploy (push) Skipped

Admins paste a YouTube link (watch, youtu.be, shorts, live, embed).
The link is checked via oEmbed on save and with a "check link" button
(not found / not embeddable is rejected, unreachable saves with a
warning). Start time can be entered or is taken from the link's
timecode; autoplay is optional. The presenter embeds the video via
youtube-nocookie.com; participants get the link plus a share button
(Web Share API, falls back to copying).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 15:08:12 +01:00
1 parent 93aeae1884
commit 1c509e31c2
14 files changed
+972 -24

No files matched your search

+14
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Model\Table;
use App\Model\Entity\Slide;
use App\Service\YouTubeService;
use ArrayObject;
use Cake\Datasource\EntityInterface;
use Cake\Event\EventInterface;
@@ -158,6 +159,19 @@ class SlidesTable extends Table
$settings['time_limit'] = $limit;
}
break;
case Slide::TYPE_YOUTUBE:
$url = mb_substr(trim((string)($input['url'] ?? '')), 0, 500);
$parsed = YouTubeService::parseUrl($url);
$settings['url'] = $url;
$settings['video_id'] = $parsed['videoId'] ?? '';
// Form input "1:30" / "2" (minutes); an int is already seconds. Empty = timecode of the link.
$start = $input['start'] ?? '';
if (!is_int($start)) {
$start = trim((string)$start) === '' ? null : YouTubeService::parseStartInput((string)$start);
}
$settings['start'] = max(0, min($start ?? $parsed['start'] ?? 0, YouTubeService::MAX_START));
$settings['autoplay'] = filter_var($input['autoplay'] ?? false, FILTER_VALIDATE_BOOLEAN);
break;
}
return $settings;