From 0f4d449545622b38c07f0362aef5c77641b67018 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sat, 25 Sep 2021 13:36:55 +0300 Subject: [PATCH] Skip webOS version detection for built-in browser (NetCast) as unreliable --- src/scripts/browser.js | 28 ++++++---------------------- src/scripts/browserDeviceProfile.js | 2 +- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/scripts/browser.js b/src/scripts/browser.js index d0d9b5a551..af0a72ffe4 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -117,29 +117,14 @@ function web0sVersion(browser) { if (userAgent.indexOf('netcast') !== -1) { // The built-in browser (NetCast) may have a version that doesn't correspond to the actual web engine + // Since there is no reliable way to detect webOS version, we return an undefined version - const match = /smarttv[ /]([\w.]+)/.exec(userAgent); + console.warn('Unable to detect webOS version - NetCast'); - if (match?.length > 1) { - const version = parseInt(match[1].split('.')[0], 10); - - // FIXME: Add webOS 5 and 6 - - if (version >= 10) { - return 4; - } else if (version >= 6) { - if (browser.versionMajor >= 38) { - return 3; - } else { - return 2; - } - } else if (version >= 5) { - return 1; - } - } + return undefined; } - // The next is only valid for the app, but may also work for the browser of older models + // The next is only valid for the app if (browser.versionMajor >= 79) { return 6; @@ -164,10 +149,9 @@ function web0sVersion(browser) { return 1; } - console.error('Unable to detect webOS version - assume 1'); + console.error('Unable to detect webOS version'); - // Let's assume that we have 1. - return 1; + return undefined; } let _supportsCssAnimation; diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index a8edd5cfc3..28cc0dcef0 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -387,7 +387,7 @@ import browser from './browser'; videoAudioCodecs.push('mp2'); } - let supportsDts = browser.tizen || browser.web0s || options.supportsDts || videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '') || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, ''); + let supportsDts = browser.tizen || browser.web0sVersion || options.supportsDts || 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+ (webOS 5.0+) models if (browser.tizenVersion >= 4 || browser.web0sVersion >= 5) {