mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Only set trickplay data on new item info
This commit is contained in:
parent
dad1da94d3
commit
44602d453e
1 changed files with 22 additions and 19 deletions
|
@ -146,6 +146,24 @@ export default function (view) {
|
||||||
btnUserRating.classList.add('hide');
|
btnUserRating.classList.add('hide');
|
||||||
btnUserRating.setItem(null);
|
btnUserRating.setItem(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update trickplay data
|
||||||
|
trickplayResolution = null;
|
||||||
|
|
||||||
|
const mediaSourceId = currentPlayer.streamInfo.mediaSource.Id;
|
||||||
|
let trickplayResolutions;
|
||||||
|
if (item.Trickplay && (trickplayResolutions = item.Trickplay[mediaSourceId])) {
|
||||||
|
// 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) trickplayResolution = trickplayResolutions[bestWidth];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayTimeWithoutAmPm(date, showSeconds) {
|
function getDisplayTimeWithoutAmPm(date, showSeconds) {
|
||||||
|
@ -1530,6 +1548,7 @@ export default function (view) {
|
||||||
let programEndDateMs = 0;
|
let programEndDateMs = 0;
|
||||||
let playbackStartTimeTicks = 0;
|
let playbackStartTimeTicks = 0;
|
||||||
let subtitleSyncOverlay;
|
let subtitleSyncOverlay;
|
||||||
|
let trickplayResolution = null;
|
||||||
const nowPlayingVolumeSlider = view.querySelector('.osdVolumeSlider');
|
const nowPlayingVolumeSlider = view.querySelector('.osdVolumeSlider');
|
||||||
const nowPlayingVolumeSliderContainer = view.querySelector('.osdVolumeSliderContainer');
|
const nowPlayingVolumeSliderContainer = view.querySelector('.osdVolumeSliderContainer');
|
||||||
const nowPlayingPositionSlider = view.querySelector('.osdPositionSlider');
|
const nowPlayingPositionSlider = view.querySelector('.osdPositionSlider');
|
||||||
|
@ -1764,28 +1783,12 @@ export default function (view) {
|
||||||
ticks /= 100;
|
ticks /= 100;
|
||||||
ticks *= value;
|
ticks *= value;
|
||||||
|
|
||||||
if (item?.Trickplay) {
|
if (trickplayResolution && item?.Trickplay) {
|
||||||
const mediaSourceId = currentPlayer?.streamInfo?.mediaSource?.Id;
|
|
||||||
const trickplayResolutions = item.Trickplay[mediaSourceId];
|
|
||||||
|
|
||||||
if (!trickplayResolutions) return false;
|
|
||||||
|
|
||||||
// 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(
|
return updateTrickplayBubbleHtml(
|
||||||
ServerConnections.getApiClient(item.ServerId),
|
ServerConnections.getApiClient(item.ServerId),
|
||||||
trickplayResolutions[bestWidth.toString()],
|
trickplayResolution,
|
||||||
item,
|
item,
|
||||||
mediaSourceId,
|
currentPlayer.streamInfo.mediaSource.Id,
|
||||||
bubble,
|
bubble,
|
||||||
ticks);
|
ticks);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue