jwplayer-video-element
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,2 @@ | ||
(()=>{async function u(s,t){return t&&self[t]?self[t]:new Promise(function(o,e){let i=document.createElement("script");i.src=s,i.onload=()=>o(self[t]),i.onerror=e,document.head.appendChild(i)})}function h(s){return(...t)=>new Promise(o=>{s(...t,(...e)=>{e.length>1?o(e):o(e[0])})})}function n(){let s,t,o=new Promise(function(e,i){s=e,t=i});return o.resolve=(...e)=>(o.resolved=!0,s(...e),o),o.reject=(...e)=>(t(...e),o),o}var c=class extends HTMLElement{constructor(){super();this.ready=n()}get nativeEl(){return this.querySelector("video")}static get observedAttributes(){let t=[];Object.getOwnPropertyNames(this.prototype).forEach(e=>{let i=!1;try{typeof this.prototype[e]=="function"&&(i=!0)}catch{}!i&&e!==e.toUpperCase()&&t.push(e.toLowerCase())});let o=Object.getPrototypeOf(this).observedAttributes;return o&&(t=t.concat(o)),t}async attributeChangedCallback(t,o,e){this.ready.resolved||await this.ready;let i=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),r=g(i,t),d=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;r&&!d?typeof this[r]=="boolean"?e===null?this[r]=!1:this[r]=!0:this[r]=e:e===null?this.nativeEl.removeAttribute(t):["id","class"].indexOf(t)===-1&&this.nativeEl.setAttribute(t,e)}},l=[],p=document.createElement("video"),b=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let s=Object.getPrototypeOf(p);s&&s!==HTMLElement.prototype;s=Object.getPrototypeOf(s))Object.keys(s).forEach(t=>{b.indexOf(t)===-1&&l.push(t)});l=l.concat(Object.keys(EventTarget.prototype));l.forEach(s=>{if(typeof p[s]=="function")c.prototype[s]=async function(){return this.ready.resolved||await this.ready,this.nativeEl[s].apply(this.nativeEl,arguments)};else{let o={get(){return this.nativeEl[s]}};s!==s.toUpperCase()&&(o.set=async function(e){this.ready.resolved||await this.ready,this.nativeEl[s]=e}),Object.defineProperty(c.prototype,s,o)}});function g(s,t){let o=null;return s.forEach(e=>{e.toLowerCase()==t.toLowerCase()&&(o=e)}),o}var f=c;var y=document.createElement("template");y.innerHTML=` | ||
(()=>{async function u(s,t){return t&&self[t]?self[t]:new Promise(function(o,e){let i=document.createElement("script");i.src=s,i.onload=()=>o(self[t]),i.onerror=e,document.head.appendChild(i)})}function h(s){return(...t)=>new Promise(o=>{s(...t,(...e)=>{e.length>1?o(e):o(e[0])})})}function n(){let s,t,o=new Promise(function(e,i){s=e,t=i});return o.resolve=(...e)=>(o.resolved=!0,s(...e),o),o.reject=(...e)=>(t(...e),o),o}var c=class extends HTMLElement{constructor(){super();this.ready=n()}get nativeEl(){return this.querySelector("video")}static get observedAttributes(){let t=[];Object.getOwnPropertyNames(this.prototype).forEach(e=>{let i=!1;try{typeof this.prototype[e]=="function"&&(i=!0)}catch{}!i&&e!==e.toUpperCase()&&t.push(e.toLowerCase())});let o=Object.getPrototypeOf(this).observedAttributes;return o&&(t=t.concat(o)),t}async attributeChangedCallback(t,o,e){this.ready.resolved||await this.ready;let i=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),r=g(i,t),d=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;r&&!d?typeof this[r]=="boolean"?e===null?this[r]=!1:this[r]=!0:this[r]=e:e===null?this.nativeEl.removeAttribute(t):["id","class"].indexOf(t)===-1&&this.nativeEl.setAttribute(t,e)}},l=[],p=document.createElement("video"),b=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let s=Object.getPrototypeOf(p);s&&s!==HTMLElement.prototype;s=Object.getPrototypeOf(s))Object.keys(s).forEach(t=>{b.indexOf(t)===-1&&l.push(t)});l=l.concat(Object.keys(EventTarget.prototype));l.forEach(s=>{if(typeof p[s]=="function")c.prototype[s]=async function(){return this.ready.resolved||await this.ready,this.nativeEl[s].apply(this.nativeEl,arguments)};else{let o={get(){return this.nativeEl?.[s]}};s!==s.toUpperCase()&&(o.set=async function(e){this.ready.resolved||await this.ready,this.nativeEl[s]=e}),Object.defineProperty(c.prototype,s,o)}});function g(s,t){let o=null;return s.forEach(e=>{e.toLowerCase()==t.toLowerCase()&&(o=e)}),o}var f=c;var y=document.createElement("template");y.innerHTML=` | ||
<style> | ||
@@ -3,0 +3,0 @@ .jw-no-controls [class*="jw-controls"], |
{ | ||
"name": "jwplayer-video-element", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Custom element (web component) for the JW player.", |
@@ -11,19 +11,8 @@ # `<jwplayer-video>` | ||
## Example | ||
## Example ([CodeSandbox](https://codesandbox.io/s/jwplayer-video-element-gm5qd1)) | ||
<!-- prettier-ignore --> | ||
```html | ||
<html> | ||
<head> | ||
<script | ||
type="module" | ||
src="https://unpkg.com/jwplayer-video-element@0" | ||
></script> | ||
</head> | ||
<body> | ||
<jwplayer-video | ||
controls | ||
src="https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html" | ||
></jwplayer-video> | ||
</body> | ||
</html> | ||
<script type="module" src="https://unpkg.com/jwplayer-video-element@0"></script> | ||
<jwplayer-video controls src="https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html"></jwplayer-video> | ||
``` | ||
@@ -37,9 +26,5 @@ | ||
<!-- prettier-ignore --> | ||
```html | ||
<head> | ||
<script | ||
type="module" | ||
src="https://unpkg.com/jwplayer-video-element@0" | ||
></script> | ||
</head> | ||
<script type="module" src="https://unpkg.com/jwplayer-video-element@0"></script> | ||
``` | ||
@@ -46,0 +31,0 @@ |
@@ -180,3 +180,3 @@ import { publicPromise } from './utils.js'; | ||
get() { | ||
return this.nativeEl[prop]; | ||
return this.nativeEl?.[prop]; | ||
}, | ||
@@ -183,0 +183,0 @@ }; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34021
49