#video #iced #gui-applications #networking #video-file #file-path

iced_video_player

A convenient video player widget for Iced

8 releases (4 breaking)

0.5.0 Sep 29, 2024
0.4.0 Sep 21, 2024
0.3.0 Sep 19, 2024
0.2.0 Aug 7, 2024
0.1.3 Feb 19, 2024

#91 in Multimedia

Download history 16/week @ 2024-09-02 290/week @ 2024-09-16 169/week @ 2024-09-23 81/week @ 2024-09-30 7/week @ 2024-10-07 8/week @ 2024-10-14 2/week @ 2024-11-18 68/week @ 2024-12-02

70 downloads per month

MIT/Apache

1.5MB
900 lines

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

Dependencies

~48–85MB
~1.5M SLoC