diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index d85a98a..fc2f129 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -465,6 +465,33 @@ class VideoController extends Controller ->withCookie(cookie('_did', $did, 60 * 24 * 365 * 5)); } + public function playerData(Video $video, Request $request) + { + if (! $video->canView(Auth::user())) { + abort(403); + } + + $coverUrl = $video->thumbnail + ? route('media.thumbnail', $video->thumbnail) + : asset('storage/images/logo.png'); + + $slides = $video->slides->count() > 1 + ? $video->slides->map(fn ($s) => route('media.thumbnail', $s->filename))->values()->all() + : []; + + return response()->json([ + 'id' => $video->id, + 'key' => $video->getRouteKey(), + 'type' => $video->type, + 'stream_url' => route('videos.stream', $video), + 'cover_url' => $coverUrl, + 'slides' => $slides, + 'title' => $video->title, + 'author' => $video->user->name ?? '', + 'duration' => $video->duration, + ]); + } + public function matchData(Video $video) { if (! $video->canView(Auth::user())) { diff --git a/resources/views/videos/types/music.blade.php b/resources/views/videos/types/music.blade.php index 8527aa3..2144ca1 100644 --- a/resources/views/videos/types/music.blade.php +++ b/resources/views/videos/types/music.blade.php @@ -299,6 +299,14 @@ gap: 8px; margin-bottom: 8px; cursor: pointer; + border-radius: 8px; + padding: 4px; + transition: background .15s; + } + + .sidebar-video-card.current-video { + background: rgba(239,68,68,.12); + border-left: 3px solid #ef4444; } .sidebar-thumb { @@ -479,12 +487,10 @@ {{-- Playlist controls --}}