Dynamically fetch livestream info, resolves bug where stale data caused playback to fail.
This commit is contained in:
@@ -77,13 +77,20 @@ internal sealed class SRFLiveStream : ILiveStream
|
||||
value.Id,
|
||||
_originalItemId);
|
||||
|
||||
// Get the authenticated URL from the original registration
|
||||
// Get the authenticated URL and metadata from the original registration
|
||||
var authenticatedUrl = _proxyService.GetAuthenticatedUrl(_originalItemId);
|
||||
var metadata = _proxyService.GetStreamMetadata(_originalItemId);
|
||||
if (authenticatedUrl != null)
|
||||
{
|
||||
// Register the same stream URL with the transcoding session ID
|
||||
_proxyService.RegisterStream(value.Id, authenticatedUrl);
|
||||
_logger.LogInformation("Registered stream for transcoding session ID: {LiveStreamId}", value.Id);
|
||||
// Register the same stream URL with the transcoding session ID, preserving metadata
|
||||
var urn = metadata?.Urn;
|
||||
var isLiveStream = metadata?.IsLiveStream ?? false;
|
||||
_proxyService.RegisterStream(value.Id, authenticatedUrl, urn, isLiveStream);
|
||||
_logger.LogInformation(
|
||||
"Registered stream for transcoding session ID: {LiveStreamId} (URN: {Urn}, IsLiveStream: {IsLiveStream})",
|
||||
value.Id,
|
||||
urn ?? "null",
|
||||
isLiveStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -177,18 +177,23 @@ public class SRFMediaProvider : IMediaSourceProvider
|
||||
_logger.LogDebug("Authenticated stream URL for URN: {Urn}", urn);
|
||||
}
|
||||
|
||||
// Detect if this is a live stream
|
||||
var isLiveStream = chapter.Type == "SCHEDULED_LIVESTREAM" || urn.Contains("livestream", StringComparison.OrdinalIgnoreCase);
|
||||
_logger.LogInformation(
|
||||
"Livestream detection - ChapterType: {ChapterType}, URN: {Urn}, IsLiveStream: {IsLiveStream}",
|
||||
chapter.Type,
|
||||
urn,
|
||||
isLiveStream);
|
||||
|
||||
// Register stream with proxy service
|
||||
var itemIdStr = item.Id.ToString("N"); // Use hex format without dashes
|
||||
_proxyService.RegisterStream(itemIdStr, streamUrl);
|
||||
_proxyService.RegisterStream(itemIdStr, streamUrl, urn, isLiveStream);
|
||||
|
||||
// Get the server URL for proxy - prefer configured public URL for remote clients
|
||||
var serverUrl = !string.IsNullOrWhiteSpace(config.PublicServerUrl)
|
||||
? config.PublicServerUrl.TrimEnd('/') // Use configured public URL (important for Android/remote clients)
|
||||
: _appHost.GetSmartApiUrl(string.Empty); // Fall back to Jellyfin's smart URL resolution
|
||||
|
||||
// Detect if this is a live stream
|
||||
var isLiveStream = chapter.Type == "SCHEDULED_LIVESTREAM" || urn.Contains("livestream", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// Generate an open token for this media source (used to track transcoding sessions)
|
||||
var openToken = Guid.NewGuid().ToString("N");
|
||||
_openTokenToItemId[openToken] = itemIdStr;
|
||||
|
||||
Reference in New Issue
Block a user