aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio_player.rs
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-02-22 22:46:06 +0100
committerJokler <jokler@protonmail.com>2020-02-22 23:20:10 +0100
commit84804836f5c1e782c77f1bbf676177151558e008 (patch)
tree55f0ee9664018f6ed0cc41d2cfcf13ca3e0ffe60 /src/audio_player.rs
parent5eea11a03c11551091b2c72f48590aec7f5410f0 (diff)
downloadpokebot-84804836f5c1e782c77f1bbf676177151558e008.tar.gz
pokebot-84804836f5c1e782c77f1bbf676177151558e008.zip
Add tmtu mode as a front-end
Diffstat (limited to 'src/audio_player.rs')
-rw-r--r--src/audio_player.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/audio_player.rs b/src/audio_player.rs
index 4df213f..4bcab56 100644
--- a/src/audio_player.rs
+++ b/src/audio_player.rs
@@ -223,6 +223,12 @@ impl AudioPlayer {
*self.volume_f64.read().unwrap()
}
+ pub fn position(&self) -> Option<Duration> {
+ self.pipeline
+ .query_position::<gst::ClockTime>()
+ .and_then(|t| t.0.map(|v| Duration::from_nanos(v)))
+ }
+
pub fn currently_playing(&self) -> Option<AudioMetadata> {
self.currently_playing.read().unwrap().clone()
}