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

Add option to limit maximum supported video resolution

This commit is contained in:
Dmitry Lyzo 2024-03-24 23:23:28 +03:00
parent 2097c526d2
commit 6e6b696bd9
5 changed files with 40 additions and 6 deletions

View file

@ -45,18 +45,27 @@ function getDeviceProfile(item) {
const maxTranscodingVideoWidth = maxVideoWidth < 0 ? appHost.screen()?.maxAllowedWidth : maxVideoWidth;
if (maxTranscodingVideoWidth) {
const conditionWidth = {
Condition: 'LessThanEqual',
Property: 'Width',
Value: maxTranscodingVideoWidth.toString(),
IsRequired: false
};
if (appSettings.limitSupportedVideoResolution()) {
profile.CodecProfiles.push({
Type: 'Video',
Conditions: [conditionWidth]
});
}
profile.TranscodingProfiles.forEach((transcodingProfile) => {
if (transcodingProfile.Type === 'Video') {
transcodingProfile.Conditions = (transcodingProfile.Conditions || []).filter((condition) => {
return condition.Property !== 'Width';
});
transcodingProfile.Conditions.push({
Condition: 'LessThanEqual',
Property: 'Width',
Value: maxTranscodingVideoWidth.toString(),
IsRequired: false
});
transcodingProfile.Conditions.push(conditionWidth);
}
});
}

View file

@ -179,6 +179,7 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
context.querySelector('.chkRememberAudioSelections').checked = user.Configuration.RememberAudioSelections || false;
context.querySelector('.chkRememberSubtitleSelections').checked = user.Configuration.RememberSubtitleSelections || false;
context.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableSystemExternalPlayers();
context.querySelector('.chkLimitSupportedVideoResolution').checked = appSettings.limitSupportedVideoResolution();
setMaxBitrateIntoField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateIntoField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
@ -213,6 +214,7 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
appSettings.maxChromecastBitrate(context.querySelector('.selectChromecastVideoQuality').value);
appSettings.maxVideoWidth(context.querySelector('.selectMaxVideoWidth').value);
appSettings.limitSupportedVideoResolution(context.querySelector('.chkLimitSupportedVideoResolution').checked);
setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');

View file

@ -54,6 +54,14 @@
<option value="7680">8K</option>
</select>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" class="chkLimitSupportedVideoResolution" />
<span>${LimitSupportedVideoResolution}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${LimitSupportedVideoResolutionHelp}</div>
</div>
</div>
<div class="verticalSection verticalSection-extrabottompadding musicQualitySection hide">

View file

@ -105,6 +105,19 @@ class AppSettings {
return parseInt(this.get('maxVideoWidth') || '0', 10) || 0;
}
/**
* Get or set 'Limit maximum supported video resolution' state.
* @param {boolean|undefined} val - Flag to enable 'Limit maximum supported video resolution' or undefined.
* @return {boolean} 'Limit maximum supported video resolution' state.
*/
limitSupportedVideoResolution(val) {
if (val !== undefined) {
return this.set('limitSupportedVideoResolution', val.toString());
}
return toBoolean(this.get('limitSupportedVideoResolution'), false);
}
set(name, value, userId) {
const currentValue = this.get(name, userId);
localStorage.setItem(this.#getKey(name, userId), value);

View file

@ -935,6 +935,8 @@
"LearnHowYouCanContribute": "Learn how you can contribute.",
"LeaveBlankToNotSetAPassword": "You can leave this field blank to set no password.",
"LibraryAccessHelp": "Select the libraries to share with this user. Administrators will be able to edit all folders using the metadata manager.",
"LimitSupportedVideoResolution": "Limit maximum supported video resolution",
"LimitSupportedVideoResolutionHelp": "Use 'Maximum Allowed Video Transcoding Resolution' as maximum supported video resolution.",
"List": "List",
"ListView": "List View",
"ListPaging": "{0}-{1} of {2}",