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

@ -9,9 +9,12 @@
<div class="checkboxList"> <div class="checkboxList">
<label> <label>
<input type="checkbox" is="emby-checkbox" id="chkEnableHwAcceleration" /> <input type="checkbox" is="emby-checkbox" id="chkEnableHwAcceleration" />
<span>${TrickplayHardwareAccel}</span> <span>${LabelTrickplayAccel}</span>
</label> </label>
</div> </div>
<div class="fieldDescription">
<a is="emby-linkbutton" rel="noopener noreferrer" class="button-link" href="#/dashboard/playback/transcoding">${LabelTrickplayAccelHelp}</a>
</div>
</div> </div>
<div class="inputContainer"> <div class="inputContainer">
<select is="emby-select" id="selectScanBehavior" name="Scan Behavior" label="${LabelScanBehavior}"> <select is="emby-select" id="selectScanBehavior" name="Scan Behavior" label="${LabelScanBehavior}">

View file

@ -1770,10 +1770,20 @@ export default function (view) {
if (!trickplayResolutions) return false; 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( return updateTrickplayBubbleHtml(
ServerConnections.getApiClient(item.ServerId), ServerConnections.getApiClient(item.ServerId),
trickplayResolutions[Object.keys(trickplayResolutions)[0]], trickplayResolutions[bestWidth.toString()],
item, item,
mediaSourceId, mediaSourceId,
bubble, bubble,

View file

@ -1,6 +1,8 @@
{ {
"AllowMjpegEncoding": "Allow encoding in MJPEG format (used during trickplay generation)",
"Trickplay": "Trickplay", "Trickplay": "Trickplay",
"TrickplayHardwareAccel": "Enable hardware acceleration", "LabelTrickplayAccel": "Enable hardware acceleration",
"LabelTrickplayAccelHelp": "Make sure to enable 'Allow MJPEG Encoding' in Transcoding if your hardware supports it.",
"NonBlockingScan": "Non Blocking - queues generation, then returns", "NonBlockingScan": "Non Blocking - queues generation, then returns",
"BlockingScan": "Blocking - queues generation, blocks scan until complete", "BlockingScan": "Blocking - queues generation, blocks scan until complete",
"LabelScanBehavior": "Scan Behavior", "LabelScanBehavior": "Scan Behavior",
@ -25,7 +27,7 @@
"LabelQscale": "Qscale", "LabelQscale": "Qscale",
"LabelQscaleHelp": "The quality scale of images output by ffmpeg, with 2 being the highest quality and 31 being the lowest.", "LabelQscaleHelp": "The quality scale of images output by ffmpeg, with 2 being the highest quality and 31 being the lowest.",
"LabelTrickplayThreads": "FFmpeg Threads", "LabelTrickplayThreads": "FFmpeg Threads",
"LabelTrickplayThreadsHelp": "The number of threads to pass to the \"-threads\" argument of ffmpeg.", "LabelTrickplayThreadsHelp": "The number of threads to pass to the '-threads' argument of ffmpeg.",
"OptionExtractTrickplayImage": "Enable trickplay image extraction", "OptionExtractTrickplayImage": "Enable trickplay image extraction",
"ExtractTrickplayImagesHelp": "Trickplay images are similar to chapter images, except they span the entire length of the content and are used to show a preview when scrubbing through videos.", "ExtractTrickplayImagesHelp": "Trickplay images are similar to chapter images, except they span the entire length of the content and are used to show a preview when scrubbing through videos.",
"LabelExtractTrickplayDuringLibraryScan": "Extract trickplay images during the library scan", "LabelExtractTrickplayDuringLibraryScan": "Extract trickplay images during the library scan",