@playkit-js/playkit-js-providers 2.40.2-canary.0-45b4098 → 2.40.3-canary.0-f4a978f

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return A}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);a(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),a(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));a(_,"_logger",c("MultiRequestResult"));var T=function(e){d(a,e);var t,o,i=(t=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function a(){return r(this,a),i.apply(this,arguments)}return s(a,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var a,u,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(a=h.params,u=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,u[u.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return u}("",a).join("&").replace(/%20/g,"+")),h}}]),a}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",A="2.40.2-canary.0-45b4098";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return A}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);a(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),a(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));a(_,"_logger",c("MultiRequestResult"));var T=function(e){d(a,e);var t,o,i=(t=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function a(){return r(this,a),i.apply(this,arguments)}return s(a,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var a,u,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(a=h.params,u=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,u[u.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return u}("",a).join("&").replace(/%20/g,"+")),h}}]),a}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",A="2.40.3-canary.0-f4a978f";return t}()}));
2
2
  //# sourceMappingURL=playkit-stats-service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/playkit-js-providers",
3
- "version": "2.40.2-canary.0-45b4098",
3
+ "version": "2.40.3-canary.0-f4a978f",
4
4
  "description": "",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -14,11 +14,11 @@
14
14
  "playkit-stats-service/*"
15
15
  ],
16
16
  "exports": {
17
- "./playkit-ovp-provider": "./dist/playkit-ovp-provider.js",
18
- "./playkit-ott-provider": "./dist/playkit-ott-provider.js",
19
- "./playkit-analytics-service": "./dist/playkit-analytics-service.js",
20
- "./playkit-stats-service": "./dist/playkit-stats-service.js",
21
- "./playkit-bookmark-service": "./dist/playkit-bookmark-service.js"
17
+ "./ovp-provider": "./dist/playkit-ovp-provider.js",
18
+ "./ott-provider": "./dist/playkit-ott-provider.js",
19
+ "./analytics-service": "./dist/playkit-analytics-service.js",
20
+ "./stats-service": "./dist/playkit-stats-service.js",
21
+ "./bookmark-service": "./dist/playkit-bookmark-service.js"
22
22
  },
23
23
  "scripts": {
24
24
  "serve": "webpack serve --open --mode=development",
@@ -0,0 +1,31 @@
1
+ export default class DocumentSource {
2
+ /**
3
+ * @member - media source id
4
+ * @type {string}
5
+ */
6
+ public id: string;
7
+ /**
8
+ * @member - media source url
9
+ * @type {string}
10
+ */
11
+ public url: string;
12
+ /**
13
+ * @member - thumbnail url
14
+ * @type {string}
15
+ */
16
+ public thumbnailUrl: string;
17
+ /**
18
+ * @member - media source mimetype
19
+ * @type {string}
20
+ */
21
+ public mimetype: string;
22
+
23
+ constructor(entry: any) {
24
+ this.id = entry.id;
25
+ this.url = entry.downloadUrl;
26
+ this.thumbnailUrl = entry.poster;
27
+ this.mimetype = '';
28
+ }
29
+ }
30
+
31
+ export {DocumentSource}
@@ -8,7 +8,8 @@ export default class MediaEntry {
8
8
  LIVE: 'Live',
9
9
  IMAGE: 'Image',
10
10
  AUDIO: 'Audio',
11
- UNKNOWN: 'Unknown'
11
+ UNKNOWN: 'Unknown',
12
+ DOCUMENT: 'Document'
12
13
  };
13
14
  public static DvrStatus: {[type: string]: number} = {
14
15
  ON: 1,
@@ -1,6 +1,7 @@
1
1
  import MediaSource from './media-source';
2
2
  import {MediaFormat} from './media-format';
3
3
  import {ImageSource} from './image-source';
4
+ import {DocumentSource} from './document-source';
4
5
  import {PKExternalCaptionObject, ProviderMediaFormatType, ProviderMediaSourcesObject} from '../types';
5
6
 
6
7
  export default class MediaSources {
@@ -23,6 +24,7 @@ export default class MediaSources {
23
24
  */
24
25
  public hls: Array<MediaSource>;
25
26
  public image: Array<ImageSource>;
27
+ public document: Array<DocumentSource>;
26
28
  public captions?: Array<PKExternalCaptionObject>;
27
29
 
28
30
  /**
@@ -33,6 +35,7 @@ export default class MediaSources {
33
35
  this.dash = [];
34
36
  this.hls = [];
35
37
  this.image = [];
38
+ this.document = [];
36
39
  }
37
40
 
38
41
  /**
@@ -68,12 +71,14 @@ export default class MediaSources {
68
71
  progressive: [],
69
72
  dash: [],
70
73
  hls: [],
71
- image: []
74
+ image: [],
75
+ document: []
72
76
  };
73
77
  this.progressive.forEach(p => response.progressive.push(p.toJSON()));
74
78
  this.hls.forEach(h => response.hls.push(h.toJSON()));
75
79
  this.dash.forEach(d => response.dash.push(d.toJSON()));
76
80
  response.image = this.image;
81
+ response.document = this.document;
77
82
  return response;
78
83
  }
79
84
  }
@@ -88,7 +88,7 @@ export default class BaseProvider<MI> {
88
88
  }
89
89
 
90
90
  protected _verifyHasSources(sources: ProviderMediaConfigSourcesObject): void {
91
- if (sources.hls.concat(sources.dash, sources.progressive, sources.image).length === 0) {
91
+ if (sources.hls.concat(sources.dash, sources.progressive, sources.image, sources.document).length === 0) {
92
92
  throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.MISSING_PLAY_SOURCE, {
93
93
  action: '',
94
94
  messages: `No play source for entry id: ${sources.id}`
@@ -213,6 +213,7 @@ export default class OTTProvider extends BaseProvider<OTTProviderMediaInfoObject
213
213
  dash: [],
214
214
  progressive: [],
215
215
  image: [],
216
+ document: [],
216
217
  id: '',
217
218
  duration: 0,
218
219
  type: MediaEntry.Type.UNKNOWN,
@@ -21,6 +21,7 @@ import {KalturaAccessControlMessage} from '../common/response-types/kaltura-acce
21
21
  import type {OVPMediaEntryLoaderResponse} from './loaders/media-entry-loader';
22
22
  import {ExternalCaptionsBuilder} from './external-captions-builder';
23
23
  import {ImageSource} from '../../entities/image-source';
24
+ import {DocumentSource} from '../../entities/document-source';
24
25
 
25
26
  class OVPProviderParser {
26
27
  private static _logger = getLogger('OVPProviderParser');
@@ -194,6 +195,9 @@ class OVPProviderParser {
194
195
  case KalturaMediaEntry.EntryType.LIVE_CHANNEL.value:
195
196
  type = MediaEntry.Type.LIVE;
196
197
  break;
198
+ case KalturaMediaEntry.EntryType.DOCUMENT.value:
199
+ type = MediaEntry.Type.DOCUMENT;
200
+ break;
197
201
  default:
198
202
  type = MediaEntry.Type.UNKNOWN;
199
203
  }
@@ -246,6 +250,10 @@ class OVPProviderParser {
246
250
  sources.image.push(new ImageSource(entry));
247
251
  };
248
252
 
253
+ const parseDocumentSources = (): void => {
254
+ sources.document.push(new DocumentSource(entry));
255
+ };
256
+
249
257
  const parseExternalMedia = (): void => {
250
258
  const mediaSource = new MediaSource();
251
259
  mediaSource.mimetype = 'video/youtube';
@@ -258,6 +266,8 @@ class OVPProviderParser {
258
266
  parseExternalMedia();
259
267
  } else if (entry.entryType === KalturaMediaEntry.MediaType.IMAGE.value) {
260
268
  parseImageSources();
269
+ } else if (entry.type === KalturaMediaEntry.EntryType.DOCUMENT.value) {
270
+ parseDocumentSources();
261
271
  } else if (kalturaSources && kalturaSources.length > 0) {
262
272
  parseAdaptiveSources();
263
273
  parseProgressiveSources();
@@ -319,6 +319,7 @@ export default class OVPProvider extends BaseProvider<OVPProviderMediaInfoObject
319
319
  dash: [],
320
320
  progressive: [],
321
321
  image: [],
322
+ document: [],
322
323
  id: '',
323
324
  duration: 0,
324
325
  type: MediaEntry.Type.UNKNOWN,
@@ -340,6 +341,7 @@ export default class OVPProvider extends BaseProvider<OVPProviderMediaInfoObject
340
341
  sourcesObject.dash = mediaSources.dash;
341
342
  sourcesObject.progressive = mediaSources.progressive;
342
343
  sourcesObject.image = mediaSources.image;
344
+ sourcesObject.document = mediaSources.document;
343
345
  sourcesObject.id = mediaEntry.id;
344
346
  sourcesObject.duration = mediaEntry.duration;
345
347
  sourcesObject.type = mediaEntry.type;
@@ -16,13 +16,7 @@ export class KalturaMediaEntries extends ServiceResult {
16
16
  super(responseObj);
17
17
  if (!this.hasError) {
18
18
  this.entries = [];
19
- responseObj.map(entry => {
20
- const kalturaMediaEntry = new KalturaMediaEntry(entry);
21
- if (kalturaMediaEntry.type !== KalturaMediaEntry.EntryType.DOCUMENT.value) {
22
- // filter out documents
23
- this.entries.push(kalturaMediaEntry);
24
- }
25
- });
19
+ responseObj.map(entry => this.entries.push(new KalturaMediaEntry(entry)));
26
20
  }
27
21
  }
28
22
  }
@@ -1,4 +1,5 @@
1
1
  import {ImageSource} from '../entities/image-source';
2
+ import {DocumentSource} from '../entities/document-source';
2
3
  import {ProviderMediaConfigMetadataObject} from './media-config-metadata';
3
4
  import {PKExternalCaptionObject} from './external-caption-object';
4
5
  import {ProviderMediaSourceObject} from './media-source';
@@ -8,6 +9,7 @@ export type ProviderMediaConfigSourcesObject = {
8
9
  hls: Array<ProviderMediaSourceObject>;
9
10
  progressive: Array<ProviderMediaSourceObject>;
10
11
  image: Array<ImageSource>;
12
+ document: Array<DocumentSource>;
11
13
  duration?: number;
12
14
  type: string;
13
15
  id?: string;
@@ -1,4 +1,5 @@
1
1
  import {ImageSource} from '../entities/image-source';
2
+ import {DocumentSource} from '../entities/document-source';
2
3
  import {ProviderMediaSourceObject} from './media-source';
3
4
  import {PKExternalCaptionObject} from './external-caption-object';
4
5
 
@@ -7,5 +8,6 @@ export type ProviderMediaSourcesObject = {
7
8
  dash: Array<ProviderMediaSourceObject>;
8
9
  hls: Array<ProviderMediaSourceObject>;
9
10
  image: Array<ImageSource>;
11
+ document: Array<DocumentSource>;
10
12
  captions?: Array<PKExternalCaptionObject>;
11
13
  };
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@playkit-js/playkit-js-providers/playkit-analytics-service",
3
- "main": "../dist/playkit-analytics-service.js",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@playkit-js/playkit-js-providers/playkit-bookmark-service",
3
- "main": "../dist/playkit-bookmark-service.js",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@playkit-js/playkit-js-providers/playkit-ott-provider",
3
- "main": "../dist/playkit-ott-provider.js",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@playkit-js/playkit-js-providers/playkit-ovp-provider",
3
- "main": "../dist/playkit-ovp-provider.js",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@playkit-js/playkit-js-providers/playkit-stats-service",
3
- "main": "../dist/playkit-stats-service.js",
4
- "sideEffects": false
5
- }