Files
ShakaPlayer/test/device/webkit_stb_unit.js
bevhatzl 3c5d42e133 fix: Correct device detection for PlayStation 4 Pro to enable 4K resolution (#10269)
## Description
The symptom noticed on Playstation 4 Pro was that all 4K streams were
being dropped even though this device is capable of 4K.

## Explanation of changes
Playstation may have 'Apple Computer, Inc' as the navigator.vendor and
so `isWebkitSTB_` defaults to true.
Even though `isPlayStation_` also evaluates to true, `isWebkitSTB_`
takes over due to import order in `shaka-player.uncompiled.js`
The device name at runtime was: 'WebKit STB'
This specific bug was caused by the call to
`device.detectMaxHardwareResolution` which was using the WebKit STB
implementation which returns 1920*1080 as the max resolution.

There are other device methods that will now use the correct
implementation.
2026-07-12 10:02:54 -07:00

36 lines
1.2 KiB
JavaScript

/*! @license
* Shaka Player
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
describe('WebKitSTB', () => {
/* eslint-disable @stylistic/max-len */
const playstation4Pro = 'Mozilla/5.0 (PlayStation 4 PRO WebMAF, HEVC) AppleWebKit/605.1.15 (KHTML, like Gecko) WebMAF/v3.2.4-0-g236ca012 SDK: (0x12008011u), Built: Feb 5 2025 14:07:28';
const Util = shaka.test.Util;
const originalUserAgent = navigator.userAgent;
const originalVendor = navigator.vendor;
const originalPlatform = navigator.platform;
const originalMaxTouchPoints = navigator.maxTouchPoints;
const originalUserAgentData = navigator.userAgentData;
afterEach(() => {
Util.setUserAgent(originalUserAgent);
Util.setVendor(originalVendor);
Util.setPlatform(originalPlatform);
Util.setMaxTouchPoints(originalMaxTouchPoints);
Util.setUserAgentData(originalUserAgentData);
});
it('does not classify PlayStation as WebKit STB', () => {
Util.setUserAgent(playstation4Pro);
Util.setVendor('Apple Computer, Inc.');
Util.setPlatform('PlayStation');
Util.setMaxTouchPoints(0);
Util.setUserAgentData(null);
expect(shaka.device.WebKitSTB['isWebkitSTB_']()).toBe(false);
});
});