From 99f71c54e5495e9bbf9a50eb89ba0a7887b68abd Mon Sep 17 00:00:00 2001 From: ghassan Date: Sat, 16 May 2026 11:45:33 +0300 Subject: [PATCH] Fix playlist controls: add to type-specific views (music, generic, match) Controls were only added to show.blade.php, but music/generic/match videos render their own complete layouts with their own sidebars. Added the pl-controls-bar to all three type views and the global CSS to app.blade.php. - music: full standalone JS with shuffle/loop/autoplay + _plOnTrackEnd hook - generic/match: syncs with video-player's existing ytpShuffleRow/ytpAutoplayRow toggles - audio-player: ended handler now calls window._plOnTrackEnd if defined - video-player: exposes window._ytpNav.next/prev for sidebar prev/next buttons Co-Authored-By: Claude Sonnet 4.6 --- .../views/components/video-player.blade.php | 1 + resources/views/layouts/app.blade.php | 33 +++++++ .../videos/partials/audio-player.blade.php | 2 +- .../views/videos/types/generic.blade.php | 46 ++++++++- resources/views/videos/types/match.blade.php | 42 +++++++- resources/views/videos/types/music.blade.php | 97 ++++++++++++++++++- 6 files changed, 217 insertions(+), 4 deletions(-) diff --git a/resources/views/components/video-player.blade.php b/resources/views/components/video-player.blade.php index 4c5cd9f..db4c46b 100644 --- a/resources/views/components/video-player.blade.php +++ b/resources/views/components/video-player.blade.php @@ -1175,6 +1175,7 @@ function navigatePrev() { const url = shuffleOn ? getShuffledPrevUrl() : PREV_URL; if (url) window.location.href = url; } +window._ytpNav = { next: navigateNext, prev: navigatePrev }; video.addEventListener('ended', () => { updatePlayIcon(); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d243084..69aa1d2 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -789,6 +789,39 @@ border-color: #ef4444 !important; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); } + + /* ── Playlist controls bar (sidebar, all video types) ── */ + .pl-controls-bar { + display: flex; + align-items: center; + gap: 4px; + margin-bottom: 10px; + padding: 6px 8px; + background: var(--bg-secondary); + border-radius: 8px; + border: 1px solid var(--border-color); + flex-shrink: 0; + } + .pl-ctrl-btn { + display: flex; + align-items: center; + gap: 5px; + background: none; + border: none; + color: var(--text-secondary); + cursor: pointer; + padding: 5px 8px; + border-radius: 6px; + font-size: 15px; + transition: color .15s, background .15s; + white-space: nowrap; + } + .pl-ctrl-btn:hover:not(:disabled) { color: var(--text-primary); background: rgba(255,255,255,.07); } + .pl-ctrl-btn:disabled { opacity: .35; cursor: default; } + .pl-ctrl-btn.pl-ctrl-active { color: var(--brand-red); } + .pl-ctrl-divider { width: 1px; height: 18px; background: var(--border-color); margin: 0 2px; flex-shrink: 0; } + .pl-ctrl-autoplay { margin-left: auto; } + .pl-autoplay-label { font-size: 12px; font-weight: 500; } @yield('extra_styles') diff --git a/resources/views/videos/partials/audio-player.blade.php b/resources/views/videos/partials/audio-player.blade.php index b51c295..e49170d 100644 --- a/resources/views/videos/partials/audio-player.blade.php +++ b/resources/views/videos/partials/audio-player.blade.php @@ -558,7 +558,7 @@ audio.addEventListener('seeked', () => { }); audio.addEventListener('timeupdate', updateProgress); audio.addEventListener('durationchange', () => { timeDur.textContent = fmt(audio.duration); }); -audio.addEventListener('ended', () => { releaseWakeLock(); if (NEXT_URL) window.location.href = NEXT_URL; }); +audio.addEventListener('ended', () => { releaseWakeLock(); if (window._plOnTrackEnd) { window._plOnTrackEnd(); } else if (NEXT_URL) { window.location.href = NEXT_URL; } }); audio.addEventListener('volumechange', updateVolumeIcon); // ── Loop ───────────────────────────────────────────────────── diff --git a/resources/views/videos/types/generic.blade.php b/resources/views/videos/types/generic.blade.php index 8693756..2746ecd 100644 --- a/resources/views/videos/types/generic.blade.php +++ b/resources/views/videos/types/generic.blade.php @@ -441,13 +441,57 @@
@if ($playlist && $playlistVideos && $playlistVideos->count() > 0) -

+

{{ $playlist->name }} ({{ $playlistVideos->count() }} videos)

+ + {{-- Playlist controls --}} +
+ + +
+ + + +
+ + +