diff --git a/CHANGELOG.md b/CHANGELOG.md index 7427aaa8..267dcb12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- "Open In YouTube" button in web app cast dialog + ### Fixed - Bug in dash storyboard - Adjust live video detection to reduce error rate happening on iOS client - Bug when parsing headers in telemetry - Web app fixes and dependency updates +- Bug when casting a mix from web app ## [0.41.8] - 2025-09-07 diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs index c9435af2..0a044d73 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs @@ -7,14 +7,14 @@ import "pkg:/source/utils/TimeUtils.bs" namespace InvidiousContent function ToRowCellContentNode(item as object, instance as dynamic) as object - if item.videoId <> invalid and (item.type = invalid or item.type = "shortVideo") - item.type = "video" - end if - if item.playlistId <> invalid and (item.type = invalid or item.type = "invidiousPlaylist") item.type = "playlist" end if + if item.videoId <> invalid and (item.type = invalid or item.type = "shortVideo") + item.type = "video" + end if + if item.type <> "video" and item.type <> "playlist" and item.type <> "channel" return invalid end if diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/ViewRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/ViewRouter.bs index 8bb41087..79a50686 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/ViewRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/ViewRouter.bs @@ -21,10 +21,16 @@ namespace Http response = context.response playlistId = request.query.playlistId + ' Mix continuation (playlistId starts with "RD") + videoId = request.query.videoId authorId = request.query.authorId if not StringUtils.IsNullOrEmpty(playlistId) - contentNode = InvidiousContent.ToPlaylistContentNode(invalid, { playlistId: playlistId }, invalid) + content = { playlistId: playlistId } + if playlistId.startsWith("RD") and not StringUtils.IsNullOrEmpty(videoId) + content.videoId = videoId + end if + contentNode = InvidiousContent.ToPlaylistContentNode(invalid, content, invalid) PlaylistUtils.Open(contentNode, m.appController) if VideoQueueUtils.IsVideoPlayerOpen(m.videoQueue) and VideoQueueUtils.IsVideoPlayerFullScreen(m.videoQueue) VideoQueueUtils.ToggleVideoPictureInPicture(m.videoQueue) diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts index 0960bf56..472b7846 100644 --- a/playlet-lib/src/locale/en_US/translations.ts +++ b/playlet-lib/src/locale/en_US/translations.ts @@ -1184,6 +1184,10 @@ Open in Invidious Open in Invidious + + Open in YouTube + Open in YouTube + Start at Start at diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs index dc0044a1..06f9a59b 100644 --- a/playlet-lib/src/source/utils/Locale.bs +++ b/playlet-lib/src/source/utils/Locale.bs @@ -399,6 +399,7 @@ namespace Locale QueueOn = "Queue on %1" OpenOn = "Open on %1" OpenInInvidious = "Open in Invidious" + OpenInYouTube = "Open in YouTube" StartAt = "Start at" end enum diff --git a/playlet-web/src/lib/Api/PlayletApi.ts b/playlet-web/src/lib/Api/PlayletApi.ts index 0995b834..bb621426 100644 --- a/playlet-web/src/lib/Api/PlayletApi.ts +++ b/playlet-web/src/lib/Api/PlayletApi.ts @@ -128,11 +128,15 @@ export class PlayletApi { await PlayletApi.postJson(`${PlayletApi.host()}/api/queue`, args); } - static async openPlaylist(playlistId) { + static async openPlaylist(playlistId, continuationVideoId) { if (!playlistId) { return; } - await fetch(`${PlayletApi.host()}/api/view/open?playlistId=${playlistId}`); + let url = `${PlayletApi.host()}/api/view/open?playlistId=${playlistId}`; + if (continuationVideoId) { + url += `&videoId=${continuationVideoId}`; + } + await fetch(url); } static async openChannel(authorId) { diff --git a/playlet-web/src/lib/VideoFeed/ChannelCastDialog.svelte b/playlet-web/src/lib/VideoFeed/ChannelCastDialog.svelte index d48ea84b..dacba6ca 100644 --- a/playlet-web/src/lib/VideoFeed/ChannelCastDialog.svelte +++ b/playlet-web/src/lib/VideoFeed/ChannelCastDialog.svelte @@ -36,6 +36,11 @@ let url = `${invidiousInstanceForRedirect}/channel/${authorId}`; window.open(url); } + + function openYouTube() { + let url = `https://www.youtube.com/channel/${authorId}`; + window.open(url); + } @@ -56,6 +61,9 @@ + diff --git a/playlet-web/src/lib/VideoFeed/PlaylistCastDialog.svelte b/playlet-web/src/lib/VideoFeed/PlaylistCastDialog.svelte index 9e74f6ec..cbf7ec5d 100644 --- a/playlet-web/src/lib/VideoFeed/PlaylistCastDialog.svelte +++ b/playlet-web/src/lib/VideoFeed/PlaylistCastDialog.svelte @@ -9,6 +9,8 @@ export let videoCountText: string | undefined = undefined; export let playlistThumbnail: string | undefined = undefined; export let videos: any[] | undefined = undefined; + // videoId is Mix continuation (playlistId starts with "RD") + export let videoId: string | undefined = undefined; export function show() { modal.showModal(); @@ -42,11 +44,28 @@ } async function openOnTv() { - await PlayletApi.openPlaylist(playlistId); + const continuationVideoId = + playlistId.startsWith("RD") && videoId ? videoId : undefined; + await PlayletApi.openPlaylist(playlistId, continuationVideoId); } function openInvidious() { - let url = `${invidiousInstanceForRedirect}/playlist?list=${playlistId}`; + const continuationVideoId = + playlistId.startsWith("RD") && videoId ? videoId : undefined; + let url = `${invidiousInstanceForRedirect}/mix?list=${playlistId}`; + if (continuationVideoId) { + url += `&continuation=${continuationVideoId}`; + } + window.open(url); + } + + function openYouTube() { + let url = "https://www.youtube.com"; + if (videoId && playlistId.startsWith("RD")) { + url += `/watch?v=${videoId}&list=${playlistId}`; + } else { + url += `/playlist?list=${playlistId}`; + } window.open(url); } @@ -59,6 +78,7 @@ videoCount, videoCountText, videos, + videoId, }; } @@ -119,6 +139,9 @@ + diff --git a/playlet-web/src/lib/VideoFeed/PlaylistCell.svelte b/playlet-web/src/lib/VideoFeed/PlaylistCell.svelte index 0d1155f2..a209bed2 100644 --- a/playlet-web/src/lib/VideoFeed/PlaylistCell.svelte +++ b/playlet-web/src/lib/VideoFeed/PlaylistCell.svelte @@ -12,6 +12,8 @@ export let videoCountText: string | undefined = undefined; export let videos: any[] | undefined = undefined; export let updated: number | undefined = undefined; + // videoId is Mix continuation (playlistId starts with "RD") + export let videoId: string | undefined = undefined; export let lines: string[] | undefined = undefined; // svelte-ignore unused-export-let @@ -112,4 +114,5 @@ bind:videoCount bind:videoCountText bind:videos + bind:videoId /> diff --git a/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte b/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte index 62d164d5..d76ee492 100644 --- a/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoCastDialog.svelte @@ -81,6 +81,14 @@ window.open(url); } + function openYouTube() { + let url = `https://www.youtube.com/watch?v=${videoId}`; + if (videoStartAtChecked && videoStartAtTimestamp) { + url += `&t=${videoStartAtTimestamp}`; + } + window.open(url); + } + function getVideoInfo() { const timestamp = videoStartAtChecked ? videoStartAtTimestamp : undefined; return { @@ -154,6 +162,9 @@ + diff --git a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte index 2a468dff..6a694e30 100644 --- a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte @@ -204,10 +204,10 @@ const newVideos = items; newVideos.forEach((item) => { - if (item.videoId) { - item.type = "video"; - } else if (item.playlistId) { + if (item.playlistId) { item.type = "playlist"; + } else if (item.videoId) { + item.type = "video"; } });