Composable component to play videos in any Iced application built on the excellent GStreamer library.
In general, this supports anything that gstreamer/playbin
supports.
Features:
Limitations (hopefully to be fixed):
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.
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()
}
}
Follow the GStreamer build instructions. This should be able to compile on MSVC, MinGW, Linux, and MacOS.
Licensed under either
at your option.