default volume to 80% (≈ -2dB)

This commit is contained in:
Charlotte Som 2025-06-05 01:25:22 +01:00
parent efffc976d1
commit aa0f0885f9

View file

@ -39,8 +39,10 @@ const resolveVideoURL = async (did: string, blob: string): Promise<string> => {
method: "POST", method: "POST",
headers: { "content-encoding": "application/json" }, headers: { "content-encoding": "application/json" },
body: JSON.stringify({ repo: did, blob }), 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 () => { const main = async () => {
@ -55,21 +57,23 @@ const main = async () => {
const did = repo.startsWith("did:") ? repo : await resolveHandle(repo); const did = repo.startsWith("did:") ? repo : await resolveHandle(repo);
const video = await fetchVideoRecord(did, rkey); const record = await fetchVideoRecord(did, rkey);
const videoURL = await resolveVideoURL(did, video.video.ref.$link); const videoURL = await resolveVideoURL(did, record.video.ref.$link);
const video = (
player.append(
<video crossOrigin="anonymous" controls> <video crossOrigin="anonymous" controls>
<source src={videoURL} /> <source src={videoURL} />
</video> </video>
); ) as HTMLVideoElement;
video.volume = 0.8;
if (video.title) { player.append(video);
player.append(<h1>{video.title}</h1>);
document.title = `${video.title} | video.cerulea.blue`; if (record.title) {
player.append(<h1>{record.title}</h1>);
document.title = `${record.title} | video.cerulea.blue`;
} }
if (video.description) if (record.description)
player.append(<p className="description">{video.description}</p>); player.append(<p className="description">{record.description}</p>);
}; };
main(); main();