Files
shaka-player/lib/device/vizio.js
T
Wojciech Tyczyński 970d7756ea 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>
2025-06-02 13:46:40 +02:00

60 lines
987 B
JavaScript

/*! @license
* Shaka Player
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.device.Vizio');
goog.require('shaka.device.AbstractDevice');
goog.require('shaka.device.DeviceFactory');
goog.require('shaka.device.IDevice');
/**
* @final
*/
shaka.device.Vizio = class extends shaka.device.AbstractDevice {
/**
* @override
*/
getVersion() {
return null;
}
/**
* @override
*/
getDeviceName() {
return 'Vizio';
}
/**
* @override
*/
getDeviceType() {
return shaka.device.IDevice.DeviceType.TV;
}
/**
* @override
*/
supportsMediaCapabilities() {
return false;
}
/**
* Check if the current platform is Vizio TV.
* @return {boolean}
* @private
*/
static isVizio_() {
return navigator.userAgent.includes('VIZIO SmartCast');
}
};
if (shaka.device.Vizio.isVizio_()) {
shaka.device.DeviceFactory.registerDeviceFactory(
() => new shaka.device.Vizio());
}