proxy audio (#121)
This commit is contained in:
parent
cd83807204
commit
d7184ddc9e
|
@ -49,7 +49,7 @@
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
background: var(--placeholder-color-semi) url('icons/create-music.svg') no-repeat 50% 50%;
|
background: var(--placeholder-color-semi) url('../../icons/create-music.svg') no-repeat 50% 50%;
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { PlayerHeader } from './PlayerHeader'
|
||||||
import { PlayerPlaylist } from './PlayerPlaylist'
|
import { PlayerPlaylist } from './PlayerPlaylist'
|
||||||
import styles from './AudioPlayer.module.scss'
|
import styles from './AudioPlayer.module.scss'
|
||||||
import { MediaItem } from '../../../pages/types'
|
import { MediaItem } from '../../../pages/types'
|
||||||
|
import { audioProxy } from '../../../utils/imageProxy'
|
||||||
|
|
||||||
export type Audio = {
|
export type Audio = {
|
||||||
pic?: string
|
pic?: string
|
||||||
|
@ -22,6 +23,7 @@ type Props = {
|
||||||
const prepareMedia = (media: Audio[]) =>
|
const prepareMedia = (media: Audio[]) =>
|
||||||
media.map((item, index) => ({
|
media.map((item, index) => ({
|
||||||
...item,
|
...item,
|
||||||
|
url: audioProxy(item.url),
|
||||||
index: index,
|
index: index,
|
||||||
isCurrent: false,
|
isCurrent: false,
|
||||||
isPlaying: false
|
isPlaying: false
|
||||||
|
@ -67,7 +69,6 @@ export const AudioPlayer = (props: Props) => {
|
||||||
isCurrent: index === 0
|
isCurrent: index === 0
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
return tracks()[0]
|
return tracks()[0]
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createEffect, createSignal, For, Show } from 'solid-js'
|
import { createSignal, For, Show } from 'solid-js'
|
||||||
import { SharePopup, getShareUrl } from '../SharePopup'
|
import { SharePopup, getShareUrl } from '../SharePopup'
|
||||||
import { getDescription } from '../../../utils/meta'
|
import { getDescription } from '../../../utils/meta'
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
|
|
|
@ -230,18 +230,20 @@ export const EditView = (props: Props) => {
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t('Artist...')}
|
placeholder={t('Artist...')}
|
||||||
class={styles.additionalInput}
|
class={styles.additionalInput}
|
||||||
value={mediaItems()[0]?.artist || t('Artist')}
|
value={mediaItems()[0]?.artist || ''}
|
||||||
onChange={(event) => handleBaseFieldsChange('artist', event.target.value)}
|
onChange={(event) => handleBaseFieldsChange('artist', event.target.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
class={styles.additionalInput}
|
class={styles.additionalInput}
|
||||||
placeholder={t('Release date...')}
|
placeholder={t('Release date...')}
|
||||||
|
value={mediaItems()[0]?.date || ''}
|
||||||
onChange={(event) => handleBaseFieldsChange('date', event.target.value)}
|
onChange={(event) => handleBaseFieldsChange('date', event.target.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t('Genre...')}
|
placeholder={t('Genre...')}
|
||||||
class={styles.additionalInput}
|
class={styles.additionalInput}
|
||||||
|
value={mediaItems()[0]?.genre || ''}
|
||||||
onChange={(event) => handleBaseFieldsChange('genre', event.target.value)}
|
onChange={(event) => handleBaseFieldsChange('genre', event.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,3 +2,7 @@ import { isDev } from './config'
|
||||||
export const imageProxy = (url: string) => {
|
export const imageProxy = (url: string) => {
|
||||||
return `${isDev ? 'https://new.discours.io' : ''}/api/image?url=${encodeURI(url)}`
|
return `${isDev ? 'https://new.discours.io' : ''}/api/image?url=${encodeURI(url)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const audioProxy = (url: string) => {
|
||||||
|
return `${isDev ? 'https://new.discours.io' : ''}/api/audio?url=${encodeURI(url)}`
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user