2021-01-12 21:55:54 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2022-01-26 07:14:14 +04:00
|
|
|
import {Box, CircularProgress} from '@mui/material'
|
|
|
|
|
import dynamic from 'next/dynamic'
|
2021-01-12 21:55:54 +01:00
|
|
|
|
|
|
|
|
const MIZIK_URL = process.env.NEXT_PUBLIC_OKI_MIZIK_URL || 'https://funkwhale-server.com'
|
|
|
|
|
const MIZIK_API_USER = process.env.NEXT_PUBLIC_MIZIK_API_USER || 'user'
|
|
|
|
|
const MIZIK_API_PASSWORD = process.env.NEXT_PUBLIC_MIZIK_API_PASSWORD || 'password'
|
|
|
|
|
|
2022-01-26 07:14:14 +04:00
|
|
|
const DinamikLekte = dynamic(
|
|
|
|
|
() => import('./lekte'),
|
|
|
|
|
{ssr: false, loading: () => <CircularProgress sx={{color: '#29d'}} />}
|
|
|
|
|
)
|
|
|
|
|
|
2022-05-20 02:15:56 +04:00
|
|
|
export default function OkiMizik({id, parole}) {
|
2021-01-12 21:55:54 +01:00
|
|
|
const mizikStreamUrl = `${MIZIK_URL}/rest/stream?u=${MIZIK_API_USER}&p=${MIZIK_API_PASSWORD}&id=${id}`
|
|
|
|
|
const detailsUrl = `${MIZIK_URL}/library/tracks/${id}`
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box style={{marginTop: '0.3em', display: 'flex', flexDirection: 'column', alignItems: 'center'}}>
|
2022-05-20 02:15:56 +04:00
|
|
|
<DinamikLekte audio={mizikStreamUrl} url={detailsUrl} parole={parole} />
|
2021-01-12 21:55:54 +01:00
|
|
|
</Box>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OkiMizik.propTypes = {
|
2022-01-26 07:14:14 +04:00
|
|
|
id: PropTypes.number.isRequired,
|
2022-05-20 02:15:56 +04:00
|
|
|
parole: PropTypes.object.isRequired
|
2021-01-12 21:55:54 +01:00
|
|
|
}
|