rewrite in GStreamer
This commit is contained in:
parent
7d05e3f36b
commit
8361c52d67
4 changed files with 309 additions and 223 deletions
|
@ -25,10 +25,15 @@ impl Application for App {
|
|||
(
|
||||
App {
|
||||
video: VideoPlayer::new(
|
||||
&std::path::PathBuf::from(file!())
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("../.media/test.mp4"),
|
||||
&url::Url::from_file_path(
|
||||
std::path::PathBuf::from(file!())
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("../.media/test.mp4")
|
||||
.canonicalize()
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
pause_btn: Default::default(),
|
||||
|
@ -44,14 +49,12 @@ impl Application for App {
|
|||
fn update(&mut self, message: Message) -> Command<Message> {
|
||||
match message {
|
||||
Message::TogglePause => {
|
||||
self.video.paused = !self.video.paused;
|
||||
|
||||
Command::none()
|
||||
}
|
||||
Message::VideoPlayerMessage(msg) => {
|
||||
self.video.update(msg).map(Message::VideoPlayerMessage)
|
||||
self.video.set_paused(!self.video.paused());
|
||||
}
|
||||
Message::VideoPlayerMessage(msg) => self.video.update(msg),
|
||||
}
|
||||
|
||||
Command::none()
|
||||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
|
@ -60,7 +63,7 @@ impl Application for App {
|
|||
|
||||
fn view(&mut self) -> Element<Message> {
|
||||
Column::new()
|
||||
.push(self.video.view())
|
||||
.push(self.video.frame_view())
|
||||
.push(
|
||||
Button::new(&mut self.pause_btn, Text::new("Toggle Pause"))
|
||||
.on_press(Message::TogglePause),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue