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:
parent
8045b95d93
commit
7877a43482
3 changed files with 20 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue