draft video player component

This commit is contained in:
yggverse 2024-10-29 02:01:35 +02:00
parent da1c8d1da3
commit b4b97facf0
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,24 @@
mod default;
use default::Default;
use gtk::{MediaStream, Video};
pub struct Player {
gobject: Video, // @TODO
}
impl Player {
// Constructors
pub fn new_default(media_stream: &MediaStream) -> Self {
Self {
gobject: Default::new(media_stream).gobject().clone(),
}
}
// Getters
pub fn gobject(&self) -> &Video {
&self.gobject
}
}

View File

@ -0,0 +1,20 @@
mod widget;
use widget::Widget;
use gtk::{MediaStream, Video};
pub struct Default {
widget: Widget,
}
impl Default {
pub fn new(media_stream: &MediaStream) -> Self {
Self {
widget: Widget::new(media_stream),
}
}
pub fn gobject(&self) -> &Video {
&self.widget.gobject()
}
}

View File

@ -0,0 +1,27 @@
use gtk::{MediaStream, Video};
pub struct Widget {
gobject: Video,
}
impl Widget {
// Constructors
/// Create new default widget configuration with options
pub fn new(media_stream: &MediaStream) -> Self {
Self {
gobject: Video::builder()
.autoplay(true)
.hexpand(true)
.media_stream(media_stream)
.vexpand(true)
.build(),
}
}
// Getters
pub fn gobject(&self) -> &Video {
&self.gobject
}
}