Skip to content

feat: TiVo Auto device #8785

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions build/types/devices
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
+../../lib/device/webkit_stb.js
+../../lib/device/webos.js
+../../lib/device/xbox.js
+../../lib/device/tivo_auto.js
1 change: 1 addition & 0 deletions lib/device/i_device.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ shaka.device.IDevice.DeviceType = {
'VR': 'VR',
'CONSOLE': 'CONSOLE',
'CAST': 'CAST',
'AUTOMOTIVE': 'AUTOMOTIVE',
};

/**
Expand Down
108 changes: 108 additions & 0 deletions lib/device/tivo_auto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*! @license
* Shaka Player
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

goog.provide('shaka.device.TiVoAuto');

goog.require('shaka.config.CrossBoundaryStrategy');
goog.require('shaka.device.AbstractDevice');
goog.require('shaka.device.DeviceFactory');
goog.require('shaka.device.IDevice');
goog.require('shaka.util.Lazy');


/**
* @final
*/
shaka.device.TiVoAuto = class extends shaka.device.AbstractDevice {
constructor() {
super();

/** @private {!shaka.util.Lazy<boolean>} */
this.isAndroid_ = new shaka.util.Lazy(() => {
return navigator.userAgent.includes('Andr0id');
});
}

/**
* @override
*/
getDeviceName() {
return 'TiVoAuto';
}

/**
* @override
*/
getVersion() {
return null;
}

/**
* @override
*/
getBrowserEngine() {
return shaka.device.IDevice.BrowserEngine.CHROMIUM;
}

/**
* @override
*/
getDeviceType() {
return shaka.device.IDevice.DeviceType.AUTOMOTIVE;
}

/**
* @override
*/
supportsMediaCapabilities() {
return false;
}

/**
* @override
*/
detectMaxHardwareResolution() {
const maxResolution = {
width: window.screen.width * window.devicePixelRatio,
height: window.screen.height * window.devicePixelRatio,
};
return Promise.resolve(maxResolution);
}

/**
* @override
*/
adjustConfig(config) {
super.adjustConfig(config);
if (this.isAndroid_.value()) {
config.streaming.crossBoundaryStrategy =
shaka.config.CrossBoundaryStrategy.RESET_TO_ENCRYPTED;
} else {
config.streaming.crossBoundaryStrategy =
shaka.config.CrossBoundaryStrategy.RESET;
}
return config;
}

/**
* Check if the current platform runs TiVoAuto.
*
* @return {boolean}
* @private
*/
static isTiVoAuto_() {
if (navigator.userAgent.includes('Linux') &&
navigator.userAgent.includes('BMW/')) {
return true;
}
return navigator.userAgent.includes('TiVoAuto');
}
}

if (shaka.device.TiVoAuto.isTiVoAuto_()) {
shaka.device.DeviceFactory.registerDeviceFactory(
() => new shaka.device.TiVoAuto());
}
1 change: 1 addition & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ linksource
longname

# 3rd party
Andr0id
apac
APPSTB
Bitcodin
Expand Down
1 change: 1 addition & 0 deletions shaka-player.uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ goog.require('shaka.device.Vizio');
goog.require('shaka.device.WebKitSTB');
goog.require('shaka.device.WebOS');
goog.require('shaka.device.Xbox');
goog.require('shaka.device.TiVoAuto');
goog.require('shaka.drm.FairPlay');
goog.require('shaka.hls.HlsParser');
goog.require('shaka.mss.MssParser');
Expand Down