dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Video not loading

Open dzervas opened this issue 3 years ago • 3 comments

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.mp4
  • test.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

dzervas avatar Apr 02 '22 01:04 dzervas

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.

jkelleyrtp avatar Apr 02 '22 01:04 jkelleyrtp

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.?

dzervas avatar Apr 02 '22 01:04 dzervas

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..

rMazeiks avatar Apr 02 '22 20:04 rMazeiks

It seems that if your videos aren't supported by browsers, then using them in desktop won't work.

jkelleyrtp avatar Dec 30 '22 08:12 jkelleyrtp