dioxus
dioxus copied to clipboard
Video not loading
Problem
I'm trying to load a local fs video and it does not play at all.
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! (
video { src: "dioxus://index.html/test.mp4", controls: "true", "type": "video/mp4" }
))
}
I also tried src:
dioxus://test.mp4test.mp4./test.mp4
Steps To Reproduce
Steps to reproduce the behavior:
- Create video tag
- Load it inside a video tag
Expected behavior
The video should start playing
Environment:
- Dioxus version:
0.2.3 - Rust version:
1.59.0 - OS info: Manjaro
- App platform:
desktop
Questionnaire
- [ ] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [x] I don't have time to fix this right now, but maybe later
I'm not sure where you saw that you need to prefix the asset with dioxus://index.html but that's not necessary. Just include the path relative to your crate root.
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
video {
src: "examples/assets/video.mp4",
autoplay: "true"
}
}
})
}
works for me.
Damn my video is HEVC (H.265 encoded) MP4! And that brings me to the next question: Is there support for MP4/MKV/AVI H264/H265/etc.?
Currently, desktop apps are rendered with the platform's WebView library
(https://dioxuslabs.com/guide/)
I think that means that video codec support depends on your system, not Dioxus – so it might vary..
It seems that if your videos aren't supported by browsers, then using them in desktop won't work.