aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2026-09-05 11:00:31 -0400
committerGitHub <noreply@github.com>2026-09-05 11:00:31 -0400
commit441a05ac8827b15f261f200d4604c26ac0302be8 (patch)
treea11ab3fc89b45f7c2bdcba87640153be0568ea20 /src
parent44ecc909ff516824275b9de6d8a16d808d3c95a4 (diff)
parent8eb4964599d8dcb9b6bbd178b4794d1a69504368 (diff)
Merge pull request #17768 from Shadowghost/fix-livetv-hls-audio-codec-and-manifest-direct-play
Fix Live TV HLS playback: bogus audio encoder and unplayable direct played manifests
Diffstat (limited to 'src')
-rw-r--r--src/Jellyfin.LiveTv/TunerHosts/M3UTunerHost.cs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/Jellyfin.LiveTv/TunerHosts/M3UTunerHost.cs b/src/Jellyfin.LiveTv/TunerHosts/M3UTunerHost.cs
index fb606be0ef..902ca76af8 100644
--- a/src/Jellyfin.LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/src/Jellyfin.LiveTv/TunerHosts/M3UTunerHost.cs
@@ -32,6 +32,7 @@ namespace Jellyfin.LiveTv.TunerHosts
{
private static readonly string[] _mimeTypesCanShareHttpStream = ["video/MP2T"];
private static readonly string[] _extensionsCanShareHttpStream = [".ts", ".tsv", ".m2t"];
+ private static readonly string[] _manifestExtensions = [".m3u8", ".m3u", ".mpd"];
private readonly IHttpClientFactory _httpClientFactory;
private readonly IServerApplicationHost _appHost;
@@ -151,11 +152,20 @@ namespace Jellyfin.LiveTv.TunerHosts
var protocol = _mediaSourceManager.GetPathProtocol(path);
var isRemote = true;
- if (Uri.TryCreate(path, UriKind.Absolute, out var uri))
+ Uri.TryCreate(path, UriKind.Absolute, out var uri);
+ if (uri is not null)
{
isRemote = !_networkManager.IsInLocalNetwork(uri.Host);
}
+ // A manifest is not a byte stream. Serving one directly hands the client a playlist whose
+ // variant and segment URIs are relative to the origin, and those do not resolve against the
+ // Jellyfin url the client fetched it from. Remux or transcode these instead.
+ if (IsManifest(path, uri))
+ {
+ supportsDirectPlay = false;
+ }
+
var httpHeaders = new Dictionary<string, string>();
if (protocol == MediaProtocol.Http)
@@ -210,6 +220,20 @@ namespace Jellyfin.LiveTv.TunerHosts
return mediaSource;
}
+ /// <summary>
+ /// Determines whether a channel path points at an HLS or DASH manifest rather than at a byte stream.
+ /// </summary>
+ /// <param name="path">The channel path.</param>
+ /// <param name="uri">The channel path parsed as an absolute uri, or <c>null</c> if it is not one.</param>
+ /// <returns><c>true</c> if the path names a streaming manifest.</returns>
+ private static bool IsManifest(string path, Uri uri)
+ {
+ // Use the uri path when there is one so that a query string does not hide the extension.
+ var extension = Path.GetExtension(uri is null ? path : uri.AbsolutePath);
+
+ return _manifestExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase);
+ }
+
public Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken)
{
return Task.FromResult(new List<TunerHostInfo>());