From aa0f0885f946b43c1b3996dd2c054ac268b5f024 Mon Sep 17 00:00:00 2001 From: Charlotte Som Date: Thu, 5 Jun 2025 01:25:22 +0100 Subject: [PATCH] =?UTF-8?q?default=20volume=20to=2080%=20(=E2=89=88=20-2dB?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/viewer.tsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/client/viewer.tsx b/client/viewer.tsx index 2c48d1b..f74c250 100644 --- a/client/viewer.tsx +++ b/client/viewer.tsx @@ -39,8 +39,10 @@ const resolveVideoURL = async (did: string, blob: string): Promise => { method: "POST", headers: { "content-encoding": "application/json" }, body: JSON.stringify({ repo: did, blob }), - }).then((r) => r.json()); - return `/user-content/${res.filename}`; + }); + if (res.status !== 200) throw new Error("got error fetching video cdn url"); + const data = await res.json(); + return `/user-content/${data.filename}`; }; const main = async () => { @@ -55,21 +57,23 @@ const main = async () => { const did = repo.startsWith("did:") ? repo : await resolveHandle(repo); - const video = await fetchVideoRecord(did, rkey); - const videoURL = await resolveVideoURL(did, video.video.ref.$link); - - player.append( + const record = await fetchVideoRecord(did, rkey); + const videoURL = await resolveVideoURL(did, record.video.ref.$link); + const video = ( - ); + ) as HTMLVideoElement; + video.volume = 0.8; - if (video.title) { - player.append(

{video.title}

); - document.title = `${video.title} | video.cerulea.blue`; + player.append(video); + + if (record.title) { + player.append(

{record.title}

); + document.title = `${record.title} | video.cerulea.blue`; } - if (video.description) - player.append(

{video.description}

); + if (record.description) + player.append(

{record.description}

); }; main();