Web app hot fix (#459)

* Web app hot fix

* Small tweak
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2024-09-22 13:29:06 -04:00
1 parent 4f31c206ea
commit 11d1aef201
8 files changed
+451 -2

No files matched your search

@@ -3,6 +3,7 @@
import { playletStateStore, tr } from "lib/Stores";
import VideoStartAt from "./VideoStartAt.svelte";
import VideoThumbnail from "./VideoThumbnail.svelte";
import { YoutubeJs } from "lib/Api/YoutubeJs";
export let videoId: string | undefined = undefined;
export let title: string | undefined = undefined;
@@ -43,6 +44,17 @@
await PlayletApi.playVideo(getVideoInfo());
}
async function playOnTvHotFix() {
// measure length of time it takes to get video info
const start = performance.now();
const videoInfo = await YoutubeJs.getVideoInfo(videoId);
const end = performance.now();
console.log(`Time to get video info: ${end - start}ms`);
await YoutubeJs.postCacheData(videoInfo);
await playOnTv();
}
async function queueOnTv() {
await PlayletApi.queueVideo(getVideoInfo());
}
@@ -114,6 +126,12 @@
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
{$tr("Play on %1").replace("%1", tvName)}
</button>
<button
class="btn join-item hover:btn-accent"
on:click={playOnTvHotFix}
>
{$tr("Play on %1").replace("%1", tvName)} (HOT FIX)
</button>
<button class="btn join-item hover:btn-accent" on:click={queueOnTv}>
{$tr("Queue on %1").replace("%1", tvName)}
</button>