feat: Add Device API (#8210)

The goal is to simplify and abstract feature logic detection. Currently
lots of places depend on various calls to `shaka.util.Platform` and
mainteinance of this is hard & not easy to read.

By introducing device API ideally rest of the player logic would look
into device features instead of directly checking platform. Additionally
we can more easily cache needed values, so we won't have to parse user
agent several times anymore.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
This commit is contained in:
Wojciech Tyczyński
2025-06-02 13:46:40 +02:00
committed by GitHub
parent 9ac3f51473
commit 970d7756ea
78 changed files with 2727 additions and 1569 deletions
+4 -3
View File
@@ -404,9 +404,10 @@ describe('UI', () => {
UiUtils.confirmElementFound(videoContainer, 'shaka-seek-bar');
// The default settings vary in mobile/desktop/SmartTV context.
if (shaka.util.Platform.isMobile() ||
shaka.util.Platform.isSmartTV()) {
// The default settings vary in mobile/desktop context.
const deviceType = deviceDetected.getDeviceType();
if (deviceType == shaka.device.IDevice.DeviceType.MOBILE ||
deviceType == shaka.device.IDevice.DeviceType.TV) {
UiUtils.confirmElementFound(videoContainer,
'shaka-play-button-container');
UiUtils.confirmElementFound(videoContainer, 'shaka-play-button');