diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs
index 35eb233..b58074a 100644
--- a/allstarr/Controllers/JellyfinController.cs
+++ b/allstarr/Controllers/JellyfinController.cs
@@ -867,12 +867,34 @@ public class JellyfinController : ControllerBase
}
///
- /// Universal audio endpoint that redirects to the stream endpoint.
+ /// Universal audio endpoint - handles transcoding, format negotiation, and adaptive streaming.
+ /// This is the primary endpoint used by Jellyfin Web and most clients.
///
[HttpGet("Audio/{itemId}/universal")]
- public Task UniversalAudio(string itemId)
+ [HttpHead("Audio/{itemId}/universal")]
+ public async Task UniversalAudio(string itemId)
{
- return StreamAudio(itemId);
+ if (string.IsNullOrWhiteSpace(itemId))
+ {
+ return BadRequest(new { error = "Missing item ID" });
+ }
+
+ var (isExternal, provider, externalId) = _localLibraryService.ParseSongId(itemId);
+
+ if (!isExternal)
+ {
+ // For local content, proxy the universal endpoint with all query parameters
+ var fullPath = $"Audio/{itemId}/universal";
+ if (Request.QueryString.HasValue)
+ {
+ fullPath = $"{fullPath}{Request.QueryString.Value}";
+ }
+
+ return await ProxyJellyfinStream(fullPath, itemId);
+ }
+
+ // For external content, use simple streaming (no transcoding support yet)
+ return await StreamExternalContent(provider!, externalId!);
}
#endregion