@flowplayer/player 3.8.1 → 3.9.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/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/flowplayer.css +1 -1
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/analytics.js +1 -1
- package/plugins/dash.js +4 -4
- package/plugins/drm.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.js +1 -1
- package/plugins/ovp.js +1 -1
- package/plugins/preview.js +1 -1
- package/plugins/qul.js +1 -1
- package/plugins/subtitles.js +1 -1
- package/plugins/tizen.js +1 -1
- package/plugins/webos.js +1 -1
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.apple.fps.1_0";var n=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:
|
|
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",r="com.apple.fps.1_0";var n=Object.freeze({__proto__:null,WIDEVINE:e,PLAYREADY:t,CLEARKEY:"org.w3.clearkey",FAIRPLAY:r,LICENSE_SERVER:"license_server",KEY:"key",KEY_ID:"kid",HTTP_HEADERS:"http_headers",QUERY_PARAMS:"query_params",CERTIFICATE:"certificate",VENDOR:"vendor",REQUEST_MEDIA_KEY_SYSTEM_ACCESS_FUNCTION:"request_media_key_system_access_function"});function s(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",r=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/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:!r,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:r,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 o(n){const o={};return Object.keys(n).forEach((function(i){(function(n){const o=s();switch(n){case e:return o.chrome||o.firefox||o.edge||o.opera;case"org.w3.clearkey":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,n[i],o)})),o}function i(r){const n={};return Object.keys(r).forEach((function(o){(function(r){const n=s();switch(r){case e:return n.chrome||n.firefox||n.edge||n.opera;case"org.w3.clearkey":return n.chrome||n.firefox;case t:return n.edge}})(o)&&(n[o]=function(e){return Object.assign({serverURL:e.license_server,httpRequestHeaders:e.http_headers},e)}(r[o]))})),n}const a=(e,t)=>fetch(e,t).then(c).then(e=>new Uint8Array(e)),c=e=>{if(e.ok)return e.arrayBuffer();throw d(e)},d=e=>new Error(`http:error status=${e.status} during key retrieval`);var u=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{a(e).then(t)},fairplay_request_license:function(e,t,r){const n=((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);a(n,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t.message}).then(r)}});var f=Object.freeze({__proto__:null,fairplay_fetch_certificate:(e,t)=>{a(e).then(t)},fairplay_request_license:function(e,t,r){const n=new FormData;var s;n.set("assetid",t.assetId),n.set("spc",(s=t.message,btoa(Array.prototype.map.call(s,(function(e){return String.fromCharCode(e)})).join("")))),fetch(e,{method:"POST",body:n,headers:t.headers}).then(e=>{if(e.ok)return e.text();throw d(e)}).then(e=>function(e){const t=atob(e),r=new Uint8Array(t.length);return Array.prototype.forEach.call(t,(function(e,t){r[t]=e.charCodeAt(0)})),r}(e)).then(r)}}),l=Object.freeze({__proto__:null,ezdrm:u,buydrm:f});function y(e,t,n){const s=t[r],o=null==s?void 0:s.certificate;if(!s||!o)return;if(e.src&&0===e.src.indexOf("blob:"))return;const i=s.vendor||"ezdrm",a="string"==typeof i?l[i]:i;a.fairplay_fetch_certificate(o,(function(o){e.webkitSetMediaKeys(new window.WebKitMediaKeys(r));const i=n.initData,c=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()}(i);if(!c)return console.debug("flowplayer::drm::fairplay - unable to extract content id from init data");const d=function(e,t,r){"string"==typeof t&&(t=function(e){const t=new ArrayBuffer(2*e.length),r=new Uint16Array(t);return Array(...Array(e.length)).map((e,t)=>t).forEach(t=>{r[t]=e.charCodeAt(t)}),r}(t));let n=0;const s=new ArrayBuffer(e.byteLength+4+t.byteLength+4+r.byteLength),o=new DataView(s);new Uint8Array(s,n,e.byteLength).set(e),n+=e.byteLength,o.setUint32(n,t.byteLength,!0),n+=4;const i=new Uint16Array(s,n,t.length);i.set(t),n+=i.byteLength,o.setUint32(n,r.byteLength,!0),n+=4;return new Uint8Array(s,n,r.byteLength).set(r),new Uint8Array(s,0,s.byteLength)}(i,c,o),u=e.webkitKeys.createSession("application/x-mpegurl",d);u.addEventListener("webkitkeyerror",console.debug.bind(console,"webkitkeyerror")),u.addEventListener("webkitkeymessage",(function(e){const n={message:e.message,assetId:c,headers:s.http_headers||{},queryParams:t[r].query_params||{}};a.fairplay_request_license(s.license_server,n,e=>u.update(e))}))}))}class DRM{init(e,t,r){let n;r.on("webkitneedkey",e=>y(r,n.drm||{},e)),r.on("src",t=>{n=t.detail,function(e){var t,r,n,s,o;null===(t=e.hls)||void 0===t||delete t.drmSystems,null===(r=e.hls)||void 0===r||delete r.licenseXhrSetup,null===(n=e.hls)||void 0===n||delete n.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(r,e,t.detail.drm),this.dash_drm(r,e,t.detail.drm)})}hls_drm(e,t,r){if(!r)return;const n=o(r);e.setOpts({hls:Object.assign(t.hls||{},n)})}dash_drm(e,t,r){if(!r)return;const n=t.dash||{},s=i(r);e.setOpts({dash:Object.assign(n,{drm:s})})}}return Object.assign(DRM,n),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 r=e.flowplayer;"function"==typeof r?r(t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t))}(window,DRM),DRM}));
|
package/plugins/health.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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",
|
|
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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",f="seeked",p="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function m(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const s=(null==t?void 0:t.debug)||n;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function E(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function g(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const w="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),R=window,I=R._flowplayerTimekeeper||(R._flowplayerTimekeeper={});var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const D=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function N(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}const T=[],A="https://ihi.flowplayer.com/v1/health/events";function b(e){if(e.suspended)return;const t=T.slice(0);T.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),g(function(){try{return"undefined"==typeof window?A:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:A}catch(e){return A}}(),t))}async function S(e,t,n){const i=await U();T.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),T.length<10&&!n||b(e)}const L=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},U=async()=>{const e=Date.now();try{return{adjusted_time:e-await async function(){const e=I.cachedServerOffset;if(e)return e;const t=I.pendingRequest||(I.pendingRequest=fetch(w)),n=await t,i=parseInt(n.headers.get("age")||"0"),o=await n.json(),s=Date.now()-o.millisUtc-1e3*i;return I.cachedServerOffset=s,I.cachedServerOffset}(),client_time:e}}catch(t){return{client_time:e}}},k=(e,t)=>Object.assign(e,{detail:t}),C=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.9.0",commit:"5e10edcaa49f7b86c2d0af0994045a4e87ac4be9",ima_sdk_version:L(),preload:e.opt("preload"),autoplay:D(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:E(e),page_url:N(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function x(e,t,n,i){const o=C(t,e.eventInfo(n)),{before:s,after:r}=i;S(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,M(s),M(r)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,B=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var P;function H(e){switch(e){case P.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case P.MEDIA_ERR_NETWORK:return"a network error occurred";case P.MEDIA_ERR_DECODE:return"unable to decode media content";case P.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case P.NO_INTERNET:return"no internet connection detected";case P.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(P||(P={}));const j=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},K=B();class Health{constructor(e,t){this.session_id=K,this.suspended=!1,this.logger=m("health",t.opts),this.media_session_id=B(),this.play_range_id=B(),this.analyticsLoop=setInterval(()=>b(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=B()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>b(this),2e3)}init(t,m,v){!function(t){t.on(u,(function(n){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(e)}))}(v),v.on("display",e=>{S(this,C(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=C(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),S(this,t)}),[_,d,n,s,r,a,u,e].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),[l,c,p,f,h,i,o].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),v.on("volumechange",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{height:m.clientHeight,width:m.clientWidth}))})),v.on("hls/failover",e=>{const t=C(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;S(this,k(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return x(this,v,e,t)}});let E=Date.now()+5e3;v.on("timeupdate",e=>{if(Date.now()<E)return;E=Date.now()+5e3;const t=C(v,this.eventInfo(e.type));var n;S(this,k(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=C(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return S(this,t,!0);const i=n.code,o={error_message:n.message||H(i),error_code:i,error_stack:n.stack||""};return S(this,k(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=B();S(this,C(v,this.eventInfo(e.type))),b(this)}),v.on("visibilitychange",e=>{S(this,C(v,this.eventInfo(e.type))),b(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Health),Health}));
|