|
@@ -1,13 +1,13 @@
|
|
import { useEffect, useState } from "react"
|
|
import { useEffect, useState } from "react"
|
|
import { connect } from "react-redux"
|
|
import { connect } from "react-redux"
|
|
-import { faHome, faPlay, faPause, faForward, faBackward, faFastForward, faFastBackward, faVolumeUp} from "@fortawesome/free-solid-svg-icons";
|
|
|
|
|
|
+import { faPlay, faPause, faForward, faBackward, faFastForward, faFastBackward, faVolumeUp} from "@fortawesome/free-solid-svg-icons";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
import * as action from "../actions"
|
|
import * as action from "../actions"
|
|
|
|
|
|
|
|
|
|
const Timestamp = ({time}) =>
|
|
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)} :
|
|
|
|
|
|
+ <small className="timestamp highlightYellow">
|
|
|
|
+ {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)}
|
|
{Math.floor(time % 60) < 10? `0`+ Math.floor(time % 60) : Math.floor(time % 60)}
|
|
</small>
|
|
</small>
|
|
|
|
|
|
@@ -19,51 +19,55 @@ const Playerbar = ({ player, playTrack, pauseTrack, switchTrack, setTrackVolume,
|
|
}, [player, _player])
|
|
}, [player, _player])
|
|
|
|
|
|
return (
|
|
return (
|
|
- <>
|
|
|
|
|
|
+ <footer className="playerbar">
|
|
{_player?.track ?
|
|
{_player?.track ?
|
|
- <footer style={{display: `${_player?.track ? 'block' : 'none'}`, width: '95%', margin:'0 auto'}}>
|
|
|
|
- <input
|
|
|
|
- style={{width:'100%'}}
|
|
|
|
- type="range" min="0" max={_player?.duration} step="any"
|
|
|
|
- value={_player?.currentTime}
|
|
|
|
- onChange={(e) => setCurrentTime(e.target.value)}
|
|
|
|
- />
|
|
|
|
- <div style={{display:"flex", justifyContent:"space-between", width:'95%', margin:'0 auto'}}>
|
|
|
|
- <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>) : ''}
|
|
|
|
|
|
+ <div style={{display: `${_player?.track ? 'block' : 'none'}`}}>
|
|
|
|
+ <div>
|
|
|
|
+ <input
|
|
|
|
+ className="playerbar__range plumline"
|
|
|
|
+ style={{width: '95%'}}
|
|
|
|
+ type="range" min="0" max={_player?.duration} step="any"
|
|
|
|
+ value={_player?.currentTime}
|
|
|
|
+ onChange={(e) => setCurrentTime(e.target.value)}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div className="playerbar__info">
|
|
|
|
+ <Timestamp className="playerbar" time={_player?.currentTime} />
|
|
|
|
+ <strong className="highlightYellow">
|
|
|
|
+ <small className="lightText highlightGreen">{(_player.playlist.name || 'Uploads') + ' : '}</small>
|
|
|
|
+ {(_player.track?.id3?.artist && _player.track?.id3?.title ?
|
|
|
|
+ _player.track?.id3?.artist + ' - ' + _player.track?.id3?.title :
|
|
|
|
+ _player.track?.originalFileName)}
|
|
|
|
+ </strong>
|
|
<Timestamp time={_player?.duration} />
|
|
<Timestamp time={_player?.duration} />
|
|
</div>
|
|
</div>
|
|
<div style={{marginTop:'0.5%'}}>
|
|
<div style={{marginTop:'0.5%'}}>
|
|
- <button
|
|
|
|
- style={{ fontSize: '2vh', padding: '5px' }}
|
|
|
|
- onClick={() => switchTrack(false, _player?.playlistIndex, _player?.playlist)}
|
|
|
|
- >
|
|
|
|
- {_player?.playlistIndex === 0 ? <FontAwesomeIcon icon={faFastBackward} />:
|
|
|
|
|
|
+ <button onClick={() => switchTrack(false, _player?.playlistIndex, _player?.playlist)}>
|
|
|
|
+ {_player?.playlistIndex === 0 ? <FontAwesomeIcon icon={faFastBackward} /> :
|
|
<FontAwesomeIcon icon={faBackward} />}
|
|
<FontAwesomeIcon icon={faBackward} />}
|
|
</button>
|
|
</button>
|
|
|
|
|
|
{_player?.isPlaying ?
|
|
{_player?.isPlaying ?
|
|
- <button style={{ fontSize: '2vh', padding: '5px' }} onClick={() => pauseTrack()}><FontAwesomeIcon icon={faPause} /></button> :
|
|
|
|
- <button style={{ fontSize: '2vh', padding: '5px' }} onClick={() => playTrack()}><FontAwesomeIcon icon={faPlay} /></button>
|
|
|
|
|
|
+ <button onClick={() => pauseTrack()}><FontAwesomeIcon icon={faPause} /></button> :
|
|
|
|
+ <button onClick={() => playTrack()}><FontAwesomeIcon icon={faPlay} /></button>
|
|
}
|
|
}
|
|
|
|
|
|
- <button
|
|
|
|
- style={{ fontSize: '2vh', padding: '5px' }}
|
|
|
|
- onClick={() => switchTrack(true, _player?.playlistIndex, _player?.playlist)}
|
|
|
|
- >
|
|
|
|
- {_player?.playlistIndex === (_player?.playlist?.constructor.name === 'Array'? _player?.playlist?.length - 1 : _player?.playlist?.tracks.length - 1) ?
|
|
|
|
- <FontAwesomeIcon icon={faFastForward} /> : <FontAwesomeIcon icon={faForward} />}
|
|
|
|
|
|
+ <button onClick={() => switchTrack(true, _player?.playlistIndex, _player?.playlist)}>
|
|
|
|
+ {_player?.playlistIndex === (_player?.playlist?.constructor.name === 'Array' ?
|
|
|
|
+ _player?.playlist?.length - 1 : _player?.playlist?.tracks.length - 1) ?
|
|
|
|
+ <FontAwesomeIcon icon={faFastForward} /> :
|
|
|
|
+ <FontAwesomeIcon icon={faForward} />}
|
|
</button>
|
|
</button>
|
|
<label style={{marginLeft: '1%'}}>
|
|
<label style={{marginLeft: '1%'}}>
|
|
<FontAwesomeIcon icon={faVolumeUp} />
|
|
<FontAwesomeIcon icon={faVolumeUp} />
|
|
- <input type="range" min="0" max="1" step="any" onChange={(e) => setTrackVolume(e.target.value)} />
|
|
|
|
|
|
+ <input
|
|
|
|
+ className="playerbar__range blueline"
|
|
|
|
+ type="range" min="0" max="1" step="any"
|
|
|
|
+ onChange={(e) => setTrackVolume(e.target.value)} />
|
|
</label>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
- {/* <small>{_player?.playlistIndex}</small> */}
|
|
|
|
- </footer> : <div style={{width:'inherit', height:'inherit', padding:'2em'}}>C'mon, Push the play button on some track :)</div>}
|
|
|
|
- </>
|
|
|
|
|
|
+ </div> : <div style={{width:'inherit', height:'inherit', padding:'2em'}}>C'mon, push the play button on some track :)</div>}
|
|
|
|
+ </footer>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|