From c54db604d9426f3b3d46222c9161b88aa210d4da Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Sat, 5 Oct 2024 08:47:03 +0300 Subject: [PATCH 1/5] Fix LiveTV Playback --- src/components/playback/playbackmanager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index e90aff609f..f19bb51e53 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2573,8 +2573,8 @@ export class PlaybackManager { } const apiClient = ServerConnections.getApiClient(item.ServerId); - const mediaSourceId = playOptions.mediaSourceId || item.Id; - const getMediaStreams = apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId) + const mediaSourceId = playOptions.mediaSourceId; + const getMediaStreams = apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id) .then(fullItem => { return fullItem.MediaStreams; }); From 95e23875f4e2761a8ed65d73dd5b94977e0d0d79 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:56:06 +0300 Subject: [PATCH 2/5] Only specify mediaSourceId if index changed --- src/components/playback/playbackmanager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index f19bb51e53..3dfa961856 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2573,7 +2573,7 @@ export class PlaybackManager { } const apiClient = ServerConnections.getApiClient(item.ServerId); - const mediaSourceId = playOptions.mediaSourceId; + let mediaSourceId = playOptions.mediaSourceId; const getMediaStreams = apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id) .then(fullItem => { return fullItem.MediaStreams; @@ -2611,9 +2611,11 @@ export class PlaybackManager { autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections); if (trackOptions.DefaultAudioStreamIndex != null) { options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex; + mediaSourceId = mediaSourceId || item.Id; } if (trackOptions.DefaultSubtitleStreamIndex != null) { options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex; + mediaSourceId = mediaSourceId || item.Id; } return getPlaybackMediaSource(player, apiClient, deviceProfile, item, mediaSourceId, options).then(async (mediaSource) => { From ca4763512f4a4e2a73e37600a5dc520f917c2274 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:58:02 +0300 Subject: [PATCH 3/5] Explicitly check for Live TV --- src/components/playback/playbackmanager.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 3dfa961856..c85b2fd579 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -22,6 +22,7 @@ import { MediaType } from '@jellyfin/sdk/lib/generated-client/models/media-type' import { MediaError } from 'types/mediaError'; import { getMediaError } from 'utils/mediaError'; +import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/index.js'; const UNLIMITED_ITEMS = -1; @@ -2573,8 +2574,15 @@ export class PlaybackManager { } const apiClient = ServerConnections.getApiClient(item.ServerId); - let mediaSourceId = playOptions.mediaSourceId; - const getMediaStreams = apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id) + let mediaSourceId; + + const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.Channel, BaseItemKind.LiveTvChannel].includes(item.Type); + + if (!isLiveTv) { + mediaSourceId = playOptions.mediaSourceId || item.Id; + } + + const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId) .then(fullItem => { return fullItem.MediaStreams; }); @@ -2611,11 +2619,9 @@ export class PlaybackManager { autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections); if (trackOptions.DefaultAudioStreamIndex != null) { options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex; - mediaSourceId = mediaSourceId || item.Id; } if (trackOptions.DefaultSubtitleStreamIndex != null) { options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex; - mediaSourceId = mediaSourceId || item.Id; } return getPlaybackMediaSource(player, apiClient, deviceProfile, item, mediaSourceId, options).then(async (mediaSource) => { From c2c5228c06a55a8b946de5741d4f9e1c30f1c837 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:27:46 +0300 Subject: [PATCH 4/5] Update playbackmanager.js Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com> --- src/components/playback/playbackmanager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index c85b2fd579..ffec28ab6b 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -22,7 +22,7 @@ import { MediaType } from '@jellyfin/sdk/lib/generated-client/models/media-type' import { MediaError } from 'types/mediaError'; import { getMediaError } from 'utils/mediaError'; -import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/index.js'; +import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind.js'; const UNLIMITED_ITEMS = -1; From 07316cf870948483bd740a147b222282d2ab4818 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:19:38 +0300 Subject: [PATCH 5/5] Update playbackmanager.js Co-authored-by: Bill Thornton --- src/components/playback/playbackmanager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index ffec28ab6b..a036008033 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2576,7 +2576,7 @@ export class PlaybackManager { const apiClient = ServerConnections.getApiClient(item.ServerId); let mediaSourceId; - const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.Channel, BaseItemKind.LiveTvChannel].includes(item.Type); + const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type); if (!isLiveTv) { mediaSourceId = playOptions.mediaSourceId || item.Id;