AudioPlayer: Add an api to initialize a stream.

This commit is contained in:
Jordan Petridis 2018-06-22 19:44:32 +03:00
parent 733e279461
commit 8df8182b2a

View file

@ -40,6 +40,7 @@ trait PlayerExt {
fn play(&self);
fn pause(&self);
fn stop(&self);
fn set_uri(&self, &str);
}
#[derive(Debug, Clone)]
@ -182,8 +183,8 @@ impl AudioPlayerWidget {
Self::connect_gst_signals(s);
}
pub fn initialize_stream(&self) -> Result<(), Error> {
unimplemented!()
pub fn initialize_stream(&self, uri: &str) {
self.set_uri(uri)
}
#[cfg_attr(rustfmt, rustfmt_skip)]
@ -255,4 +256,8 @@ impl PlayerExt for AudioPlayerWidget {
// Reset the slider position to 0
self.timer.on_position_updated(Position(ClockTime::from_seconds(0)));
}
fn set_uri(&self, uri: &str) {
self.player.set_uri(uri)
}
}