rooms-launcher/iced_video_player
2025-05-01 23:45:21 +03:00
..
src add topbar dragging! also fix a lot of perf issues with rerenders 2025-04-18 14:11:14 +03:00
.gitignore initial commit: oh this is going to be horrible 2025-04-14 18:39:56 +03:00
Cargo.lock publish cargo update 2025-05-01 23:45:21 +03:00
Cargo.toml i am stupid and misconfigured it, but doesnt build anyway 2025-05-01 23:34:52 +03:00
LICENSE-APACHE initial commit: oh this is going to be horrible 2025-04-14 18:39:56 +03:00
LICENSE-MIT initial commit: oh this is going to be horrible 2025-04-14 18:39:56 +03:00
README.md initial commit: oh this is going to be horrible 2025-04-14 18:39:56 +03:00

Iced Video Player Widget

Composable component to play videos in any Iced application built on the excellent GStreamer library.

Overview

In general, this supports anything that gstreamer/playbin supports.

Features:

  • Load video files from any file path or URL (support for streaming over network).
  • Video buffering when streaming on a network.
  • Audio support.
  • Programmatic control.
  • Can capture thumbnails from a set of timestamps.
  • Good performance (i.e., comparable to other video players). GStreamer (with the right plugins) will perform hardware-accelerated decoding, and the color space (YUV to RGB) is converted on the GPU whilst rendering the frame.

Limitations (hopefully to be fixed):

  • GStreamer is a bit annoying to set up on Windows.

The player does not come with any surrounding GUI controls, but they should be quite easy to implement should you need them. See the "minimal" example for a demonstration on how you could implement pausing, looping, and seeking.

Example Usage

use iced_video_player::{Video, VideoPlayer};

fn main() -> iced::Result {
    iced::run("Video Player", (), App::view)
}

struct App {
    video: Video,
}

impl Default for App {
    fn default() -> Self {
        App {
            video: Video::new(&url::Url::parse("file:///C:/my_video.mp4").unwrap()).unwrap(),
        }
    }
}

impl App {
    fn view(&self) -> iced::Element<()> {
        VideoPlayer::new(&self.video).into()
    }
}

Building

Follow the GStreamer build instructions. This should be able to compile on MSVC, MinGW, Linux, and MacOS.

License

Licensed under either

at your option.