Add option to limit hls segment length for webOS (#6530)
* -Add clientside ability to limit segment length to 1. See https://github.com/jellyfin/jellyfin-webos/issues/248 for details. -Add translations for this new setting (generated by github copilot). -Corrected small typo 'perfer'. * Move this to relevant scope * Revert translations except en-us * rewrite and relocate translation to alphabetical order * Relocate new setting to 'video advanced' heading instead of 'advanced' * Hide hls segment setting initially but show it for WebOS users. * Update src/components/playbackSettings/playbackSettings.js Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com> * Update src/components/playbackSettings/playbackSettings.js Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com> --------- Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
@@ -864,6 +864,7 @@ export default function (options) {
|
||||
});
|
||||
|
||||
if (canPlayHls() && options.enableHls !== false) {
|
||||
const enableLimitedSegmentLength = userSettings.limitSegmentLength();
|
||||
if (hlsInFmp4VideoCodecs.length && hlsInFmp4VideoAudioCodecs.length && enableFmp4Hls) {
|
||||
// HACK: Since there is no filter for TS/MP4 in the API, specify HLS support in general and rely on retry after DirectPlay error
|
||||
// FIXME: Need support for {Container: 'mp4', Protocol: 'hls'} or {Container: 'hls', SubContainer: 'mp4'}
|
||||
@@ -883,7 +884,8 @@ export default function (options) {
|
||||
Protocol: 'hls',
|
||||
MaxAudioChannels: physicalAudioChannels.toString(),
|
||||
MinSegments: browser.iOS || browser.osx ? '2' : '1',
|
||||
BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames
|
||||
BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames,
|
||||
SegmentLength: enableLimitedSegmentLength ? 1 : undefined
|
||||
});
|
||||
}
|
||||
|
||||
@@ -906,7 +908,8 @@ export default function (options) {
|
||||
Protocol: 'hls',
|
||||
MaxAudioChannels: physicalAudioChannels.toString(),
|
||||
MinSegments: browser.iOS || browser.osx ? '2' : '1',
|
||||
BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames
|
||||
BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames,
|
||||
SegmentLength: enableLimitedSegmentLength ? 1 : undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +152,8 @@ export class UserSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Perfer fMP4-HLS Container' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Perfer fMP4-HLS Container' or undefined.
|
||||
* Get or set 'Prefer fMP4-HLS Container' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Prefer fMP4-HLS Container' or undefined.
|
||||
* @return {boolean} 'Prefer fMP4-HLS Container' state.
|
||||
*/
|
||||
preferFmp4HlsContainer(val) {
|
||||
@@ -165,6 +165,19 @@ export class UserSettings {
|
||||
return toBoolean(this.get('preferFmp4HlsContainer', false), browser.safari || browser.firefox || browser.chrome || browser.edgeChromium);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Limit Segment Length' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Limit Segment Length' or undefined.
|
||||
* @returns {boolean} 'Limit Segment Length' state.
|
||||
*/
|
||||
limitSegmentLength(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('limitSegmentLength', val.toString(), false);
|
||||
}
|
||||
|
||||
return toBoolean(this.get('limitSegmentLength', false), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Cinema Mode' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Cinema Mode' or undefined.
|
||||
@@ -671,6 +684,7 @@ export const get = currentSettings.get.bind(currentSettings);
|
||||
export const serverConfig = currentSettings.serverConfig.bind(currentSettings);
|
||||
export const allowedAudioChannels = currentSettings.allowedAudioChannels.bind(currentSettings);
|
||||
export const preferFmp4HlsContainer = currentSettings.preferFmp4HlsContainer.bind(currentSettings);
|
||||
export const limitSegmentLength = currentSettings.limitSegmentLength.bind(currentSettings);
|
||||
export const enableCinemaMode = currentSettings.enableCinemaMode.bind(currentSettings);
|
||||
export const selectAudioNormalization = currentSettings.selectAudioNormalization.bind(currentSettings);
|
||||
export const enableNextVideoInfoOverlay = currentSettings.enableNextVideoInfoOverlay.bind(currentSettings);
|
||||
|
||||
Reference in New Issue
Block a user