diff --git a/src/components/playbackSettings/playbackSettings.js b/src/components/playbackSettings/playbackSettings.js
index 254389a9f6..6717c66613 100644
--- a/src/components/playbackSettings/playbackSettings.js
+++ b/src/components/playbackSettings/playbackSettings.js
@@ -173,6 +173,8 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
context.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
context.querySelector('.chkPreferFmp4HlsContainer').checked = userSettings.preferFmp4HlsContainer();
+ context.querySelector('.chkEnableDts').checked = appSettings.enableDts();
+ context.querySelector('.chkEnableTrueHd').checked = appSettings.enableTrueHd();
context.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
context.querySelector('#selectAudioNormalization').value = userSettings.selectAudioNormalization();
context.querySelector('.chkEnableNextVideoOverlay').checked = userSettings.enableNextVideoInfoOverlay();
@@ -216,6 +218,9 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
appSettings.maxVideoWidth(context.querySelector('.selectMaxVideoWidth').value);
appSettings.limitSupportedVideoResolution(context.querySelector('.chkLimitSupportedVideoResolution').checked);
+ appSettings.enableDts(context.querySelector('.chkEnableDts').checked);
+ appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked);
+
setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
setMaxBitrateFromField(context.querySelector('.selectMusicInternetQuality'), false, 'Audio');
diff --git a/src/components/playbackSettings/playbackSettings.template.html b/src/components/playbackSettings/playbackSettings.template.html
index 6dc860260f..eb416687d7 100644
--- a/src/components/playbackSettings/playbackSettings.template.html
+++ b/src/components/playbackSettings/playbackSettings.template.html
@@ -159,6 +159,28 @@
+
+
diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js
index dce9a02cb4..542b535f88 100644
--- a/src/scripts/browserDeviceProfile.js
+++ b/src/scripts/browserDeviceProfile.js
@@ -94,6 +94,25 @@ function supportsAc3(videoTestElement) {
return videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/, '');
}
+/**
+ * Checks if the device supports DTS (DCA).
+ * @param {HTMLVideoElement} videoTestElement The video test element
+ * @returns {boolean|null} _true_ if the device supports DTS (DCA). _false_ if the device doesn't support DTS (DCA). _null_ if support status is unknown.
+ */
+function canPlayDts(videoTestElement) {
+ // DTS audio is not supported by Samsung TV 2018+ (Tizen 4.0+) and LG TV 2020-2022 (webOS 5.0, 6.0 and 22) models
+ if (browser.tizenVersion >= 4 || (browser.web0sVersion >= 5 && browser.web0sVersion < 23)) {
+ return false;
+ }
+
+ if (videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '')
+ || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '')) {
+ return true;
+ }
+
+ return null;
+}
+
function supportsEac3(videoTestElement) {
if (browser.tizen || browser.web0s) {
return true;
@@ -528,14 +547,9 @@ export default function (options) {
hlsInFmp4VideoAudioCodecs.push('mp2');
}
- let supportsDts = options.supportsDts;
+ let supportsDts = appSettings.enableDts() || options.supportsDts;
if (supportsDts == null) {
- supportsDts = browser.tizen || browser.web0sVersion || videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '') || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '');
-
- // DTS audio is not supported by Samsung TV 2018+ (Tizen 4.0+) and LG TV 2020-2022 (webOS 5.0, 6.0 and 22) models
- if (browser.tizenVersion >= 4 || (browser.web0sVersion >= 5 && browser.web0sVersion < 23)) {
- supportsDts = false;
- }
+ supportsDts = canPlayDts(videoTestElement);
}
if (supportsDts) {
@@ -548,7 +562,7 @@ export default function (options) {
videoAudioCodecs.push('pcm_s24le');
}
- if (options.supportsTrueHd) {
+ if (appSettings.enableTrueHd() || options.supportsTrueHd) {
videoAudioCodecs.push('truehd');
}
diff --git a/src/scripts/settings/appSettings.js b/src/scripts/settings/appSettings.js
index 4d96c1eed6..83d4d6879c 100644
--- a/src/scripts/settings/appSettings.js
+++ b/src/scripts/settings/appSettings.js
@@ -132,6 +132,32 @@ class AppSettings {
return toBoolean(this.get('limitSupportedVideoResolution'), false);
}
+ /**
+ * Get or set 'Enable DTS' state.
+ * @param {boolean|undefined} val - Flag to enable 'Enable DTS' or undefined.
+ * @return {boolean} 'Enable DTS' state.
+ */
+ enableDts(val) {
+ if (val !== undefined) {
+ return this.set('enableDts', val.toString());
+ }
+
+ return toBoolean(this.get('enableDts'), false);
+ }
+
+ /**
+ * Get or set 'Enable TrueHD' state.
+ * @param {boolean|undefined} val - Flag to enable 'Enable TrueHD' or undefined.
+ * @return {boolean} 'Enable TrueHD' state.
+ */
+ enableTrueHd(val) {
+ if (val !== undefined) {
+ return this.set('enableTrueHd', val.toString());
+ }
+
+ return toBoolean(this.get('enableTrueHd'), false);
+ }
+
set(name, value, userId) {
const currentValue = this.get(name, userId);
localStorage.setItem(this.#getKey(name, userId), value);
diff --git a/src/strings/en-us.json b/src/strings/en-us.json
index 7ac237d099..b09c51f47f 100644
--- a/src/strings/en-us.json
+++ b/src/strings/en-us.json
@@ -246,6 +246,8 @@
"EnableDetailsBanner": "Details Banner",
"EnableDetailsBannerHelp": "Display a banner image at the top of the item details page.",
"EnableDisplayMirroring": "Display mirroring",
+ "EnableDts": "Enable DTS (DCA)",
+ "EnableDtsHelp": "Only enable if your device supports DTS or is connected to a compatible audio receiver, otherwise it may cause playback failure.",
"EnableExternalVideoPlayers": "External video players",
"EnableExternalVideoPlayersHelp": "An external player menu will be shown when starting video playback.",
"EnableFasterAnimations": "Faster animations",
@@ -267,6 +269,8 @@
"EnableThemeSongsHelp": "Play the theme songs in background while browsing the library.",
"EnableThemeVideosHelp": "Play theme videos in the background while browsing the library.",
"EnableTonemapping": "Enable Tone mapping",
+ "EnableTrueHd": "Enable TrueHD",
+ "EnableTrueHdHelp": "Only enable if your device supports TrueHD or is connected to a compatible audio receiver, otherwise it may cause playback failure.",
"EncoderPresetHelp": "Pick a faster value to improve performance, or a slower value to improve quality.",
"Ended": "Ended",
"EndsAtValue": "Ends at {0}",
@@ -501,6 +505,7 @@
"HeaderUploadSubtitle": "Upload Subtitle",
"HeaderUser": "User",
"HeaderUsers": "Users",
+ "HeaderVideoAdvanced": "Video Advanced",
"HeaderVideoQuality": "Video Quality",
"HeaderVideos": "Videos",
"HeaderVideoType": "Video Type",