aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-11-19 13:40:28 -0500
committerXe Iaso <me@christine.website>2022-11-19 13:40:28 -0500
commit8b2605a965085eed3fa79db166446aa0282df5f8 (patch)
treecd545ea38842484698fb8165a6a9616b924906d8
parent1e11fc23e5c4449facf9a0f8d84a001b8058b6a1 (diff)
downloadxesite-8b2605a965085eed3fa79db166446aa0282df5f8.tar.xz
xesite-8b2605a965085eed3fa79db166446aa0282df5f8.zip
fix video
Signed-off-by: Xe Iaso <me@christine.website>
-rw-r--r--Cargo.lock1
-rw-r--r--lib/xesite_templates/Cargo.toml1
-rw-r--r--lib/xesite_templates/src/lib.rs6
3 files changed, 6 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4e0ea15..9e373d8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3458,6 +3458,7 @@ name = "xesite_templates"
version = "0.1.0"
dependencies = [
"maud",
+ "uuid 1.1.1",
"xesite_types",
]
diff --git a/lib/xesite_templates/Cargo.toml b/lib/xesite_templates/Cargo.toml
index 3d66e59..d8a49c0 100644
--- a/lib/xesite_templates/Cargo.toml
+++ b/lib/xesite_templates/Cargo.toml
@@ -7,5 +7,6 @@ edition = "2021"
[dependencies]
maud = "0.23.0"
+uuid = { version = "1", features = [ "v4" ] }
xesite_types = { path = "../xesite_types" } \ No newline at end of file
diff --git a/lib/xesite_templates/src/lib.rs b/lib/xesite_templates/src/lib.rs
index 8171a3b..2d38052 100644
--- a/lib/xesite_templates/src/lib.rs
+++ b/lib/xesite_templates/src/lib.rs
@@ -101,11 +101,13 @@ pub fn video(path: String) -> Markup {
"https://cdn.xeiaso.net/file/christine-static/{}/index.m3u8",
path
);
+ let uuid = uuid::Uuid::new_v4();
+ let uuid = format!("{uuid}").replace("-", "");
let hls_script = PreEscaped(format!(
r#"
<script>
if (Hls.isSupported()) {{
- let video = document.getElementById('video');
+ let video = document.getElementById('{uuid}');
let hls = new Hls();
let videoSrc = "{}";
hls.on(Hls.Events.MEDIA_ATTACHED, function () {{
@@ -134,7 +136,7 @@ pub fn video(path: String) -> Markup {
(conv("Mara".into(), "hacker".into(), PreEscaped("You may need to enable JavaScript for this to work. I'm a cartoon shark, not a cop.".to_string())))
}
}
- video id="video" width="100%" controls {
+ video id=(uuid) width="100%" controls {
source src=(stream_url) r#type="application/vnd.apple.mpegurl";
source src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4" r#type="video/mp4";
}