Play queue notification (#186)

* Play queue notification

* Lint fix

* change binding

* Add notification preference

* Lint fix

* changelog

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2023-11-04 20:23:02 -04:00
1 parent 777db66bda
commit 4233f30dec
14 files changed
+283 -63

No files matched your search

@@ -35,13 +35,11 @@
});
async function playOnTv() {
const timestamp = videoStartAtChecked ? videoStartAtTimestamp : undefined;
await PlayletApi.playVideo(videoId, timestamp, title, author);
await PlayletApi.playVideo(getVideoInfo());
}
async function queueOnTv() {
const timestamp = videoStartAtChecked ? videoStartAtTimestamp : undefined;
await PlayletApi.queueVideo(videoId, timestamp, title, author);
await PlayletApi.queueVideo(getVideoInfo());
}
function openInvidious() {
@@ -51,6 +49,36 @@
}
window.open(url);
}
function getVideoInfo() {
const timestamp = videoStartAtChecked ? videoStartAtTimestamp : undefined;
return {
type: "video",
videoId,
title,
videoThumbnails: getVideoThumbnails(),
author,
lengthSeconds,
liveNow,
viewCount,
timestamp,
};
}
function getVideoThumbnails() {
if (!invidiousInstance || !videoThumbnails || !videoThumbnails.length) {
return videoThumbnails;
}
return videoThumbnails.map((thumbnail) => {
let url = thumbnail.url;
if (url.startsWith("/")) {
url = invidiousInstance + url;
thumbnail.url = url;
}
return thumbnail;
});
}
</script>
<dialog bind:this={modal} class="modal">