New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jwplayer-video-element

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwplayer-video-element - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

73

jwplayer-video-element.js

@@ -34,8 +34,4 @@ import { SuperVideoElement } from 'super-media-element';

static template = templateShadowDOM;
static skipAttributes = ['src'];
constructor() {
super();
this.loadComplete = new PublicPromise();
}
get nativeEl() {

@@ -46,5 +42,2 @@ return this.querySelector('.jw-video');

async load() {
if (this.hasLoaded) this.loadComplete = new PublicPromise();
this.hasLoaded = true;
this.loadComplete.then(() => {

@@ -54,5 +47,2 @@ this.volume = 1;

// Wait 1 tick to allow other attributes to be set.
await Promise.resolve();
// e.g. https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html

@@ -81,16 +71,7 @@ const MATCH_SRC = /jwplayer\.com\/players\/(\w+)(?:-(\w+))?/i;

this.api.getContainer().classList.toggle('jw-no-controls', !this.controls);
this.dispatchEvent(new Event('loadcomplete'));
this.loadComplete.resolve();
}
async attributeChangedCallback(attrName, oldValue, newValue) {
// This is required to come before the await for resolving loadComplete.
if (attrName === 'src' && newValue) {
this.load();
return;
}
if (['controls', 'muted'].includes(attrName)) {
// Don't await super.attributeChangedCallback above, it would resolve later.
await this.loadComplete;

@@ -105,3 +86,3 @@

case 'muted':
this.muted = this.getAttribute('muted') != null;
this.muted = this.hasAttribute('muted');
break;

@@ -118,33 +99,14 @@ }

}
get src() {
return this.getAttribute('src');
}
set src(val) {
this.setAttribute('src', val);
}
set controls(val) {
this.toggleAttribute('controls', Boolean(val));
}
get controls() {
return this.getAttribute('controls') != null;
}
}
const loadScriptCache = {};
async function loadScript(src, globalName, readyFnName) {
async function loadScript(src, globalName) {
if (!globalName) return import(src);
if (loadScriptCache[src]) return loadScriptCache[src];
if (globalName && self[globalName]) {
await delay(0);
return self[globalName];
}
return (loadScriptCache[src] = new Promise(function (resolve, reject) {
if (self[globalName]) return self[globalName];
return (loadScriptCache[src] = new Promise((resolve, reject) => {
const script = document.createElement('script');
script.defer = true;
script.src = src;
const ready = () => resolve(self[globalName]);
if (readyFnName) (self[readyFnName] = ready);
script.onload = () => !readyFnName && ready();
script.onload = () => resolve(self[globalName]);
script.onerror = reject;

@@ -155,4 +117,2 @@ document.head.append(script);

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
export function promisify(fn) {

@@ -168,19 +128,2 @@ return (...args) =>

/**
* A utility to create Promises with convenient public resolve and reject methods.
* @return {Promise}
*/
class PublicPromise extends Promise {
constructor(executor = () => {}) {
let res, rej;
super((resolve, reject) => {
executor(resolve, reject);
res = resolve;
rej = reject;
});
this.resolve = res;
this.reject = rej;
}
}
if (!globalThis.customElements.get('jwplayer-video')) {

@@ -187,0 +130,0 @@ globalThis.customElements.define('jwplayer-video', JWPlayerVideoElement);

6

package.json
{
"name": "jwplayer-video-element",
"version": "1.0.1",
"version": "1.0.2",
"description": "A custom element for the JW player with an API that matches the `<video>` API",

@@ -21,6 +21,6 @@ "type": "module",

"dependencies": {
"super-media-element": "1.0.0"
"super-media-element": "1.1.3"
},
"devDependencies": {
"wet-run": "^0.0.6"
"wet-run": "^0.0.8"
},

@@ -27,0 +27,0 @@ "eslintConfig": {

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