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

jwplayer-video-element

Package Overview
Dependencies
Maintainers
1
Versions
27
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 0.1.0 to 0.1.1

6

dist/jwplayer-video-element.js

@@ -1,2 +0,2 @@

(()=>{var A=Object.defineProperty;var T=(r,t,s)=>t in r?A(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var E=(r,t,s)=>(T(r,typeof t!="symbol"?t+"":t,s),s);var S=`
(()=>{var A=Object.defineProperty;var T=(r,e,s)=>e in r?A(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var E=(r,e,s)=>(T(r,typeof e!="symbol"?e+"":e,s),s);var S=`
:host {

@@ -21,3 +21,3 @@ display: inline-block;

<slot></slot>
`;var v=(r,{tag:t,is:s})=>{let n=document.createElement(t,{is:s}),c=w(n),h=[...c,...Object.getOwnPropertyNames(HTMLElement.prototype)].filter(d=>d.startsWith("on")).map(d=>d.slice(2));return class C extends r{static#o;static get observedAttributes(){C.#l();let e=[];Object.getOwnPropertyNames(this.prototype).forEach(i=>{let a=!1;try{typeof this.prototype[i]=="function"&&(a=!0)}catch{}!a&&i!==i.toUpperCase()&&e.push(i.toLowerCase())});let l=Object.getPrototypeOf(this).observedAttributes;return[...Object.getPrototypeOf(n).observedAttributes??[],...e,...l??[]]}static#l(){this.#o||(this.#o=!0,c.forEach(e=>{if(e in this.prototype)return;if(typeof n[e]=="function")this.prototype[e]=async function(){return this.#t(),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl[e].apply(this.nativeEl,arguments)};else{let o={get(){return this.#t(),this.nativeEl?.[e]??this.#i[e]}};e!==e.toUpperCase()&&(o.set=async function(i){this.#t(),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl[e]=i}),Object.defineProperty(this.prototype,e,o)}}))}#e;#n;#s=!1;#i;constructor(){super();this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(b.content.cloneNode(!0)))}set loadComplete(e){this.#s=!1,this.#n=e,e.then(()=>{this.#s=!0})}get loadComplete(){return this.#n}get isLoaded(){return this.#s}get nativeEl(){return this.shadowRoot.querySelector(t)}#a(){let e=document.createElement(t,{is:s});[...this.attributes].forEach(({name:l,value:o})=>{e.setAttribute(l,o)}),this.#i={},w(e).forEach(l=>{this.#i[l]=e[l]}),e.removeAttribute("src"),e.load()}async#c(){this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl||this.shadowRoot.append(document.createElement(t,{is:s}))}async#t(){if(this.#e)return;this.#e=!0,this.#a(),this.#c();let e=new Map,l=this.shadowRoot.querySelector("slot");l?.addEventListener("slotchange",()=>{let o=new Map(e);l.assignedElements().filter(i=>["track","source"].includes(i.localName)).forEach(async i=>{o.delete(i);let a=e.get(i);a||(a=i.cloneNode(),e.set(i,a)),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.append(a)}),o.forEach(i=>i.remove())}),h.forEach(o=>{this.shadowRoot.addEventListener?.(o,i=>{i.target===this.nativeEl&&(!["Event","CustomEvent"].includes(i.constructor.name)||this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail})))},!0)}),[...this.attributes].forEach(o=>{this.#r(o.name,null,o.value)}),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.defaultMuted&&(this.muted=!0)}async attributeChangedCallback(e,l,o){this.#e||await this.#t(),this.#r(e,l,o)}async#r(e,l,o){this.loadComplete&&!this.isLoaded&&await this.loadComplete;let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)).find(P=>P.toLowerCase()===e.toLowerCase()),y=Object.getPrototypeOf(this.constructor).name==="HTMLElement";a&&!y?typeof this[a]=="boolean"?o===null?this[a]=!1:this[a]=!0:this[a]=o:o===null?this.nativeEl.removeAttribute(e):["id","class"].indexOf(e)===-1&&this.nativeEl.setAttribute(e,o)}connectedCallback(){this.#t()}}};function w(r){let t=[];for(let s=Object.getPrototypeOf(r);s&&s!==HTMLElement.prototype;s=Object.getPrototypeOf(s))t.push(...Object.getOwnPropertyNames(s));return t}var p=v(HTMLElement,{tag:"video"});globalThis.customElements.get("super-video")||(globalThis.customElements.define("super-video",p),globalThis.SuperVideoElement=p);var g=v(HTMLElement,{tag:"audio"});globalThis.customElements.get("super-audio")||(globalThis.customElements.define("super-audio",g),globalThis.SuperAudioElement=g);async function j(r,t){return t&&self[t]?self[t]:new Promise(function(s,n){let c=document.createElement("script");c.src=r,c.onload=()=>s(self[t]),c.onerror=n,document.head.appendChild(c)})}function L(r){return(...t)=>new Promise(s=>{r(...t,(...n)=>{n.length>1?s(n):s(n[0])})})}var m=class extends Promise{constructor(t=()=>{}){let s,n;super((c,h)=>{t(c,h),s=c,n=h});this.resolve=s,this.reject=n}};var O=document.createElement("template");O.innerHTML=`
`;var v=(r,{tag:e,is:s})=>{let n=document.createElement(e,{is:s}),c=w(n),h=[...c,...Object.getOwnPropertyNames(HTMLElement.prototype)].filter(u=>u.startsWith("on")).map(u=>u.slice(2));return class C extends r{static#o;static get observedAttributes(){C.#l();let t=[];Object.getOwnPropertyNames(this.prototype).forEach(i=>{let a=!1;try{typeof this.prototype[i]=="function"&&(a=!0)}catch{}!a&&i!==i.toUpperCase()&&t.push(i.toLowerCase())});let l=Object.getPrototypeOf(this).observedAttributes;return[...Object.getPrototypeOf(n).observedAttributes??[],...t,...l??[]]}static#l(){this.#o||(this.#o=!0,c.forEach(t=>{if(t in this.prototype)return;if(typeof n[t]=="function")this.prototype[t]=function(...o){this.#t();let i=()=>this.call?this.call(t,...o):this.nativeEl[t].apply(this.nativeEl,o);return this.loadComplete&&!this.isLoaded?this.loadComplete.then(i):i()};else{let o={get(){return this.#t(),this.get?.(t)??this.nativeEl?.[t]??this.#i[t]}};t!==t.toUpperCase()&&(o.set=async function(i){if(this.#t(),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.set){this.set(t,i);return}this.nativeEl[t]=i}),Object.defineProperty(this.prototype,t,o)}}))}#e;#n;#s=!1;#i;constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(b.content.cloneNode(!0)))}set loadComplete(t){this.#s=!1,this.#n=t,t.then(()=>{this.#s=!0})}get loadComplete(){return this.#n}get isLoaded(){return this.#s}get nativeEl(){return this.shadowRoot.querySelector(e)}#a(){let t=document.createElement(e,{is:s});[...this.attributes].forEach(({name:l,value:o})=>{t.setAttribute(l,o)}),this.#i={},w(t).forEach(l=>{this.#i[l]=t[l]}),t.removeAttribute("src"),t.load()}async#c(){this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl||this.shadowRoot.append(document.createElement(e,{is:s}))}async#t(){if(this.#e)return;this.#e=!0,this.#a(),this.#c();let t=new Map,l=this.shadowRoot.querySelector("slot");l?.addEventListener("slotchange",()=>{let o=new Map(t);l.assignedElements().filter(i=>["track","source"].includes(i.localName)).forEach(async i=>{o.delete(i);let a=t.get(i);a||(a=i.cloneNode(),t.set(i,a)),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.append(a)}),o.forEach(i=>i.remove())}),h.forEach(o=>{this.shadowRoot.addEventListener?.(o,i=>{i.target===this.nativeEl&&(!["Event","CustomEvent","PictureInPictureEvent"].includes(i.constructor.name)||this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail})))},!0)}),[...this.attributes].forEach(o=>{this.#r(o.name,null,o.value)}),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.defaultMuted&&(this.muted=!0)}async attributeChangedCallback(t,l,o){this.#e||await this.#t(),this.#r(t,l,o)}async#r(t,l,o){this.loadComplete&&!this.isLoaded&&await this.loadComplete;let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)).find(P=>P.toLowerCase()===t.toLowerCase()),y=Object.getPrototypeOf(this.constructor).name==="HTMLElement";a&&!y?typeof this[a]=="boolean"?o===null?this[a]=!1:this[a]=!0:this[a]=o:o===null?this.nativeEl.removeAttribute(t):["id","class"].indexOf(t)===-1&&this.nativeEl.setAttribute(t,o)}connectedCallback(){this.#t()}}};function w(r){let e=[];for(let s=Object.getPrototypeOf(r);s&&s!==HTMLElement.prototype;s=Object.getPrototypeOf(s))e.push(...Object.getOwnPropertyNames(s));return e}var m=v(HTMLElement,{tag:"video"});globalThis.customElements.get("super-video")||(globalThis.customElements.define("super-video",m),globalThis.SuperVideoElement=m);var g=v(HTMLElement,{tag:"audio"});globalThis.customElements.get("super-audio")||(globalThis.customElements.define("super-audio",g),globalThis.SuperAudioElement=g);async function j(r,e){return e&&self[e]?self[e]:new Promise(function(s,n){let c=document.createElement("script");c.src=r,c.onload=()=>s(self[e]),c.onerror=n,document.head.appendChild(c)})}function L(r){return(...e)=>new Promise(s=>{r(...e,(...n)=>{n.length>1?s(n):s(n[0])})})}var p=class extends Promise{constructor(e=()=>{}){let s,n;super((c,h)=>{e(c,h),s=c,n=h}),this.resolve=s,this.reject=n}};var O=document.createElement("template");O.innerHTML=`
<style class="jw-style">

@@ -36,3 +36,3 @@ .jw-no-controls [class*="jw-controls"],

</style>
`;var u=class extends p{constructor(){super();this.shadowRoot.append(f.content.cloneNode(!0)),this.loadComplete=new m}get nativeEl(){return this.querySelector(".jw-video")}async load(){this.hasLoaded&&(this.loadComplete=new m),this.hasLoaded=!0,this.loadComplete.then(()=>{this.volume=1}),await Promise.resolve();let t=/jwplayer\.com\/players\/(\w+)(?:-(\w+))?/i,[,s,n]=this.src.match(t),c=`https://cdn.jwplayer.com/v2/media/${s}`,h=await(await fetch(c)).json(),d=`https://content.jwplatform.com/libraries/${n}.js`,e=await j(d,"jwplayer");this.querySelector(".jw-style")?.remove(),this.querySelector(".jwplayer")?.remove(),this.append(O.content.cloneNode(!0)),this.api=e(this.querySelector(".jwplayer")).setup({width:"100%",height:"100%",preload:this.getAttribute("preload")??"metadata",...h}),await L(this.api.on,this.api)("ready"),this.api.getContainer().classList.toggle("jw-no-controls",!this.controls),this.dispatchEvent(new Event("loadcomplete")),this.loadComplete.resolve()}async attributeChangedCallback(t,s,n){if(t==="src"&&n){this.load();return}switch(super.attributeChangedCallback(t,s,n),await this.loadComplete,t){case"controls":this.api.getContainer().classList.toggle("jw-no-controls",!this.controls);break;case"muted":this.muted=this.getAttribute("muted")!=null;break}}get paused(){return this.nativeEl?.paused??!0}get src(){return this.getAttribute("src")}set src(t){this.src!=t&&this.setAttribute("src",t)}set controls(t){this.controls!=t&&(t?this.setAttribute("controls",""):this.removeAttribute("controls"))}get controls(){return this.getAttribute("controls")!=null}};E(u,"template",f);globalThis.customElements.get("jwplayer-video")||globalThis.JWPlayerVideoElement?console.debug("JWPlayerVideoElement: <jwplayer-video> defined more than once."):(globalThis.JWPlayerVideoElement=u,globalThis.customElements.define("jwplayer-video",u));var q=u;})();
`;var d=class extends m{constructor(){super(),this.shadowRoot.append(f.content.cloneNode(!0)),this.loadComplete=new p}get nativeEl(){return this.querySelector(".jw-video")}async load(){this.hasLoaded&&(this.loadComplete=new p),this.hasLoaded=!0,this.loadComplete.then(()=>{this.volume=1}),await Promise.resolve();let e=/jwplayer\.com\/players\/(\w+)(?:-(\w+))?/i,[,s,n]=this.src.match(e),c=`https://cdn.jwplayer.com/v2/media/${s}`,h=await(await fetch(c)).json(),u=`https://content.jwplatform.com/libraries/${n}.js`,t=await j(u,"jwplayer");this.querySelector(".jw-style")?.remove(),this.querySelector(".jwplayer")?.remove(),this.append(O.content.cloneNode(!0)),this.api=t(this.querySelector(".jwplayer")).setup({width:"100%",height:"100%",preload:this.getAttribute("preload")??"metadata",...h}),await L(this.api.on,this.api)("ready"),this.api.getContainer().classList.toggle("jw-no-controls",!this.controls),this.dispatchEvent(new Event("loadcomplete")),this.loadComplete.resolve()}async attributeChangedCallback(e,s,n){if(e==="src"&&n){this.load();return}switch(super.attributeChangedCallback(e,s,n),await this.loadComplete,e){case"controls":this.api.getContainer().classList.toggle("jw-no-controls",!this.controls);break;case"muted":this.muted=this.getAttribute("muted")!=null;break}}get paused(){return this.nativeEl?.paused??!0}get src(){return this.getAttribute("src")}set src(e){this.src!=e&&this.setAttribute("src",e)}set controls(e){this.controls!=e&&(e?this.setAttribute("controls",""):this.removeAttribute("controls"))}get controls(){return this.getAttribute("controls")!=null}};E(d,"template",f);globalThis.customElements.get("jwplayer-video")||globalThis.JWPlayerVideoElement?console.debug("JWPlayerVideoElement: <jwplayer-video> defined more than once."):(globalThis.JWPlayerVideoElement=d,globalThis.customElements.define("jwplayer-video",d));var q=d;})();
//# sourceMappingURL=jwplayer-video-element.js.map
{
"name": "jwplayer-video-element",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",

@@ -61,4 +61,4 @@ "description": "Custom element (web component) for the JW player.",

"dependencies": {
"super-media-element": "^0.0.1"
"super-media-element": "^0.2.0"
}
}

Sorry, the diff of this file is not supported yet

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