warn on failed seek
This commit is contained in:
parent
6c01d94f69
commit
a12cab3619
1 changed files with 9 additions and 2 deletions
|
@ -436,6 +436,7 @@ use adw::prelude::*;
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use gtk::{gio, glib};
|
use gtk::{gio, glib};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use tracing::{event, Level};
|
||||||
|
|
||||||
glib::wrapper! {
|
glib::wrapper! {
|
||||||
pub struct Window(ObjectSubclass<imp::Window>)
|
pub struct Window(ObjectSubclass<imp::Window>)
|
||||||
|
@ -486,9 +487,15 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn seek(&self, new_position: f64) {
|
pub fn seek(&self, new_position: f64) {
|
||||||
self.imp()
|
match self
|
||||||
|
.imp()
|
||||||
.mpv
|
.mpv
|
||||||
.command(["seek", &new_position.to_string(), "absolute", "exact"])
|
.command(["seek", &new_position.to_string(), "absolute", "exact"])
|
||||||
.unwrap();
|
{
|
||||||
|
Ok(()) => {}
|
||||||
|
// TODO: buffer this on fail (usually happens when the file isn't done loading)
|
||||||
|
// to repro, mash the seek forward button
|
||||||
|
Err(err) => event!(Level::ERROR, "could seek to {new_position}: {err}"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue