mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Extract canPlayDts function
This commit is contained in:
parent
9bda84ed83
commit
58051dcd80
1 changed files with 20 additions and 6 deletions
|
@ -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;
|
||||
|
@ -530,12 +549,7 @@ export default function (options) {
|
|||
|
||||
let supportsDts = 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue