shaka-video-element 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ The element API matches the HTML5 `<video>` tag, so it can be easily swapped wit
9
9
  ```html
10
10
  <html>
11
11
  <head>
12
- <script type="module" src="https://unpkg.com/shaka-video-element@0.5"></script>
12
+ <script type="module" src="https://unpkg.com/shaka-video-element@0.6"></script>
13
13
  </head>
14
14
  <body>
15
15
 
@@ -31,7 +31,7 @@ Note the `type="module"`, that's important.
31
31
 
32
32
  ```html
33
33
  <head>
34
- <script type="module" src="https://unpkg.com/shaka-video-element@0.5"></script>
34
+ <script type="module" src="https://unpkg.com/shaka-video-element@0.6"></script>
35
35
  </head>
36
36
  ```
37
37
 
@@ -23,4 +23,4 @@ var Pe=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=
23
23
  Copyright 2019 Google LLC
24
24
  SPDX-License-Identifier: Apache-2.0
25
25
  */
26
- function bm(){}function wm(){dm?console.debug("EmeEncryptionSchemePolyfill: Already installed."):navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration?(dm=navigator.requestMediaKeySystemAccess,console.debug("EmeEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.requestMediaKeySystemAccess=Tm):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function Tm(e,t){var n,i=this;return N((function(r){return 1==r.g?(console.assert(i==navigator,'bad "this" for requestMediaKeySystemAccess'),w(r,dm.call(i,e,t),2)):Dm(n=r.h)?(console.debug("EmeEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.requestMediaKeySystemAccess=dm,r.return(n)):(console.debug("EmeEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.requestMediaKeySystemAccess=xm,r.return(xm.call(i,e,t)))}))}function xm(e,t){var n,i,r,a,o,s,u,c,d,f,h=this;return N((function(p){if(1==p.g){for(console.assert(h==navigator,'bad "this" for requestMediaKeySystemAccess'),n=Rm(e),i=[],r=l(t),a=r.next();!a.done;a=r.next())o=a.value,s=Sm(o.videoCapabilities,n),u=Sm(o.audioCapabilities,n),o.videoCapabilities&&o.videoCapabilities.length&&!s.length||o.audioCapabilities&&o.audioCapabilities.length&&!u.length||((c=Object.assign({},o)).videoCapabilities=s,c.audioCapabilities=u,i.push(c));if(!i.length)throw(d=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",d.code=DOMException.NOT_SUPPORTED_ERR,d;return w(p,dm.call(h,e,i),2)}return f=p.h,p.return(new Mm(f,n))}))}function Sm(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function Em(){}function Am(){fm?console.debug("McEncryptionSchemePolyfill: Already installed."):navigator.mediaCapabilities?(fm=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=km):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function km(e){var t,n,i,r=this;return N((function(a){switch(a.g){case 1:return console.assert(r==navigator.mediaCapabilities,'bad "this" for decodingInfo'),w(a,fm.call(r,e),2);case 2:if(t=a.h,!e.keySystemConfiguration)return a.return(t);if((n=t.keySystemAccess)&&Dm(n))return console.debug("McEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.mediaCapabilities.decodingInfo=fm,a.return(t);if(console.debug("McEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Im,n){a.A(3);break}return i=t,w(a,Cm(e),4);case 4:return i.keySystemAccess=a.h,a.return(t);case 3:return a.return(Im.call(r,e))}}))}function Im(e){var t,n,i,r,a,o,s,u,l=this;return N((function(c){switch(c.g){case 1:return console.assert(l==navigator.mediaCapabilities,'bad "this" for decodingInfo'),t=null,e.keySystemConfiguration&&(n=e.keySystemConfiguration,i=n.keySystem,r=n.audio&&n.audio.encryptionScheme,a=n.video&&n.video.encryptionScheme,t=Rm(i),o={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},r&&r!=t||a&&a!=t)?c.return(o):w(c,fm.call(l,e),2);case 2:if((s=c.h).keySystemAccess){s.keySystemAccess=new Mm(s.keySystemAccess,t),c.A(3);break}if(!e.keySystemConfiguration){c.A(3);break}return u=s,w(c,Cm(e),5);case 5:u.keySystemAccess=c.h;case 3:return c.return(s)}}))}function Cm(e){var t,n;return N((function(i){if(1==i.g){var r=e.keySystemConfiguration,a=[],o=[];return r.audio&&a.push({robustness:r.audio.robustness||"",contentType:e.audio.contentType}),r.video&&o.push({robustness:r.video.robustness||"",contentType:e.video.contentType}),r={initDataTypes:r.initDataType?[r.initDataType]:[],distinctiveIdentifier:r.distinctiveIdentifier,persistentState:r.persistentState,sessionTypes:r.sessionTypes},a.length&&(r.audioCapabilities=a),o.length&&(r.videoCapabilities=o),t=r,w(i,navigator.requestMediaKeySystemAccess(e.keySystemConfiguration.keySystem,[t]),2)}return n=i.h,i.return(n)}))}function Mm(e,t){this.h=e,this.g=t,this.keySystem=e.keySystem}function Rm(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.chromecast")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":(console.warn("EmeEncryptionSchemePolyfill: Unknown key system:",e,"Please contribute!"),null)}function Dm(e){var t=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||t)||void 0===e.encryptionScheme)}function Nm(){}function Pm(){wm(),Am()}Yt["text/x-ssa"]=function(){return new sm},F("shaka.util.FairPlayUtils",vm),vm.commonFairPlayResponse=function(e,t){if(2===e){try{var n=Tt(t.data)}catch(e){return}var i=!1;"<ckc>"===(n=n.trim()).substr(0,5)&&"</ckc>"===n.substr(-6)&&(n=n.slice(5,-6),i=!0);try{var r=JSON.parse(n);r.ckc&&(n=r.ckc,i=!0),r.CkcMessage&&(n=r.CkcMessage,i=!0),r.License&&(n=r.License,i=!0)}catch(e){}i&&(t.data=Ae(Rt(n)))}},vm.conaxFairPlayRequest=function(e,t){2===e&&(t.headers["Content-Type"]="application/octet-stream")},vm.ezdrmFairPlayRequest=function(e,t){2===e&&(t.headers["Content-Type"]="application/octet-stream")},vm.verimatrixFairPlayRequest=function(e,t){if(2===e){var n=ke(t.body);n=Mt(n),t.headers["Content-Type"]="application/x-www-form-urlencoded",t.body=Et("spc="+n)}},vm.conaxInitDataTransform=function(t,n,i){if("skd"!==n)return t;n=i.serverCertificate,i=St(t).split("skd://").pop().split("?").shift(),i=e.atob(i);var r=new ArrayBuffer(2*i.length);r=new Uint16Array(r);for(var a=0,o=i.length;a<o;a++)r[a]=i.charCodeAt(a);return ym(t,r,n)},vm.ezdrmInitDataTransform=function(e,t,n){return"skd"!==t?e:(t=n.serverCertificate,ym(e,n=St(e).split(";").pop(),t))},vm.verimatrixInitDataTransform=function(e,t,n){return"skd"!==t?e:(t=n.serverCertificate,ym(e,n=St(e).split("skd://").pop(),t))},vm.initDataTransform=ym,vm.defaultGetContentId=function(e){return new Le(e=St(e)).Ga},vm.isFairPlaySupported=function(){var e;return N((function(t){return 1==t.g?(e={initDataTypes:["cenc","sinf","skd"],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"'}]},x(t,2),w(t,navigator.requestMediaKeySystemAccess("com.apple.fps",[e]),4)):2!=t.g?t.return(!0):(A(t),t.return(!1))}))},F("EmeEncryptionSchemePolyfill",bm),bm.install=wm,F("McEncryptionSchemePolyfill",Em),Em.install=Am,Mm.prototype.getConfiguration=function(){var e=this.h.getConfiguration();if(e.videoCapabilities)for(var t=l(e.videoCapabilities),n=t.next();!n.done;n=t.next())n.value.encryptionScheme=this.g;if(e.audioCapabilities)for(n=(t=l(e.audioCapabilities)).next();!n.done;n=t.next())n.value.encryptionScheme=this.g;return e},Mm.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},F("EncryptionSchemePolyfills",Nm),Nm.install=Pm,void 0!==n&&n.exports&&(n.exports=Nm)}.call(n,e,e,void 0),n.shaka)t[i]=n.shaka[i]}()}(o={exports:{}},o.exports),o.exports);function u(e){l(e.detail)}function l(e){console.error("Error code",e.code,"object",e)}class c extends t{constructor(){super(),this.player=null,s.Player.isBrowserSupported()?(this.player=new s.Player(this.nativeEl),this.player.addEventListener("error",u)):console.error("Browser does not support Shaka Player")}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&this.setAttribute("src",e)}async load(){try{await this.player.load(this.src),console.log("The video has now been loaded!")}catch(e){l(e)}}connectedCallback(){this.src&&this.load()}}window.customElements.get("shaka-video")||(window.customElements.define("shaka-video",c),window.ShakaVideoElement=c);export{c as default};
26
+ function bm(){}function wm(){dm?console.debug("EmeEncryptionSchemePolyfill: Already installed."):navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration?(dm=navigator.requestMediaKeySystemAccess,console.debug("EmeEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.requestMediaKeySystemAccess=Tm):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function Tm(e,t){var n,i=this;return N((function(r){return 1==r.g?(console.assert(i==navigator,'bad "this" for requestMediaKeySystemAccess'),w(r,dm.call(i,e,t),2)):Dm(n=r.h)?(console.debug("EmeEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.requestMediaKeySystemAccess=dm,r.return(n)):(console.debug("EmeEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.requestMediaKeySystemAccess=xm,r.return(xm.call(i,e,t)))}))}function xm(e,t){var n,i,r,a,o,s,u,c,d,f,h=this;return N((function(p){if(1==p.g){for(console.assert(h==navigator,'bad "this" for requestMediaKeySystemAccess'),n=Rm(e),i=[],r=l(t),a=r.next();!a.done;a=r.next())o=a.value,s=Sm(o.videoCapabilities,n),u=Sm(o.audioCapabilities,n),o.videoCapabilities&&o.videoCapabilities.length&&!s.length||o.audioCapabilities&&o.audioCapabilities.length&&!u.length||((c=Object.assign({},o)).videoCapabilities=s,c.audioCapabilities=u,i.push(c));if(!i.length)throw(d=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",d.code=DOMException.NOT_SUPPORTED_ERR,d;return w(p,dm.call(h,e,i),2)}return f=p.h,p.return(new Mm(f,n))}))}function Sm(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function Em(){}function Am(){fm?console.debug("McEncryptionSchemePolyfill: Already installed."):navigator.mediaCapabilities?(fm=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=km):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function km(e){var t,n,i,r=this;return N((function(a){switch(a.g){case 1:return console.assert(r==navigator.mediaCapabilities,'bad "this" for decodingInfo'),w(a,fm.call(r,e),2);case 2:if(t=a.h,!e.keySystemConfiguration)return a.return(t);if((n=t.keySystemAccess)&&Dm(n))return console.debug("McEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.mediaCapabilities.decodingInfo=fm,a.return(t);if(console.debug("McEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Im,n){a.A(3);break}return i=t,w(a,Cm(e),4);case 4:return i.keySystemAccess=a.h,a.return(t);case 3:return a.return(Im.call(r,e))}}))}function Im(e){var t,n,i,r,a,o,s,u,l=this;return N((function(c){switch(c.g){case 1:return console.assert(l==navigator.mediaCapabilities,'bad "this" for decodingInfo'),t=null,e.keySystemConfiguration&&(n=e.keySystemConfiguration,i=n.keySystem,r=n.audio&&n.audio.encryptionScheme,a=n.video&&n.video.encryptionScheme,t=Rm(i),o={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},r&&r!=t||a&&a!=t)?c.return(o):w(c,fm.call(l,e),2);case 2:if((s=c.h).keySystemAccess){s.keySystemAccess=new Mm(s.keySystemAccess,t),c.A(3);break}if(!e.keySystemConfiguration){c.A(3);break}return u=s,w(c,Cm(e),5);case 5:u.keySystemAccess=c.h;case 3:return c.return(s)}}))}function Cm(e){var t,n;return N((function(i){if(1==i.g){var r=e.keySystemConfiguration,a=[],o=[];return r.audio&&a.push({robustness:r.audio.robustness||"",contentType:e.audio.contentType}),r.video&&o.push({robustness:r.video.robustness||"",contentType:e.video.contentType}),r={initDataTypes:r.initDataType?[r.initDataType]:[],distinctiveIdentifier:r.distinctiveIdentifier,persistentState:r.persistentState,sessionTypes:r.sessionTypes},a.length&&(r.audioCapabilities=a),o.length&&(r.videoCapabilities=o),t=r,w(i,navigator.requestMediaKeySystemAccess(e.keySystemConfiguration.keySystem,[t]),2)}return n=i.h,i.return(n)}))}function Mm(e,t){this.h=e,this.g=t,this.keySystem=e.keySystem}function Rm(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.chromecast")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":(console.warn("EmeEncryptionSchemePolyfill: Unknown key system:",e,"Please contribute!"),null)}function Dm(e){var t=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||t)||void 0===e.encryptionScheme)}function Nm(){}function Pm(){wm(),Am()}Yt["text/x-ssa"]=function(){return new sm},F("shaka.util.FairPlayUtils",vm),vm.commonFairPlayResponse=function(e,t){if(2===e){try{var n=Tt(t.data)}catch(e){return}var i=!1;"<ckc>"===(n=n.trim()).substr(0,5)&&"</ckc>"===n.substr(-6)&&(n=n.slice(5,-6),i=!0);try{var r=JSON.parse(n);r.ckc&&(n=r.ckc,i=!0),r.CkcMessage&&(n=r.CkcMessage,i=!0),r.License&&(n=r.License,i=!0)}catch(e){}i&&(t.data=Ae(Rt(n)))}},vm.conaxFairPlayRequest=function(e,t){2===e&&(t.headers["Content-Type"]="application/octet-stream")},vm.ezdrmFairPlayRequest=function(e,t){2===e&&(t.headers["Content-Type"]="application/octet-stream")},vm.verimatrixFairPlayRequest=function(e,t){if(2===e){var n=ke(t.body);n=Mt(n),t.headers["Content-Type"]="application/x-www-form-urlencoded",t.body=Et("spc="+n)}},vm.conaxInitDataTransform=function(t,n,i){if("skd"!==n)return t;n=i.serverCertificate,i=St(t).split("skd://").pop().split("?").shift(),i=e.atob(i);var r=new ArrayBuffer(2*i.length);r=new Uint16Array(r);for(var a=0,o=i.length;a<o;a++)r[a]=i.charCodeAt(a);return ym(t,r,n)},vm.ezdrmInitDataTransform=function(e,t,n){return"skd"!==t?e:(t=n.serverCertificate,ym(e,n=St(e).split(";").pop(),t))},vm.verimatrixInitDataTransform=function(e,t,n){return"skd"!==t?e:(t=n.serverCertificate,ym(e,n=St(e).split("skd://").pop(),t))},vm.initDataTransform=ym,vm.defaultGetContentId=function(e){return new Le(e=St(e)).Ga},vm.isFairPlaySupported=function(){var e;return N((function(t){return 1==t.g?(e={initDataTypes:["cenc","sinf","skd"],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"'}]},x(t,2),w(t,navigator.requestMediaKeySystemAccess("com.apple.fps",[e]),4)):2!=t.g?t.return(!0):(A(t),t.return(!1))}))},F("EmeEncryptionSchemePolyfill",bm),bm.install=wm,F("McEncryptionSchemePolyfill",Em),Em.install=Am,Mm.prototype.getConfiguration=function(){var e=this.h.getConfiguration();if(e.videoCapabilities)for(var t=l(e.videoCapabilities),n=t.next();!n.done;n=t.next())n.value.encryptionScheme=this.g;if(e.audioCapabilities)for(n=(t=l(e.audioCapabilities)).next();!n.done;n=t.next())n.value.encryptionScheme=this.g;return e},Mm.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},F("EncryptionSchemePolyfills",Nm),Nm.install=Pm,void 0!==n&&n.exports&&(n.exports=Nm)}.call(n,e,e,void 0),n.shaka)t[i]=n.shaka[i]}()}(o={exports:{}},o.exports),o.exports);function u(e){l(e.detail)}function l(e){console.error("Error code",e.code,"object",e)}class c extends t{constructor(){super(),this.player=null,s.Player.isBrowserSupported()?(this.player=new s.Player(this.nativeEl),this.player.addEventListener("error",u)):console.error("Browser does not support Shaka Player")}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&this.setAttribute("src",e)}async load(){if(this.src)try{await this.player.load(this.src),console.log("The video has now been loaded!")}catch(e){l(e)}else this.player.unload()}connectedCallback(){this.player&&this.src&&this.load()}disconnectedCallback(){this.player&&this.player.unload()}}window.customElements.get("shaka-video")||(window.customElements.define("shaka-video",c),window.ShakaVideoElement=c);export{c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaka-video-element",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Custom element (web component) for Shaka Player",
5
5
  "type": "module",
6
6
  "main": "dist/shaka-video-element.js",