feature/USERS #12
@@ -1,4 +1,4 @@
|
|||||||
import { API_ROOT } from './furumiApi'
|
import { furumiApi } from './furumiApi'
|
||||||
import { fmt } from './utils'
|
import { fmt } from './utils'
|
||||||
|
|
||||||
const MAX_PLAYBACK_ERROR_SKIPS = 5
|
const MAX_PLAYBACK_ERROR_SKIPS = 5
|
||||||
@@ -109,8 +109,13 @@ export function attachAudioPlayback(
|
|||||||
volSlider?.addEventListener('input', onVolInput)
|
volSlider?.addEventListener('input', onVolInput)
|
||||||
|
|
||||||
async function loadStreamForTrack(slug: string) {
|
async function loadStreamForTrack(slug: string) {
|
||||||
audio.src = `${API_ROOT}/stream/${slug}`
|
try {
|
||||||
|
const res = await furumiApi.get(`/stream/${slug}`, { responseType: 'blob' })
|
||||||
|
audio.src = URL.createObjectURL(res.data)
|
||||||
await audio.play().catch(() => { })
|
await audio.play().catch(() => { })
|
||||||
|
} catch {
|
||||||
|
// stream failed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseAndClearSource() {
|
function pauseAndClearSource() {
|
||||||
|
|||||||
Reference in New Issue
Block a user