! Finalizing video fetch endpoint
With this the backend is officially at an MVP stage and now requires polishing Proper data streaming for larger clips is basically required for a really good backend(especially async streaming) and some better css for the video player
This commit is contained in:
parent
d6b076970f
commit
c53d9a293e
@ -9,7 +9,6 @@ edition = "2018"
|
|||||||
rocket = { version = "0.5.0-rc.1", features = [ "json" ] }
|
rocket = { version = "0.5.0-rc.1", features = [ "json" ] }
|
||||||
tokio = "1.0"
|
tokio = "1.0"
|
||||||
serde = { version = "1.0", features = [ "derive" ] }
|
serde = { version = "1.0", features = [ "derive" ] }
|
||||||
base64 = "0.13.0"
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies.rocket_dyn_templates]
|
[dependencies.rocket_dyn_templates]
|
||||||
|
@ -37,9 +37,6 @@ pub async fn category(cat: PathBuf) -> Template {
|
|||||||
|
|
||||||
#[get("/clip/<cat>/<file_base>")]
|
#[get("/clip/<cat>/<file_base>")]
|
||||||
pub async fn video(cat: PathBuf, file_base: PathBuf) -> Template {
|
pub async fn video(cat: PathBuf, file_base: PathBuf) -> Template {
|
||||||
// NOTE: the "file name" does not include the
|
|
||||||
println!("{:?}, {:?}", cat, file_base);
|
|
||||||
|
|
||||||
let mut h: HashMap<&'static str, &str> = HashMap::new();
|
let mut h: HashMap<&'static str, &str> = HashMap::new();
|
||||||
|
|
||||||
let cat = cat.to_string_lossy();
|
let cat = cat.to_string_lossy();
|
||||||
@ -59,6 +56,8 @@ pub async fn video(cat: PathBuf, file_base: PathBuf) -> Template {
|
|||||||
let thumbnail = format!("/thumbnail/{}/{}", cat, file);
|
let thumbnail = format!("/thumbnail/{}/{}", cat, file);
|
||||||
h.insert("ogimg", &thumbnail);
|
h.insert("ogimg", &thumbnail);
|
||||||
|
|
||||||
|
let clip_url = format!("/video/{}/{}", &cat, &file);
|
||||||
|
h.insert("clip_url", &clip_url);
|
||||||
return Template::render("video", &h);
|
return Template::render("video", &h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ pub fn list(cat: PathBuf) -> Option<Json<Vec<VideoPreview>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[get("/clip/<cat>/<file>")]
|
#[get("/<cat>/<file>")]
|
||||||
pub async fn get_video(cat: PathBuf, file: PathBuf) -> Option<NamedFile> {
|
pub async fn get_video(cat: PathBuf, file: PathBuf) -> Option<NamedFile> {
|
||||||
let clips_dir = get_clips_dir();
|
let clips_dir = get_clips_dir();
|
||||||
let path = Path::new(&clips_dir).join(cat).join(file);
|
let path = Path::new(&clips_dir).join(cat).join(file);
|
||||||
|
@ -38,6 +38,9 @@ a {
|
|||||||
background: #191818;
|
background: #191818;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
}
|
}
|
||||||
|
video {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.pure-form {
|
.pure-form {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -21,9 +21,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="layout">
|
<div id="layout">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1></h1>
|
<h1>{{title}}</h1>
|
||||||
<div class="video-gallery" id="main-container">
|
<video width="1280" height="720" controls>
|
||||||
</div>
|
<source src="{{clip_url}}" type="">
|
||||||
|
wtf get a better browser 1d10t
|
||||||
|
</video>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user