Skip to content

Commit

Permalink
fix(FEC-9118): External caption doesn't display (#243)
Browse files Browse the repository at this point in the history
UA of webos v.2 is fake to safari, added check for mac os to prevent this fake.
LG check is added to UAParser.
  • Loading branch information
Yuvalke authored Jun 11, 2019
1 parent 6f17d2a commit 59368a3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/common/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function checkNativeHlsSupport(options: KPOptionsObject): void {
* @returns {void}
*/
function checkNativeTextTracksSupport(options: KPOptionsObject): void {
if (isSafari() || isIos()) {
if ((isMacOS() && isSafari()) || isIos()) {
const useNativeTextTrack = Utils.Object.getPropertyPath(options, 'playback.useNativeTextTrack');
if (typeof useNativeTextTrack !== 'boolean') {
Utils.Object.mergeDeep(options, {
Expand Down Expand Up @@ -433,6 +433,15 @@ function isSafari(): boolean {
return Utils.Object.hasPropertyPath(Env, 'browser.name') && Env.browser.name.includes('Safari');
}
/**
* Returns true if user agent indicate that os is mac
* @private
* @returns {boolean} - if browser is Safari
*/
function isMacOS(): boolean {
return Env.os.name.toLowerCase() === 'Mac OS';
}
/**
* Returns true if user agent indicate that browser is Chrome on iOS
* @private
Expand All @@ -448,7 +457,7 @@ function isIos(): boolean {
* @returns {boolean} - if browser is in LG TV
*/
function isLGTV(): boolean {
return /^(?=.*\bweb0s\b)(?=.*\bsmarttv\b).*$/i.test(Env.ua);
return Env.os.name.toLowerCase() === 'web0s';
}
/**
Expand Down

0 comments on commit 59368a3

Please sign in to comment.