quintodrome/ui/src/SharePlayer.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-01-19 18:52:55 -09:00
import ReactJkMusicPlayer from 'navidrome-music-player'
import { shareInfo } from './config'
import { shareCoverUrl, shareStreamUrl } from './utils'
2023-01-19 18:52:55 -09:00
import { makeStyles } from '@material-ui/core/styles'
const useStyle = makeStyles({
player: {
'& .group .next-audio': {
pointerEvents: (props) => props.single && 'none',
opacity: (props) => props.single && 0.65,
},
},
})
2023-01-20 15:53:53 -09:00
const SharePlayer = () => {
const classes = useStyle({ single: shareInfo?.tracks.length === 1 })
2023-01-19 18:52:55 -09:00
const list = shareInfo?.tracks.map((s) => {
return {
name: s.title,
2023-01-21 17:01:50 -09:00
musicSrc: shareStreamUrl(s.id),
cover: shareCoverUrl(s.id),
2023-01-19 18:52:55 -09:00
singer: s.artist,
duration: s.duration,
}
})
const options = {
audioLists: list,
mode: 'full',
2023-01-21 17:10:35 -09:00
toggleMode: false,
2023-01-19 18:52:55 -09:00
mobileMediaQuery: '',
showDownload: false,
showReload: false,
showMediaSession: true,
2023-01-20 15:53:53 -09:00
theme: 'auto',
showThemeSwitch: false,
restartCurrentOnPrev: true,
2023-01-21 17:10:35 -09:00
remove: false,
spaceBar: true,
volumeFade: { fadeIn: 200, fadeOut: 200 },
2023-01-19 18:52:55 -09:00
}
return <ReactJkMusicPlayer {...options} className={classes.player} />
2023-01-19 18:52:55 -09:00
}
2023-01-20 15:53:53 -09:00
export default SharePlayer