diff options
| -rw-r--r-- | src/audio_player.rs | 9 | ||||
| -rw-r--r-- | src/main.rs | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/audio_player.rs b/src/audio_player.rs index 68fcc7b..97a61cd 100644 --- a/src/audio_player.rs +++ b/src/audio_player.rs @@ -231,13 +231,12 @@ impl AudioPlayer { Ok(()) } - pub fn stop_current(&self) { + pub fn stop_current(&self) -> Result<(), AudioPlayerError> { info!("Stopping pipeline, sending EOS"); - let handled = self.http_src.send_event(gst::Event::new_eos().build()); - if !handled { - warn!("EOS event was not handled"); - } + self.bus.post(&gst::Message::new_eos().build())?; + + Ok(()) } fn send_state(&self, state: State) { diff --git a/src/main.rs b/src/main.rs index d1b34df..f4f7559 100644 --- a/src/main.rs +++ b/src/main.rs @@ -192,7 +192,7 @@ impl Application { if !self.player.is_started() { if !playlist.is_empty() { - self.player.stop_current(); + self.player.stop_current()?; } } else { self.player.play()?; @@ -214,7 +214,7 @@ impl Application { let playlist = self.playlist.lock().expect("Mutex was not poisoned"); if !playlist.is_empty() { info!("Skipping to next track"); - self.player.stop_current(); + self.player.stop_current()?; } else { info!("Playlist empty, cannot skip"); self.player.reset()?; |
