feat: updates

This commit is contained in:
qier222 2022-03-19 17:03:29 +08:00
parent 08abf8229f
commit fb21405bf9
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
33 changed files with 699 additions and 361 deletions

View file

@ -87,7 +87,11 @@ const MediaControls = () => {
>
<SvgIcon
className='h-[1.5rem] w-[1.5rem] '
name={state === PlayerState.PLAYING ? 'pause' : 'play'}
name={
[PlayerState.PLAYING, PlayerState.LOADING].includes(state)
? 'pause'
: 'play'
}
/>
</IconButton>
<IconButton onClick={() => track && player.nextTrack()} disabled={!track}>
@ -125,6 +129,7 @@ const Progress = () => {
() => playerSnapshot.progress,
[playerSnapshot.progress]
)
const state = useMemo(() => playerSnapshot.state, [playerSnapshot.state])
const track = useMemo(() => playerSnapshot.track, [playerSnapshot.track])
return (
@ -133,7 +138,11 @@ const Progress = () => {
<Slider
min={0}
max={(track.dt ?? 0) / 1000}
value={progress}
value={
state === PlayerState.PLAYING || state === PlayerState.PAUSED
? progress
: 0
}
onChange={value => {
player.progress = value
}}