-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Closed
feat: TiVo Auto device #8785
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
13546a8
Added TiVoAuto device
matvp91 aef3ede
Fix in detecting Android
matvp91 6b8dd2a
New line at end of file
matvp91 991cb3a
Sorted alphabetically
matvp91 1b1c4f5
Added tests that check crossBoundaryStrategy for TiVo automotive
matvp91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*! @license | ||
* Shaka Player | ||
* Copyright 2025 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
describe('TiVo Auto', () => { | ||
/* eslint-disable @stylistic/max-len */ | ||
const bmwLinux = 'Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/573.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 BMW/162'; | ||
const bmwAndroid = 'Mozilla/5.0 (Linux; Andr0id 13; bmw_idc23 for arm64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.6668.100 Safari/537.36 OMI/4.25.1.126.Optimus.244.4 Model/BMW-Andr0id21screen TiVoAuto'; | ||
/* eslint-enable @stylistic/max-len */ | ||
|
||
const Util = shaka.test.Util; | ||
const CrossBoundaryStrategy = shaka.config.CrossBoundaryStrategy; | ||
const originalUserAgent = navigator.userAgent; | ||
|
||
afterEach(() => { | ||
Util.setUserAgent(originalUserAgent); | ||
}); | ||
|
||
it('should use RESET crossBoundaryStrategy on BMW Linux', () => { | ||
Util.setUserAgent(bmwLinux); | ||
const device = new shaka.device.TiVoAuto(); | ||
const config = shaka.util.PlayerConfiguration.createDefault(); | ||
device.adjustConfig(config); | ||
expect(config.streaming.crossBoundaryStrategy) | ||
.toBe(CrossBoundaryStrategy.RESET); | ||
}); | ||
|
||
it('should use RESET_TO_ENCRYPTED crossBoundaryStrategy on BMW Android', () => { | ||
Util.setUserAgent(bmwAndroid); | ||
const device = new shaka.device.TiVoAuto(); | ||
const config = shaka.util.PlayerConfiguration.createDefault(); | ||
device.adjustConfig(config); | ||
expect(config.streaming.crossBoundaryStrategy) | ||
.toBe(CrossBoundaryStrategy.RESET_TO_ENCRYPTED); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.