The Free Software Media System - Server Backend & API
Fix live tv hls playback
crobiberofe8531f74e11
diff --git a/Jellyfin.Api/Controllers/HlsSegmentController.cs b/Jellyfin.Api/Controllers/HlsSegmentController.csindex 3b75e8d431..f6359f8e4a 100644--- a/Jellyfin.Api/Controllers/HlsSegmentController.cs+++ b/Jellyfin.Api/Controllers/HlsSegmentController.cs@@ -132,13 +132,25 @@ namespace Jellyfin.Api.Controllersvar normalizedPlaylistId = playlistId;- var playlistPath = _fileSystem.GetFilePaths(transcodeFolderPath)- .FirstOrDefault(i =>- string.Equals(Path.GetExtension(i), ".m3u8", StringComparison.OrdinalIgnoreCase)- && i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1)- ?? throw new ResourceNotFoundException($"Provided path ({transcodeFolderPath}) is not valid.");+ var filePaths = _fileSystem.GetFilePaths(transcodeFolderPath);+ // Add . to start of segment container for future use.+ segmentContainer = segmentContainer.Insert(0, ".");+ string? playlistPath = null;+ foreach (var path in filePaths)+ {+ var pathExtension = Path.GetExtension(path);+ if ((string.Equals(pathExtension, segmentContainer, StringComparison.OrdinalIgnoreCase)+ || string.Equals(pathExtension, ".m3u8", StringComparison.OrdinalIgnoreCase))+ && path.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1)+ {+ playlistPath = path;+ break;+ }+ }- return GetFileResult(file, playlistPath);+ return playlistPath == null+ ? NotFound("Hls segment not found.")+ : GetFileResult(file, playlistPath);}private ActionResult GetFileResult(string path, string playlistPath)