Fix HLS playback auth + add DNB matching source

Player: hls.js did not send Authorization header for segment requests,
causing 401 errors on all HLS fetches. Fixed via xhrSetup callback.

DNB: Added Deutsche Nationalbibliothek SRU search (mat=ton filter for
audiobooks, MARC21-XML parsing). Extracts title, author, narrator,
publisher, year, series, genres, ISBN-based cover URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Audiolib
2026-05-26 17:37:26 +02:00
parent 3aab0ac9f1
commit eefdfc9886
3 changed files with 157 additions and 3 deletions

View File

@@ -38,7 +38,13 @@ export default function AudioPlayer() {
const audio = audioRef.current
if (Hls.isSupported()) {
const hls = new Hls({ startPosition: session.currentTime || 0 })
const token = localStorage.getItem('token')
const hls = new Hls({
startPosition: session.currentTime || 0,
xhrSetup: (xhr: XMLHttpRequest) => {
if (token) xhr.setRequestHeader('Authorization', `Bearer ${token}`)
},
})
hls.loadSource(hlsUrl)
hls.attachMedia(audio)
hlsRef.current = hls