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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user