Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable smooth codec switch on webOS 6 #7636

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ shaka.util.Platform = class {
shaka.util.Platform.chromeVersion() === 68;
}

/**
* Check if the current platform is a WebOS 6.
*
* @return {boolean}
*/
static isWebOS6() {
// See: https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine#useragent-string
return shaka.util.Platform.isWebOS() &&
shaka.util.Platform.chromeVersion() === 79;
}

/**
* Check if the current platform is a Google Chromecast.
*
Expand Down Expand Up @@ -652,7 +663,9 @@ shaka.util.Platform = class {
static supportsSmoothCodecSwitching() {
const Platform = shaka.util.Platform;
// All Tizen versions (up to Tizen 8) do not support SMOOTH so far.
avelad marked this conversation as resolved.
Show resolved Hide resolved
if (Platform.isTizen() || Platform.isPS4() || Platform.isPS5()) {
// webOS seems to support SMOOTH from webOS 22.
if (Platform.isTizen() || Platform.isPS4() || Platform.isPS5() ||
Platform.isWebOS6()) {
return false;
}
// Older chromecasts without GoogleTV seem to not support SMOOTH properly.
Expand Down
20 changes: 20 additions & 0 deletions test/util/platform_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Platform', () => {
const webOs3 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager';
const webOs4 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36 WebAppManager';
const webOs5 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager';
const webOs6 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 WebAppManager';
/* eslint-enable max-len */

afterEach(() => {
Expand Down Expand Up @@ -79,6 +80,8 @@ describe('Platform', () => {
expect(shaka.util.Platform.isWebOS3()).toBe(false);
setUserAgent(webOs5);
expect(shaka.util.Platform.isWebOS3()).toBe(false);
setUserAgent(webOs6);
expect(shaka.util.Platform.isWebOS3()).toBe(false);
});

it('checks is webOS 4', () => {
Expand All @@ -90,6 +93,8 @@ describe('Platform', () => {
expect(shaka.util.Platform.isWebOS4()).toBe(true);
setUserAgent(webOs5);
expect(shaka.util.Platform.isWebOS4()).toBe(false);
setUserAgent(webOs6);
expect(shaka.util.Platform.isWebOS4()).toBe(false);
});

it('checks is webOS 5', () => {
Expand All @@ -101,6 +106,21 @@ describe('Platform', () => {
expect(shaka.util.Platform.isWebOS5()).toBe(false);
setUserAgent(webOs5);
expect(shaka.util.Platform.isWebOS5()).toBe(true);
setUserAgent(webOs6);
expect(shaka.util.Platform.isWebOS5()).toBe(false);
});

it('checks is webOS 6', () => {
setUserAgent(tizen50);
expect(shaka.util.Platform.isWebOS6()).toBe(false);
setUserAgent(webOs3);
expect(shaka.util.Platform.isWebOS6()).toBe(false);
setUserAgent(webOs4);
expect(shaka.util.Platform.isWebOS6()).toBe(false);
setUserAgent(webOs5);
expect(shaka.util.Platform.isWebOS6()).toBe(false);
setUserAgent(webOs6);
expect(shaka.util.Platform.isWebOS6()).toBe(true);
});

describe('isMediaKeysPolyfilled', () => {
Expand Down
Loading