fix(jellyfin): pin version playback source

This commit is contained in:
edde746
2026-05-19 20:12:19 +02:00
parent d58007a9e2
commit 0383a77b56
20 changed files with 181 additions and 19 deletions
+9 -4
View File
@@ -14,7 +14,12 @@ String? resolutionLabelFromHeight(int? height) {
return height.toString();
}
/// Convenience overload that takes width + height. Width is ignored — the
/// label is height-driven — but the signature matches earlier per-backend
/// helpers so callers don't have to drop a parameter on the floor.
String? resolutionLabelFromDimensions(int? width, int? height) => resolutionLabelFromHeight(height);
/// Convenience overload that takes width + height. Width is considered first
/// for scope-cropped files, e.g. `3840x1608` should still be labeled `4k`.
String? resolutionLabelFromDimensions(int? width, int? height) {
if ((width != null && width >= 3840) || (height != null && height >= 2160)) return '4k';
if ((width != null && width >= 1920) || (height != null && height >= 1080)) return '1080';
if ((width != null && width >= 1280) || (height != null && height >= 720)) return '720';
if ((width != null && width >= 854) || (height != null && height >= 480)) return '480';
return resolutionLabelFromHeight(height);
}
+6
View File
@@ -38,6 +38,7 @@ class WatchTogetherPlaybackNavigationException implements Exception {
/// - [preferredSubtitleTrack]: Optional subtitle track to select on playback start
/// - [selectedMediaIndex]: Optional media version index to use; if not provided,
/// loads the saved preference for the series/movie. Defaults to 0 if no preference exists.
/// - [selectedMediaSourceId]: Optional stable backend source id for the chosen version.
/// - [usePushReplacement]: If true, replaces current route instead of pushing;
/// useful for episode-to-episode navigation. Defaults to false.
/// - [isOffline]: If true, plays from downloaded content without requiring server connection.
@@ -51,6 +52,7 @@ Future<bool?> navigateToVideoPlayer(
SubtitleTrack? preferredSubtitleTrack,
SubtitleTrack? preferredSecondarySubtitleTrack,
int? selectedMediaIndex,
String? selectedMediaSourceId,
TranscodeQualityPreset? selectedQualityPreset,
bool usePushReplacement = false,
bool isOffline = false,
@@ -93,6 +95,7 @@ Future<bool?> navigateToVideoPlayer(
metadata: metadata,
client: mediaClient,
mediaIndex: mediaIndex,
mediaSourceId: selectedMediaSourceId,
);
}
@@ -120,6 +123,7 @@ Future<bool?> navigateToVideoPlayer(
preferredSubtitleTrack: preferredSubtitleTrack,
preferredSecondarySubtitleTrack: preferredSecondarySubtitleTrack,
selectedMediaIndex: mediaIndex,
selectedMediaSourceId: selectedMediaSourceId,
selectedQualityPreset: selectedQualityPreset,
isOffline: isOffline,
),
@@ -153,6 +157,7 @@ Future<bool?> navigateToVideoPlayerWithRefresh(
SubtitleTrack? preferredSubtitleTrack,
SubtitleTrack? preferredSecondarySubtitleTrack,
int? selectedMediaIndex,
String? selectedMediaSourceId,
bool usePushReplacement = false,
}) async {
final result = await navigateToVideoPlayer(
@@ -163,6 +168,7 @@ Future<bool?> navigateToVideoPlayerWithRefresh(
preferredSubtitleTrack: preferredSubtitleTrack,
preferredSecondarySubtitleTrack: preferredSecondarySubtitleTrack,
selectedMediaIndex: selectedMediaIndex,
selectedMediaSourceId: selectedMediaSourceId,
usePushReplacement: usePushReplacement,
);