PlayerWidget: Honorable try at getting the player to reset.
connect_end_of_stream also requires Send.
This commit is contained in:
parent
567b3a556b
commit
c9f4980d68
@ -31,6 +31,7 @@ pub enum SeekDirection {
|
|||||||
pub trait PlayerExt {
|
pub trait PlayerExt {
|
||||||
fn play(&self);
|
fn play(&self);
|
||||||
fn pause(&self);
|
fn pause(&self);
|
||||||
|
// fn stop(&self);
|
||||||
fn seek(&self, offset: ClockTime, direction: SeekDirection);
|
fn seek(&self, offset: ClockTime, direction: SeekDirection);
|
||||||
fn fast_forward(&self);
|
fn fast_forward(&self);
|
||||||
fn rewind(&self);
|
fn rewind(&self);
|
||||||
@ -189,6 +190,8 @@ impl PlayerWidget {
|
|||||||
// Connect the fast-forward button to the gst Player.
|
// Connect the fast-forward button to the gst Player.
|
||||||
s.controls.forward.connect_clicked(clone!(s => move |_| s.fast_forward()));
|
s.controls.forward.connect_clicked(clone!(s => move |_| s.fast_forward()));
|
||||||
|
|
||||||
|
// s.player.connect_end_of_stream(move |p| p.stop());
|
||||||
|
|
||||||
s.player.connect_error(clone!(sender => move |_, error| {
|
s.player.connect_error(clone!(sender => move |_, error| {
|
||||||
// FIXME: should never occur and should not be user facing.
|
// FIXME: should never occur and should not be user facing.
|
||||||
sender.send(Action::ErrorNotification(format!("Player Error: {}", error)))
|
sender.send(Action::ErrorNotification(format!("Player Error: {}", error)))
|
||||||
@ -319,7 +322,7 @@ impl PlayerExt for PlayerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn pause(&self) {
|
fn pause(&self) {
|
||||||
// assert the state is paused
|
// assert the state is paused or ready
|
||||||
// TODO: assert!()
|
// TODO: assert!()
|
||||||
|
|
||||||
self.controls.pause.hide();
|
self.controls.pause.hide();
|
||||||
@ -328,6 +331,12 @@ impl PlayerExt for PlayerWidget {
|
|||||||
self.player.pause();
|
self.player.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This needs to be Send to be used with the `connect_end_of_stream` method.
|
||||||
|
// fn stop(&self) {
|
||||||
|
// self.player().stop();
|
||||||
|
// self.pause();
|
||||||
|
// }
|
||||||
|
|
||||||
// Adapted from https://github.com/philn/glide/blob/b52a65d99daeab0b487f79a0e1ccfad0cd433e22/src/player_context.rs#L219-L245
|
// Adapted from https://github.com/philn/glide/blob/b52a65d99daeab0b487f79a0e1ccfad0cd433e22/src/player_context.rs#L219-L245
|
||||||
fn seek(&self, offset: ClockTime, direction: SeekDirection) {
|
fn seek(&self, offset: ClockTime, direction: SeekDirection) {
|
||||||
let position = self.player.get_position();
|
let position = self.player.get_position();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user