|
@@ -3,6 +3,12 @@ import { connect } from "react-redux"
|
|
|
import * as action from "../actions"
|
|
|
|
|
|
|
|
|
+const Timestamp = ({time}) =>
|
|
|
+ <small style={{margin: '0 10px'}}>
|
|
|
+ {Math.floor((time / 60) % 60) < 10? `0` + Math.floor((time / 60) % 60) : Math.floor((time / 60) % 60)} :
|
|
|
+ {Math.floor(time % 60) < 10? `0`+ Math.floor(time % 60) : Math.floor(time % 60)}
|
|
|
+ </small>
|
|
|
+
|
|
|
const Playerbar = ({ player, playTrack, pauseTrack, switchTrack, setTrackVolume, setCurrentTime }) => {
|
|
|
let [_player, setPlayer] = useState()
|
|
|
|
|
@@ -21,21 +27,23 @@ const Playerbar = ({ player, playTrack, pauseTrack, switchTrack, setTrackVolume,
|
|
|
onChange={(e) => setCurrentTime(e.target.value)}
|
|
|
/>
|
|
|
<div style={{display:"flex", justifyContent:"space-between", width:'95%', margin:'0 auto'}}>
|
|
|
- <small style={{margin: '0 10px'}}>
|
|
|
+ {/* <small style={{margin: '0 10px'}}>
|
|
|
{Math.floor((_player?.currentTime / 60) % 60) < 10?
|
|
|
`0` + Math.floor((_player?.currentTime / 60) % 60) : Math.floor((_player?.currentTime / 60) % 60)} :
|
|
|
{Math.floor(_player?.currentTime % 60) < 10?
|
|
|
`0`+ Math.floor(_player?.currentTime % 60) : Math.floor(_player?.currentTime % 60)}
|
|
|
- </small>
|
|
|
+ </small> */}
|
|
|
+ <Timestamp time={_player?.currentTime} />
|
|
|
{_player ? (_player.track?.id3?.artist && _player.track?.id3?.title ?
|
|
|
<strong>{_player.track?.id3?.artist} - {_player.track?.id3?.title}</strong> :
|
|
|
<strong>{_player.track?.originalFileName}</strong>) : ''}
|
|
|
- <small style={{margin: '0 10px'}}>
|
|
|
+ {/* <small style={{margin: '0 10px'}}>
|
|
|
{Math.floor((_player?.duration / 60) % 60) < 10?
|
|
|
`0` + Math.floor((_player?.duration / 60) % 60) : Math.floor((_player?.duration / 60) % 60)} :
|
|
|
{Math.floor(_player?.duration % 60) < 10?
|
|
|
`0`+ Math.floor(_player?.duration % 60) : Math.floor(_player?.duration % 60)}
|
|
|
- </small>
|
|
|
+ </small> */}
|
|
|
+ <Timestamp time={_player?.duration} />
|
|
|
</div>
|
|
|
<div style={{marginTop:'0.5%'}}>
|
|
|
<button
|
|
@@ -54,7 +62,8 @@ const Playerbar = ({ player, playTrack, pauseTrack, switchTrack, setTrackVolume,
|
|
|
style={{ fontSize: '2vh' }}
|
|
|
onClick={() => switchTrack(true, _player?.playlistIndex, _player?.playlist)}
|
|
|
>
|
|
|
- {_player?.playlistIndex === _player?.playlist?.length - 1 ? `\u23F5` : `\u23ED`}
|
|
|
+ {_player?.playlistIndex === (_player?.playlist?.constructor.name === 'Array'? _player?.playlist?.length - 1 : _player?.playlist?.tracks.length - 1) ?
|
|
|
+ `\u23F5` : `\u23ED`}
|
|
|
</button>
|
|
|
<input style={{marginLeft: '1%'}} type="range" min="0" max="1" step="any" onChange={(e) => setTrackVolume(e.target.value)} />
|
|
|
</div>
|