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