No description
Find a file
jazzfool 65f9cc5a5d
Merge pull request #12 from eaglesemanation/master
Add non-str pipeline support
2024-09-21 12:48:23 +10:00
.media overhaul to iced widget w/ custom render pipeline 2024-02-19 02:59:54 +11:00
examples Allow custom pipelines, autodetect live sources 2024-08-05 17:55:50 -04:00
src No need to check for gst::init 2024-09-19 21:28:42 -04: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 Don't call gst::init if initialized, add non-str pipeline support 2024-09-19 21:18:18 -04:00
Cargo.toml bump ver to 0.3.0 2024-09-19 14:10:48 +10:00
flake.lock feat: add looping, fix some issues with minimal example, update deps 2021-08-25 16:39:23 +03:00
flake.nix feat: add looping, fix some issues with minimal example, update deps 2021-08-25 16:39:23 +03: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 overhaul to iced widget w/ custom render pipeline 2024-02-19 02:59:54 +11:00
shell.nix feat: add looping, fix some issues with minimal example, update deps 2021-08-25 16:39:23 +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.
  • Capture thumbnails from a set of timestamps.
  • Decent performance. Skips a lot of the overhead from Iced Image and copies frame data directly to a WGPU texture, and renders using a custom WGPU render pipeline. For a very subjective reference, I can play back 1080p HEVC video with hardware decoding without hitches, in debug mode.

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};
use iced::{Sandbox, Element};

fn main() {
    App::run(Default::default());
}

struct App {
    video: Video,
}

impl Sandbox for App {
    type Message = ();

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

    fn title(&self) -> String {
        String::from("Video Player")
    }

    fn update(&mut self, _message: ()) {}

    fn view(&mut self) -> 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.