1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Handle different trickplay resolutions

This commit is contained in:
Nick 2024-02-11 22:26:49 -08:00
parent 8045b95d93
commit 7877a43482
3 changed files with 20 additions and 5 deletions

View file

@ -1770,10 +1770,20 @@ export default function (view) {
if (!trickplayResolutions) return false;
// TODO: just to test. must pick proper resolution and/or check above that trickplay resolutions has at least one key.
// Prefer highest resolution <= 20% of total screen resolution width
let bestWidth;
const maxWidth = window.screen.width * window.devicePixelRatio * 0.2;
for (const [, info] of Object.entries(trickplayResolutions)) {
if (!bestWidth
|| (info.Width < bestWidth && bestWidth > maxWidth) // Objects not guaranteed to be sorted in any order, first width might be > maxWidth.
|| (info.Width > bestWidth && info.Width <= maxWidth)) bestWidth = info.Width;
}
if (!bestWidth) return false;
return updateTrickplayBubbleHtml(
ServerConnections.getApiClient(item.ServerId),
trickplayResolutions[Object.keys(trickplayResolutions)[0]],
trickplayResolutions[bestWidth.toString()],
item,
mediaSourceId,
bubble,