fixes hls crash

This commit is contained in:
Vito0912 2025-08-06 18:59:07 +02:00
parent e510174f12
commit b47fe9e2d8
No known key found for this signature in database
GPG key ID: A0F767011D6093A2

View file

@ -302,6 +302,16 @@ class SessionController {
const user = await Database.userModel.getUserById(playbackSession.userId)
Logger.debug(`[SessionController] Serving audio track ${audioTrack.index} for session "${req.params.id}" belonging to user "${user.username}"`)
// Handle HLS streams - they have contentUrl and mimeType set but no metadata
if (!audioTrack.metadata && audioTrack.contentUrl) {
Logger.debug(`[SessionController] Redirecting to HLS stream: ${audioTrack.contentUrl}`)
if (audioTrack.mimeType) {
res.setHeader('Content-Type', audioTrack.mimeType)
}
return res.redirect(audioTrack.contentUrl)
}
// Handle regular audio files
if (global.XAccel) {
const encodedURI = encodeUriPath(global.XAccel + audioTrack.metadata.path)
Logger.debug(`Use X-Accel to serve static file ${encodedURI}`)