mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
970d7756ea
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>
60 lines
987 B
JavaScript
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());
|
|
}
|