Fixes for Livestreams
This commit is contained in:
@@ -373,6 +373,15 @@ public class StreamProxyService : IStreamProxyService
|
||||
return refreshedUrl;
|
||||
}
|
||||
|
||||
if (streamInfo.IsLiveStream)
|
||||
{
|
||||
// For livestreams, keep the mapping and flag for re-authentication
|
||||
// rather than removing it — the next request will trigger a fresh auth
|
||||
_logger.LogWarning("Failed to refresh token for livestream {ItemId}, will re-authenticate on next request", itemId);
|
||||
streamInfo.NeedsAuthentication = true;
|
||||
return streamInfo.AuthenticatedUrl;
|
||||
}
|
||||
|
||||
_logger.LogWarning("Failed to refresh token for item {ItemId}, removing mapping", itemId);
|
||||
_streamMappings.TryRemove(itemId, out _);
|
||||
return null;
|
||||
@@ -979,8 +988,9 @@ public class StreamProxyService : IStreamProxyService
|
||||
_logger.LogDebug("Marking item {ItemId} for cleanup (old registration)", kvp.Key);
|
||||
}
|
||||
|
||||
// Remove if token has expired
|
||||
if (kvp.Value.TokenExpiresAt.HasValue && kvp.Value.TokenExpiresAt.Value <= now)
|
||||
// Remove if token has expired — but skip livestreams since their CDN tokens
|
||||
// expire every ~30s and get refreshed on-demand during playback
|
||||
if (kvp.Value.TokenExpiresAt.HasValue && kvp.Value.TokenExpiresAt.Value <= now && !kvp.Value.IsLiveStream)
|
||||
{
|
||||
shouldRemove = true;
|
||||
_logger.LogDebug("Marking item {ItemId} for cleanup (expired token)", kvp.Key);
|
||||
|
||||
Reference in New Issue
Block a user