Fix issue with Jellyfin using local IP adress not server public URL, now pulic URL is set in plugin.
🏗️ Build Plugin / build (push) Successful in 3m21s
🧪 Test Plugin / test (push) Successful in 1m36s
🚀 Release Plugin / build-and-release (push) Successful in 3m9s

This commit is contained in:
2025-11-21 20:17:05 +01:00
parent e26f2a2ab1
commit b8ac466c90
6 changed files with 65 additions and 13 deletions
@@ -53,7 +53,13 @@ public class StreamProxyController : ControllerBase
try
{
// Build the base proxy URL for this item (use original itemId from path to maintain URL structure)
var baseProxyUrl = $"{Request.Scheme}://{Request.Host}/Plugins/SRFPlay/Proxy/{itemId}";
// Always include the actualItemId as a query parameter to ensure proper resolution during transcoding
var baseProxyUrl = $"{Request.Scheme}://{Request.Host}/Plugins/SRFPlay/Proxy/{itemId}?itemId={actualItemId}";
if (actualItemId != itemId)
{
_logger.LogDebug("Path itemId {PathId} differs from resolved itemId {ResolvedId}, adding query parameter", itemId, actualItemId);
}
var manifestContent = await _proxyService.GetRewrittenManifestAsync(actualItemId, baseProxyUrl, cancellationToken).ConfigureAwait(false);
@@ -179,7 +185,9 @@ public class StreamProxyController : ControllerBase
return queryItemId.ToString();
}
// Use the path item ID as-is
// If path ID and query ID don't match, it's likely a transcoding session
// Try to use the proxy service fallback to find the correct stream
_logger.LogDebug("No itemId query parameter found, using path ID as-is: {PathItemId}", pathItemId);
return pathItemId;
}
@@ -191,6 +199,11 @@ public class StreamProxyController : ControllerBase
/// <returns>The rewritten manifest.</returns>
private string RewriteSegmentUrls(string manifestContent, string baseProxyUrl)
{
// Extract the itemId query parameter from the current request to propagate it
var itemIdParam = Request.Query.TryGetValue("itemId", out var itemId) && !string.IsNullOrEmpty(itemId)
? $"?itemId={itemId}"
: string.Empty;
var lines = manifestContent.Split('\n');
var result = new System.Text.StringBuilder();
@@ -207,12 +220,12 @@ public class StreamProxyController : ControllerBase
var uri = new Uri(line.Trim());
var segments = uri.AbsolutePath.Split('/');
var fileName = segments[^1];
result.AppendLine(CultureInfo.InvariantCulture, $"{baseProxyUrl}/{fileName}");
result.AppendLine(CultureInfo.InvariantCulture, $"{baseProxyUrl}/{fileName}{itemIdParam}");
}
else
{
// Relative URL - rewrite to proxy
result.AppendLine(CultureInfo.InvariantCulture, $"{baseProxyUrl}/{line.Trim()}");
result.AppendLine(CultureInfo.InvariantCulture, $"{baseProxyUrl}/{line.Trim()}{itemIdParam}");
}
}