Small restructuring
parent
2a3ee1b1d6
commit
f4157d24d1
|
|
@ -106,18 +106,28 @@ pub struct TrackMetadata {
|
||||||
pub duration: Option<Duration>,
|
pub duration: Option<Duration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct PlayerState {
|
pub struct PlayerState {
|
||||||
pub currently_playing: Option<String>,
|
pub currently_playing: Option<String>,
|
||||||
pub is_playing: bool,
|
pub is_playing: bool,
|
||||||
pub time_ratio: f64,
|
pub time_ratio: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for PlayerState {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
currently_playing: None,
|
||||||
|
is_playing: false,
|
||||||
|
time_ratio: 0.0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PlayerState {
|
impl PlayerState {
|
||||||
pub fn play(&mut self, path: &str) {
|
pub fn play(&mut self, path: &str) {
|
||||||
self.currently_playing = Some(path.to_string());
|
self.currently_playing = Some(path.to_string());
|
||||||
self.is_playing = true;
|
self.is_playing = true;
|
||||||
self.time_ratio = 0.0;
|
self.time_ratio = 0.0;
|
||||||
|
// TODO: Handle audio
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_pause(&mut self) {
|
pub fn toggle_pause(&mut self) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue