From f44becbf6f5a5f3f410e01d48f7649b6b1e024cc Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 11 Apr 2024 12:42:41 +1200 Subject: [PATCH] Handle video change on playlist change --- materialious/src/routes/watch/[slug]/+page.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/materialious/src/routes/watch/[slug]/+page.svelte b/materialious/src/routes/watch/[slug]/+page.svelte index ee3a516a..9c987b62 100644 --- a/materialious/src/routes/watch/[slug]/+page.svelte +++ b/materialious/src/routes/watch/[slug]/+page.svelte @@ -194,6 +194,13 @@ const currentVideoIndex = playlistVideoIds.indexOf(data.video.videoId); const newIndex = currentVideoIndex + 1; if (currentVideoIndex !== -1 && newIndex <= playlistVideoIds.length) { + if ($syncPartyConnections) { + $syncPartyConnections.forEach((conn) => { + conn.send({ + events: [{ type: 'change-video', videoId: playlistVideos[newIndex].videoId }] + } as PlayerEvents); + }); + } goto(`/watch/${playlistVideos[newIndex].videoId}?playlist=${data.playlistId}`); } });