Video player component for Iced
  • Rust 92.7%
  • Nix 4.7%
  • WGSL 2.6%
Find a file
2026-04-06 00:43:10 +10:00
.media update screenshot 2024-09-29 19:56:57 +10:00
examples fix some clippy lints 2026-03-12 14:02:28 -04:00
src video: fix subtitle buffer timing 2026-04-06 00:43:10 +10:00
.envrc feat: add looping, fix some issues with minimal example, update deps 2021-08-25 16:39:23 +03:00
.gitignore feat: add looping, fix some issues with minimal example, update deps 2021-08-25 16:39:23 +03:00
Cargo.lock Update nix devShell and Cargo.lock 2026-03-12 13:56:18 -04:00
Cargo.toml Update nix devShell and Cargo.lock 2026-03-12 13:56:18 -04:00
crates.nix nix: export RUST_SRC_PATH 2026-03-13 13:42:08 -04:00
flake.lock Update nix devShell and Cargo.lock 2026-03-12 13:56:18 -04:00
flake.nix Update nix devShell and Cargo.lock 2026-03-12 13:56:18 -04:00
LICENSE-APACHE initial code 2020-08-19 23:09:24 +10:00
LICENSE-MIT initial code 2020-08-19 23:09:24 +10:00
README.md readme: update example code 2025-12-14 19:52:51 +11:00
shell.nix Update nix devShell and Cargo.lock 2026-03-12 13:56:18 -04: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((), 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<std::convert::Infallible> {
        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.