Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@silvermine/videojs-chromecast

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silvermine/videojs-chromecast - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

docs/demo/jquery-webcomponents-conflict.html

2

package.json
{
"name": "@silvermine/videojs-chromecast",
"version": "1.0.0",
"version": "1.0.1",
"description": "video.js plugin for casting to chromecast",

@@ -5,0 +5,0 @@ "main": "src/js/index.js",

@@ -57,12 +57,24 @@ # Silvermine VideoJS Chromecast Plugin

* **`preloadWebComponents`** (default: `false`) - The Chromecast framework relies on the
`webcomponents.js` polyfill when a browser does not have `document.registerElement`.
If you are using jQuery, this polyfill must be loaded and initialized before jQuery is
initialized. Unfortunately, the Chromecast framework loads the `webcomponents.js`
polyfill via a dynamically created `<script>` tag. This causes a race condition (see
#17). Setting `preloadWebComponents` to `true` will make this plugin add the
`webcomponents.js` polyfill synchronously when the polyfill is needed. If you use the
`preloadWebComponents: true` option, you should make sure that this plugin is loaded
before jQuery. Then include the Chromecast framework after this plugin as you normally
would.
`webcomponents.js` polyfill when a browser does not have `document.registerElement` in
order to create the `<google-cast-button>` custom component (which is not used by this
plugin). If you are using jQuery, this polyfill must be loaded and initialized before
jQuery is initialized. Unfortunately, the Chromecast framework loads the
`webcomponents.js` polyfill via a dynamically created `<script>` tag. This causes a race
condition (see #17). Also, including `webcomponents.js` anywhere on the page will break
jQuery's fix for bubbling some events to `document` (e.g. `onchange` events for
`<select>`, see #21). Setting `preloadWebComponents` to `true` will "fix" these 2
problems by (1) making this plugin add the `webcomponents` polyfill synchronously when
the polyfill is needed and (2) using the `webcomponents-lite.js` version as it does not
include the shadow DOM polyfills, but still provides the `registerElement` polyfill that
the Chromecast framework needs. If you use the `preloadWebComponents: true` option, you
should make sure that this plugin is loaded before jQuery. Then include the Chromecast
framework after this plugin as you normally would.
**Note:** There is a caveat to using the `preloadWebComponents` setting.
Because the Chromecast plugin uses the shadow DOM to create the
`<google-cast-button>` custom component, **the `<google-cast-button>` custom
component may partly render, but it will not be functional**. This tag is not
used by this plugin. However if you must use this tag elsewhere, you should
not use the `preloadWebComponents` flag.
tl;dr: if you use jQuery, you should use the `preloadWebComponents: true` option in

@@ -69,0 +81,0 @@ this plugin.

@@ -11,2 +11,3 @@ 'use strict';

// https://github.com/silvermine/videojs-chromecast/issues/17
// https://github.com/silvermine/videojs-chromecast/issues/22

@@ -27,4 +28,10 @@ module.exports = function() {

// by the Chromecast framework at the time this was added.
require('webcomponents.js'); // eslint-disable-line global-require
// We are using webcomponents-lite.js because it doesn't interfere with jQuery as
// badly (e.g. it doesn't interfere with jQuery's fix for consistently bubbling
// events, see #21). While the "lite" version does not include the shadow DOM
// polyfills that the Chromecast framework may need for the <google-cast-button>
// component to work properly, this plugin does not use the <google-cast-button>
// component.
require('webcomponents.js/webcomponents-lite.js'); // eslint-disable-line global-require
}
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc