O7LARFJLYA7QBV73LE6N3DWVVKHCE43LI6EMCD34AXYHP6M5PWDQC use druid::kurbo::{self, BezPath, Line, Shape, Size};use druid::piet::{Brush, LineCap, LineJoin, RenderContext, StrokeStyle};use druid::widget::prelude::*;use druid::{Point, TimerToken};use tf_player::{PlayerController, PlayerState};
use druid::{kurbo::{Line, Size},piet::{LineCap, LineJoin, RenderContext, StrokeStyle},widget::prelude::*,Point,};use tf_player::PlayerState;
Event::Timer(t) if Some(*t) == self.timer => {if let PlayerState::Playing { .. } = data.borrow().state() {println!("TIMER TICK");ctx.request_paint();self.timer = Some(ctx.request_timer(Duration::SECOND));}}Event::Command(c) if c.is(command::SONG_PLAY) => {println!("TIMER START");self.timer = Some(ctx.request_timer(Duration::SECOND));}
if let Some((position, song)) = match player.state() {PlayerState::Playing {offset,playing_since,song,} => Some((*offset + Instant::now().duration_since(*playing_since),song,)),PlayerState::Paused { offset, song } => Some((*offset, song)),
if let Some((position, song)) = match data.as_ref() {PlayerState::Playing { offset, song, .. } | PlayerState::Paused { offset, song } => {Some((offset, song))}
BoxConstraints, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx,UpdateCtx, Widget, WidgetId,
kurbo::Size, BoxConstraints, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx,PaintCtx, UpdateCtx, Widget, WidgetId,
pub mod player_tick;
Button, Container, CrossAxisAlignment, EnvScope, Flex, Label, List, Maybe, Parse, RawLabel,Scroll, SizedBox, Slider, TextBox, ViewSwitcher,
Button, Container, ControllerHost, CrossAxisAlignment, EnvScope, Flex, Label, List, Maybe,Scroll, SizedBox, TextBox,
.with_child(bar)
.with_child(Flex::row().with_child(Label::new(|data: &Rc<PlayerState>, _: &_| {format_duration(data.current_time().unwrap_or(&Duration::ZERO))})).with_default_spacer().with_flex_child(PlayerBar::default(), 1.0).with_default_spacer().with_child(Label::new(|data: &Rc<PlayerState>, _: &_| {format_duration(data.current_song().map(|s| &s.duration).unwrap_or(&Duration::ZERO),)})),)
fn format_duration(d: &Duration) -> String {format!("{:02}:{:02}", d.as_secs() / 60, d.as_secs() % 60)}
pub const PLAY_PAUSE: Selector = Selector::new("play-pause");
pub const PLAYER_PLAY_PAUSE: Selector = Selector::new("player.play-pause");pub const PLAYER_TICK: Selector = Selector::new("player.tick");pub const PLAYER_SEEK: Selector<Duration> = Selector::new("player.seek");
imports_granularity = "Crate"group_imports = "StdExternalCrate"