1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

add browser.IS_CHROMECAST_RECEIVER and class name for CSS targeting on a Chromecast receiver where Video.js is used (#8703)

This commit is contained in:
Pat O'Neill 2024-05-30 15:16:43 -04:00 committed by GitHub
parent ad357b5f61
commit 91e5e2dc8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View File

@ -795,7 +795,8 @@ class Player extends Component {
'IS_WEBOS',
'IS_ANDROID',
'IS_IPAD',
'IS_IPHONE'
'IS_IPHONE',
'IS_CHROMECAST_RECEIVER'
].filter(key => browser[key]).map(key => {
return 'vjs-device-' + key.substring(3).toLowerCase().replace(/\_/g, '-');
});

View File

@ -96,6 +96,14 @@ export let CHROMIUM_VERSION = null;
*/
export let CHROME_VERSION = null;
/**
* Whether or not this is a Chromecast receiver application.
*
* @static
* @type {Boolean}
*/
export const IS_CHROMECAST_RECEIVER = Boolean(window.cast && window.cast.framework && window.cast.framework.CastReceiverContext);
/**
* The detected Internet Explorer version - or `null`.
*

View File

@ -1045,6 +1045,19 @@ QUnit.test('should add iphone classname when on iphone', function(assert) {
player.dispose();
});
QUnit.test('should add chromecast-receiver classname when on chromecast receiver', function(assert) {
assert.expect(1);
browser.stub_IS_CHROMECAST_RECEIVER(true);
const player = TestHelpers.makePlayer({});
assert.ok(player.hasClass('vjs-device-chromecast-receiver'), 'chromecast-receiver classname added');
browser.reset_IS_CHROMECAST_RECEIVER();
player.dispose();
});
QUnit.test('should add a svg-icons-enabled classname when svg icons are supported', function(assert) {
// Stub a successful parsing of the SVG sprite.
sinon.stub(window.DOMParser.prototype, 'parseFromString').returns({