aboutsummaryrefslogtreecommitdiff
path: root/lume/src/_components/XeblogVideo.tsx
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-02-24 22:49:25 -0500
committerXe Iaso <me@xeiaso.net>2024-02-24 22:49:34 -0500
commit8eecbfa829848bf1f688365ae059d7a2c349fd08 (patch)
treef710ded5045b000118bb9e9f8f5a2587f94470b0 /lume/src/_components/XeblogVideo.tsx
parent2a1f72616ab49c0cdfd47dc2286ef3820171c450 (diff)
downloadxesite-8eecbfa829848bf1f688365ae059d7a2c349fd08.tar.xz
xesite-8eecbfa829848bf1f688365ae059d7a2c349fd08.zip
lume/components/XeblogVideo: expose stream link
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'lume/src/_components/XeblogVideo.tsx')
-rw-r--r--lume/src/_components/XeblogVideo.tsx45
1 files changed, 24 insertions, 21 deletions
diff --git a/lume/src/_components/XeblogVideo.tsx b/lume/src/_components/XeblogVideo.tsx
index 79e19da..872fff4 100644
--- a/lume/src/_components/XeblogVideo.tsx
+++ b/lume/src/_components/XeblogVideo.tsx
@@ -2,12 +2,7 @@
// @jsxRuntime automatic
import Hls from "npm:hls.js";
-
-function uuidv4() {
- return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
- (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
- );
-}
+import { sha256 } from "npm:js-sha256";
export interface VideoProps {
path: string;
@@ -15,17 +10,16 @@ export interface VideoProps {
}
export default function Video({ path, vertical }: VideoProps) {
- const streamURL =
- `https://cdn.xeiaso.net/file/christine-static/${path}/index.m3u8`;
- const id = uuidv4();
+ const streamURL = `https://cdn.xeiaso.net/file/christine-static/${path}/index.m3u8`;
+ const id = sha256(streamURL);
const video = (
- <video id={id} className="not-prose sm:max-h-[50vh]" controls>
- <source src={streamURL} type="application/vnd.apple.mpegurl" />
- <source
- src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4"
- type="video/mp4"
- />
- </video>
+ <video id={id} className="not-prose sm:max-h-[50vh] mx-auto" controls>
+ <source src={streamURL} type="application/vnd.apple.mpegurl" />
+ <source
+ src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4"
+ type="video/mp4"
+ />
+ </video>
);
const script = (
@@ -34,10 +28,19 @@ export default function Video({ path, vertical }: VideoProps) {
execFor(${`'`}${id}${`'`}, ${`'`}${streamURL}${`'`});`}
</script>
- )
+ );
- return <>
- {video}
- {script}
- </>;
+ return (
+ <>
+ {video}
+ {script}
+ <div className="text-center">
+ Want to watch this in your video player of choice? Take this:
+ <br />
+ <a href={streamURL} rel="noreferrer">
+ {streamURL}
+ </a>
+ </div>
+ </>
+ );
}