@flowplayer/player 3.37.0 → 3.39.0

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/plugins/drm.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.drm=t())}(this,function(){"use strict";const e="com.widevine.alpha",t="com.microsoft.playready",n="org.w3.clearkey",r="com.apple.fps.1_0",s="license_server",o="http_headers",i="certificate",a="vendor",c="query_params";var d=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:t,CLEARKEY:n,FAIRPLAY:r,LICENSE_SERVER:s,HTTP_HEADERS:o,CERTIFICATE:i,VENDOR:a,REQUEST_MEDIA_KEY_SYSTEM_ACCESS_FUNCTION:"request_media_key_system_access_function",QUERY_PARAMS:c,KEY:"key",KEY_ID:"kid"});function u(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),i=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),d=/SamsungBrowser/.test(t),u=d&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:o,firefox:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:d,samsung_tv:d&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}function f(s){const o={};return Object.keys(s).forEach(function(i){(function(s){const o=u();switch(s){case e:return o.chrome||o.firefox||o.edge||o.opera;case n:return o.chrome||o.firefox;case r:return o.safari;case t:return o.edge}})(i)&&function(e,t,n){Object.assign(n,t),n.emeEnabled=!0,t.request_media_key_system_access_function&&(n.requestMediaKeySystemAccessFunc=t.request_media_key_system_access_function);const s=t.http_headers;s&&(n.licenseXhrSetup=function(e){Object.keys(s).forEach(function(t){e.setRequestHeader(t,s[t])})}),n.drmSystems=n.drmSystems||{},Object.assign(n.drmSystems,{[e===r?"com.apple.fps":e]:{licenseUrl:t.license_server,serverCertificateUrl:t.certificate}})}(i,s[i],o)}),o}function l(r){const i={};return Object.keys(r).forEach(function(a){(function(r){const s=u();switch(r){case e:return s.chrome||s.firefox||s.edge||s.opera;case n:return s.chrome||s.firefox;case t:return s.edge}})(a)&&(i[a]=function(e){return Object.assign({serverURL:e[s],httpRequestHeaders:e[o]},e)}(r[a]))}),i}const y=(e,t)=>fetch(e,t).then(h).then(e=>new Uint8Array(e)),h=e=>{if(e.ok)return e.arrayBuffer();throw m(e)},m=e=>new Error(`http:error status=${e.status} during key retrieval`);var p=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=((e,t)=>e.includes(t.assetId)&&Object.keys(t.queryParams||{}).find(t=>e.includes(t))?e:e.includes(t.assetId)?`${e}?${new URLSearchParams(t.queryParams).toString()}`:`${e}/${t.assetId}?${new URLSearchParams(t.queryParams).toString()}`)(e,t);y(r,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t.message}).then(n)}});var _,g=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=new FormData;var s;r.set("assetid",t.assetId),r.set("spc",(s=t.message,btoa(Array.prototype.map.call(s,function(e){return String.fromCharCode(e)}).join("")))),fetch(e,{method:"POST",body:r,headers:t.headers}).then(e=>{if(e.ok)return e.text();throw m(e)}).then(e=>function(e){const t=atob(e),n=new Uint8Array(t.length);return Array.prototype.forEach.call(t,function(e,t){n[t]=e.charCodeAt(0)}),n}(e)).then(n)}}),w=Object.freeze({__proto__:null,ezdrm:p,buydrm:g});function b(e,t,n){const d=t[r],u=null==d?void 0:d[i];if(!d||!u)return;if(e.src&&0===e.src.indexOf("blob:"))return;const f=d[a]||"ezdrm",l="string"==typeof f?w[f]:f;l.fairplay_fetch_certificate(u,function(i){e.webkitSetMediaKeys(new window.WebKitMediaKeys(r));const a=n.initData,u=function(e){const t=function(e){const t=new Uint16Array(e);return String.fromCharCode(...t)}(e.buffer);return t.substring(t.indexOf("skd:")+6).split(";").pop()}(a);if(!u)return console.debug("flowplayer::drm::fairplay - unable to extract content id from init data");const f=function(e,t,n){"string"==typeof t&&(t=function(e){const t=new ArrayBuffer(2*e.length),n=new Uint16Array(t);return Array(...Array(e.length)).map((e,t)=>t).forEach(t=>{n[t]=e.charCodeAt(t)}),n}(t));let r=0;const s=new ArrayBuffer(e.byteLength+4+t.byteLength+4+n.byteLength),o=new DataView(s),i=new Uint8Array(s,r,e.byteLength);i.set(e),r+=e.byteLength,o.setUint32(r,t.byteLength,!0),r+=4;const a=new Uint16Array(s,r,t.length);a.set(t),r+=a.byteLength,o.setUint32(r,n.byteLength,!0),r+=4;return new Uint8Array(s,r,n.byteLength).set(n),new Uint8Array(s,0,s.byteLength)}(a,u,i),y=e.webkitKeys.createSession("application/x-mpegurl",f);y.addEventListener("webkitkeyerror",console.debug.bind(console,"webkitkeyerror")),y.addEventListener("webkitkeymessage",function(e){const n={message:e.message,assetId:u,headers:d[o]||{},queryParams:t[r][c]||{}};l.fairplay_request_license(d[s],n,e=>y.update(e))})})}const A=((_=class DRM{init(e,t,n){let r;n.on("webkitneedkey",e=>b(n,r.drm||{},e)),n.on("src",t=>{r=t.detail,function(e){var t,n,r,s,o;null===(t=e.hls)||void 0===t||delete t.drmSystems,null===(n=e.hls)||void 0===n||delete n.licenseXhrSetup,null===(r=e.hls)||void 0===r||delete r.requestMediaKeySystemAccessFunc,null===(s=e.hls)||void 0===s||delete s.drmSystemOptions,null===(o=e.hls)||void 0===o||delete o.emeEnabled}(e),this.hls_drm(n,e,t.detail.drm),this.dash_drm(n,e,t.detail.drm)})}hls_drm(e,t,n){if(!n)return;const r=f(n);e.setOpts({hls:Object.assign(t.hls||{},r)})}dash_drm(e,t,n){if(!n)return;const r=t.dash||{},s=l(n);e.setOpts({dash:Object.assign(r,{drm:s})})}}).pluginName="drm",_);Object.assign(A,d);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,A)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.drm=t())}(this,function(){"use strict";const e="com.widevine.alpha",t="com.microsoft.playready",n="org.w3.clearkey",r="com.apple.fps.1_0",s="license_server",o="http_headers",i="certificate",a="vendor",c="query_params";var d=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:t,CLEARKEY:n,FAIRPLAY:r,LICENSE_SERVER:s,HTTP_HEADERS:o,CERTIFICATE:i,VENDOR:a,REQUEST_MEDIA_KEY_SYSTEM_ACCESS_FUNCTION:"request_media_key_system_access_function",QUERY_PARAMS:c,KEY:"key",KEY_ID:"kid"});function u(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),o=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),i=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),d=/SamsungBrowser/.test(t),u=d&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:o,firefox:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:d,samsung_tv:d&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window,anyTv:"tizen"in window||"webos"in window}}function f(s){const o={};return Object.keys(s).forEach(function(i){(function(s){const o=u();switch(s){case e:return o.chrome||o.firefox||o.edge||o.opera;case n:return o.chrome||o.firefox;case r:return o.safari;case t:return o.edge}})(i)&&function(e,t,n){Object.assign(n,t),n.emeEnabled=!0,t.request_media_key_system_access_function&&(n.requestMediaKeySystemAccessFunc=t.request_media_key_system_access_function);const s=t.http_headers;s&&(n.licenseXhrSetup=function(e){Object.keys(s).forEach(function(t){e.setRequestHeader(t,s[t])})}),n.drmSystems=n.drmSystems||{},Object.assign(n.drmSystems,{[e===r?"com.apple.fps":e]:{licenseUrl:t.license_server,serverCertificateUrl:t.certificate}})}(i,s[i],o)}),o}function l(r){const i={};return Object.keys(r).forEach(function(a){(function(r){const s=u();switch(r){case e:return s.chrome||s.firefox||s.edge||s.opera;case n:return s.chrome||s.firefox;case t:return s.edge}})(a)&&(i[a]=function(e){return Object.assign({serverURL:e[s],httpRequestHeaders:e[o]},e)}(r[a]))}),i}const y=(e,t)=>fetch(e,t).then(h).then(e=>new Uint8Array(e)),h=e=>{if(e.ok)return e.arrayBuffer();throw m(e)},m=e=>new Error(`http:error status=${e.status} during key retrieval`);var p=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=((e,t)=>e.includes(t.assetId)&&Object.keys(t.queryParams||{}).find(t=>e.includes(t))?e:e.includes(t.assetId)?`${e}?${new URLSearchParams(t.queryParams).toString()}`:`${e}/${t.assetId}?${new URLSearchParams(t.queryParams).toString()}`)(e,t);y(r,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t.message}).then(n)}});var _,w=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{y(e).then(t)},fairplay_request_license:function(e,t,n){const r=new FormData;var s;r.set("assetid",t.assetId),r.set("spc",(s=t.message,btoa(Array.prototype.map.call(s,function(e){return String.fromCharCode(e)}).join("")))),fetch(e,{method:"POST",body:r,headers:t.headers}).then(e=>{if(e.ok)return e.text();throw m(e)}).then(e=>function(e){const t=atob(e),n=new Uint8Array(t.length);return Array.prototype.forEach.call(t,function(e,t){n[t]=e.charCodeAt(0)}),n}(e)).then(n)}}),g=Object.freeze({__proto__:null,ezdrm:p,buydrm:w});function b(e,t,n){const d=t[r],u=null==d?void 0:d[i];if(!d||!u)return;if(e.src&&0===e.src.indexOf("blob:"))return;const f=d[a]||"ezdrm",l="string"==typeof f?g[f]:f;l.fairplay_fetch_certificate(u,function(i){e.webkitSetMediaKeys(new window.WebKitMediaKeys(r));const a=n.initData,u=function(e){const t=function(e){const t=new Uint16Array(e);return String.fromCharCode(...t)}(e.buffer);return t.substring(t.indexOf("skd:")+6).split(";").pop()}(a);if(!u)return console.debug("flowplayer::drm::fairplay - unable to extract content id from init data");const f=function(e,t,n){"string"==typeof t&&(t=function(e){const t=new ArrayBuffer(2*e.length),n=new Uint16Array(t);return Array(...Array(e.length)).map((e,t)=>t).forEach(t=>{n[t]=e.charCodeAt(t)}),n}(t));let r=0;const s=new ArrayBuffer(e.byteLength+4+t.byteLength+4+n.byteLength),o=new DataView(s),i=new Uint8Array(s,r,e.byteLength);i.set(e),r+=e.byteLength,o.setUint32(r,t.byteLength,!0),r+=4;const a=new Uint16Array(s,r,t.length);a.set(t),r+=a.byteLength,o.setUint32(r,n.byteLength,!0),r+=4;return new Uint8Array(s,r,n.byteLength).set(n),new Uint8Array(s,0,s.byteLength)}(a,u,i),y=e.webkitKeys.createSession("application/x-mpegurl",f);y.addEventListener("webkitkeyerror",console.debug.bind(console,"webkitkeyerror")),y.addEventListener("webkitkeymessage",function(e){const n={message:e.message,assetId:u,headers:d[o]||{},queryParams:t[r][c]||{}};l.fairplay_request_license(d[s],n,e=>y.update(e))})})}const A=((_=class DRM{init(e,t,n){let r;n.on("webkitneedkey",e=>b(n,r.drm||{},e)),n.on("src",t=>{r=t.detail,function(e){var t,n,r,s,o;null===(t=e.hls)||void 0===t||delete t.drmSystems,null===(n=e.hls)||void 0===n||delete n.licenseXhrSetup,null===(r=e.hls)||void 0===r||delete r.requestMediaKeySystemAccessFunc,null===(s=e.hls)||void 0===s||delete s.drmSystemOptions,null===(o=e.hls)||void 0===o||delete o.emeEnabled}(e),this.hls_drm(n,e,t.detail.drm),this.dash_drm(n,e,t.detail.drm)})}hls_drm(e,t,n){if(!n)return;const r=f(n);e.setOpts({hls:Object.assign(t.hls||{},r)})}dash_drm(e,t,n){if(!n)return;const r=t.dash||{},s=l(n);e.setOpts({dash:Object.assign(r,{drm:s})})}}).pluginName="drm",_);Object.assign(A,d);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,A)});