Fix casting mixes, add "Open in YouTube" button
This commit is contained in:
1 parent
1047a7882a
commit
6ac29a5bbb
11 files changed
+77
-12
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1184,6 +1184,10 @@
|
||||
<source>Open in Invidious</source>
|
||||
<translation>Open in Invidious</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open in YouTube</source>
|
||||
<translation>Open in YouTube</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start at</source>
|
||||
<translation>Start at</translation>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog bind:this={modal} class="modal">
|
||||
@@ -56,6 +61,9 @@
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openYouTube}>
|
||||
{$translate("Open in YouTube")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
|
||||
@@ -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 @@
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openYouTube}>
|
||||
{$translate("Open in YouTube")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
|
||||
@@ -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
|
||||
/>
|
||||
@@ -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 @@
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openYouTube}>
|
||||
{$translate("Open in YouTube")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user