From 8020de989d1699f860b853ce8f2748f6d63a080a Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Mon, 24 Jan 2022 13:01:22 +0000 Subject: [PATCH] chore: update dist --- dist/playkit-ovp-provider.js | 2 +- dist/playkit-ovp-provider.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/playkit-ovp-provider.js b/dist/playkit-ovp-provider.js index 9eebcc1b..6af967d7 100644 --- a/dist/playkit-ovp-provider.js +++ b/dist/playkit-ovp-provider.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ovp=t():(e.playkit=e.playkit||{},e.playkit.providers=e.playkit.providers||{},e.playkit.providers.ovp=t())}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(3);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function e(t,r,n,i){void 0===i&&(i={}),this.severity=t,this.category=r,this.code=n,this.data=i,e._logger.error("Category:"+r+" | Code:"+n+" |",i)};i(a,"Severity",{RECOVERABLE:1,CRITICAL:2}),i(a,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),i(a,"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}),i(a,"_logger",Object(n.b)("Error"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(8);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(){this.metadata=new Map,this.sources=new n.a,this.type=e.Type.UNKNOWN}return e.prototype.toJSON=function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType}},e}();i(a,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),i(a,"DvrStatus",{ON:1,OFF:0})},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){void 0===e&&(e=new Map),i(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),i(this,"_attemptCounter",1),this.headers=e}var t=e.prototype;return t.getUrl=function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")},t.doHttpRequest=function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t},t._createXHR=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,n.a.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,n.a.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,n.a.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)},t._getResponseHeaders=function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))},t._handleError=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._attemptCounter0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));r(11);var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){i(this,"_loadersResponseMap",new Map),i(this,"_loaders",new Map),this._networkRetryConfig=e}var t=e.prototype;return t.add=function(e,t,r){var n=this,i=new e(t);if(i.isValid()){this._loaders.set(e.id,i);var a=this._multiRequest.requests.length,s=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var o=Array.from(new Array(s.length),(function(e,t){return t+a}));this._loadersResponseMap.set(e.id,o)}},t.fetchData=function(){var e=this;return new Promise((function(t,r){e._multiRequest.execute().then((function(i){e._multiResponse=i.response,e.prepareData(i.response).success?t(e._loaders):r(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.API_RESPONSE_MISMATCH,{headers:i.headers}))}),(function(e){r(e)}))}))},t.prepareData=function(e){var t=this;return this._loaders.forEach((function(r,n){var i=t._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=e.results.slice(i[0],i[i.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(2),i=r(3),a=r(4),s=r(0);function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;i0?t.slice(0):[]).forEach((function(t,n){("object"==typeof t&&t!=={}||Array.isArray(t)&&t.length>0)&&(r[n]=e(t))})):"object"==typeof t?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"==typeof r[t]&&r[t]!=={}||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(1);var n=function(){this.items=[]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.url=e.url,this.clickThroughUrl=e.clickThroughUrl}},function(e,t,r){"use strict";r.r(t),r.d(t,"Provider",(function(){return ye})),r.d(t,"NAME",(function(){return ve})),r.d(t,"VERSION",(function(){return _e})),r.d(t,"RequestBuilder",(function(){return K.a})),r.d(t,"ResponseTypes",(function(){return n})),r.d(t,"ServiceResult",(function(){return u.a}));var n={};r.r(n),r.d(n,"KalturaBaseEntryListResponse",(function(){return X})),r.d(n,"KalturaMediaEntry",(function(){return C})),r.d(n,"KalturaAccessControlModifyRequestHostRegexAction",(function(){return g})),r.d(n,"KalturaBumper",(function(){return v})),r.d(n,"KalturaFlavorAsset",(function(){return m})),r.d(n,"KalturaMediaEntries",(function(){return ae})),r.d(n,"KalturaMetadata",(function(){return R})),r.d(n,"KalturaMetadataListResponse",(function(){return O})),r.d(n,"KalturaPlaybackContext",(function(){return I})),r.d(n,"KalturaPlaybackSource",(function(){return d})),r.d(n,"KalturaPlaylist",(function(){return ie})),r.d(n,"KalturaRuleAction",(function(){return y})),r.d(n,"KalturaUIConfResponse",(function(){return me})),r.d(n,"KalturaDrmPlaybackPluginData",(function(){return l.a})),r.d(n,"KalturaAccessControlMessage",(function(){return c.a}));var i=r(3),a=r(14),s={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0},o=function(){function e(){}return e.set=function(e){e&&Object.assign(s,e)},e.get=function(){return Object(a.a)(s)},e}(),u=r(4),c=r(7),l=r(6);var d=function(){function e(e){var t,r,n,i=this;n=[],(r="drm")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(e){return i.drm.push(new l.a(e))}))}var t=e.prototype;return t.hasDrmData=function(){return this.drm&&this.drm.length>0},t.hasFlavorIds=function(){return!!this.flavorIds&&this.flavorIds.length>0},t.getProtocol=function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t},e}();var f,p,h,y=function(e){this.type=e.type};h={DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8},(p="Type")in(f=y)?Object.defineProperty(f,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[p]=h;var g=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).pattern=t.pattern,r.replacement=t.replacement,r.replacmenServerNodeId=t.replacmenServerNodeId,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(y);var m=function(e){this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(m,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var v=function(e){this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(e){return new d(e)})):[]};function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=function(e){var t,r;function n(t){var r;if(E(_(r=e.call(this,t)||this),"sources",[]),E(_(r),"actions",[]),E(_(r),"messages",[]),E(_(r),"flavorAssets",[]),E(_(r),"bumperData",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new c.a(e))}));var i=t.actions;i&&i.map((function(e){e.type===y.Type.REQUEST_HOST_REGEX?r.actions.push(new g(e)):r.actions.push(new y(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new d(e))}));var s=t.flavorAssets;s&&s.map((function(e){return r.flavorAssets.push(new m(e))}));var o=t.bumperData;o&&o.map((function(e){return r.bumperData.push(new v(e))}))}return r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.hasBlockAction=function(){return void 0!==this.getBlockAction()},i.getBlockAction=function(){return this.actions.find((function(e){return e.type===y.Type.BLOCK}))},i.getErrorMessages=function(){return this.messages},i.getRequestHostRegexAction=function(){var e=this.actions.find((function(e){return e.type===y.Type.REQUEST_HOST_REGEX}));if(e instanceof g)return e},n}(u.a);function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=function(e){this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml};b(R,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),b(R,"Status",{VALID:1,INVALID:2,DELETED:3});var O=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.metas=[],t.objects.map((function(e){return r.metas.push(new R(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C=function(e){this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags};T(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),T(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),T(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),T(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var A=function(){function e(){}return e.build=function(e){var t=o.get(),r=t.serviceUrl.substr(0,t.serviceUrl.lastIndexOf("/")),n=e.partnerId,i=e.entryId,a=e.ks,s=e.uiConfId,u=e.format,c=e.protocol,l=e.extension,d=e.flavorIds;if(!(r&&n&&i&&u&&c))return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+c+"/format/"+u,d?f+="/flavorIds/"+d:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==l&&(f+="/a."+l),s&&""!==d&&(f+="?uiConfId="+s),f},e}(),P=function(){function e(){}return e.xmlToJson=function(e){var t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r0&&(t.filter((function(e){return!Object(k.c)(e.format)})).forEach(l),o=t.find((function(t){return Object(k.c)(t.format)&&""!==t.getProtocol(e._getBaseProtocol())})),c.progressive=e._parseProgressiveSources(o,s,r,n,i,a.id)),c},e._parseAdaptiveSource=function(t,r,n,i,a,s){var o=new D.a;if(t){var u="",c=k.b.get(t.format),d=t.getProtocol(e._getBaseProtocol()),f=t.deliveryProfileId,p=t.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),t.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=A.build({entryId:s,flavorIds:t.flavorIds,format:p,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:d})):u=e.addKsToUrl(t.url,n),!u){var y="failed to create play url from source, discarding source: ("+s+"_"+f+"), "+p;return e._logger.warn(y),null}if(o.url=e._applyRegexAction(r,u),o.id=s+"_"+f+","+p,t.hasDrmData()){var g=[];t.drm.forEach((function(e){g.push(new S.a(e.licenseURL,l.a.Scheme[e.scheme],e.certificate))})),o.drmData=g}}return o},e._parseProgressiveSources=function(t,r,n,i,a,s){var o=[],u=[];if(t){var c=t.getProtocol(e._getBaseProtocol()),l=t.format,d=t.deliveryProfileId,f=d+","+l;r.flavorAssets.map((function(t){var p=new D.a;p.id=t.id+f,p.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",p.height=t.height,p.width=t.width,p.bandwidth=1024*t.bitrate,p.label=t.label||t.language;var h=A.build({entryId:s,flavorIds:t.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:t.fileExt,protocol:c});if(""===h)return e._logger.warn("failed to create play url from source, discarding source: ("+s+"_"+d+"), "+l+"."),null;p.url=e._applyRegexAction(r,h),t.height&&t.width?o.push(p):u.push(p)}))}return u.length&&!o.length?u:o},e._parseMetadata=function(e){var t={};return e&&e.metas&&e.metas.length>0&&e.metas.forEach((function(e){if(e.xml){var r,n=new DOMParser;e.xml=e.xml.replace(/\r?\n|\r/g,""),e.xml=e.xml.replace(/>\s*/g,">"),e.xml=e.xml.replace(/>\s*/g,">"),r=n.parseFromString(e.xml,"text/xml");var i=P.xmlToJson(r);Object.keys(i.metadata).forEach((function(e){t[e]=i.metadata[e]["#text"]}))}})),t},e._getBaseProtocol=function(){var e=o.get(),t=/^https?:/.exec(e.cdnUrl),r=t?t[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"},e.hasBlockAction=function(e){return e.playBackContextResult.hasBlockAction()},e.getBlockAction=function(e){return e.playBackContextResult.getBlockAction()},e.getErrorMessages=function(e){return e.playBackContextResult.getErrorMessages()},e._applyRegexAction=function(e,t){var r=e.getRequestHostRegexAction();if(r){var n=new RegExp(r.pattern,"i");if(t.match(n))return t.replace(n,r.replacement+"/")}return t},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(F,"_logger",Object(i.b)("OVPProviderParser"));var q=F.addKsToUrl,B=F,K=r(2),H=r(11),W=function(){function e(){}return e.getMultiRequest=function(e,t,r){var n=o.get(),i=n.serviceParams;Object.assign(i,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new H.a(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s},e}();var G=function e(t){void 0===t&&(t={}),this.type=t.type||e.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status"};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(G,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var Y=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.getPlaybackContext=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="baseEntry",i.action="getPlaybackContext",i.method="POST",i.url=i.getUrl(e),i.tag="baseEntry-getPlaybackContext";return i.params={entryId:r,ks:t,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},i},n.list=function(e,t,r,i,a){var s=new Map;s.set("Content-Type","application/json");var o=new K.a(s);return o.service="baseEntry",o.action="list",o.method="POST",o.url=o.getUrl(e),o.tag="list",o.params=n.getEntryListReqParams(r,t,i,a),o},n.getEntryListReqParams=function(e,t,r,n){var i={};return e?i=r?{redirectFromEntryId:e}:{idEqual:e}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:t,filter:i,responseProfile:new G}},n}(W);var J=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.list=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(e),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:t},i},n}(W);var X=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.entries=[],t.objects.map((function(e){return r.entries.push(new C(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function Q(e,t){for(var r=0;r-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t},a=n,(s=[{key:"env",get:function(){return o.get()}}])&&he(a.prototype,s),u&&he(a,u),n}(ce.a);function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var me=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.name=t.name,r.description=t.description,r.objTypeAsString=t.objTypeAsString,r.width=t.width,r.height=t.height,r.htmlParams=t.htmlParams,r.swfUrl=t.swfUrl,r.confFilePath=t.confFilePath,r.confFile=t.confFile,r.confFileFeatures=t.confFileFeatures,r.config=t.config,r.confVars=t.confVars,r.useCdn=t.useCdn,r.tags=t.tags,r.swfUrlVersion=t.swfUrlVersion,r.created=new Date(0),r.created.setUTCSeconds(t.createdAt),r.updated=new Date(0),r.updated.setUTCSeconds(t.updatedAt),r.html5Url=t.description,r.version=t.description,r.partnerTags=t.description,r.objType=t.description,r.creationMode=t.description),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);ge(me,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),ge(me,"CreationMode",{WIZARD:2,ADVANCED:3});var ve="playkit-js-providers-ovp",_e="2.32.0"}])})); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ovp=t():(e.playkit=e.playkit||{},e.playkit.providers=e.playkit.providers||{},e.playkit.providers.ovp=t())}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(3);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function e(t,r,n,i){void 0===i&&(i={}),this.severity=t,this.category=r,this.code=n,this.data=i,e._logger.error("Category:"+r+" | Code:"+n+" |",i)};i(a,"Severity",{RECOVERABLE:1,CRITICAL:2}),i(a,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),i(a,"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}),i(a,"_logger",Object(n.b)("Error"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(8);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(){this.metadata=new Map,this.sources=new n.a,this.type=e.Type.UNKNOWN}return e.prototype.toJSON=function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType}},e}();i(a,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),i(a,"DvrStatus",{ON:1,OFF:0})},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){void 0===e&&(e=new Map),i(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),i(this,"_attemptCounter",1),this.headers=e}var t=e.prototype;return t.getUrl=function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")},t.doHttpRequest=function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t},t._createXHR=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,n.a.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,n.a.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,n.a.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)},t._getResponseHeaders=function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))},t._handleError=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._attemptCounter0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));r(11);var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){i(this,"_loadersResponseMap",new Map),i(this,"_loaders",new Map),this._networkRetryConfig=e}var t=e.prototype;return t.add=function(e,t,r){var n=this,i=new e(t);if(i.isValid()){this._loaders.set(e.id,i);var a=this._multiRequest.requests.length,s=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var o=Array.from(new Array(s.length),(function(e,t){return t+a}));this._loadersResponseMap.set(e.id,o)}},t.fetchData=function(){var e=this;return new Promise((function(t,r){e._multiRequest.execute().then((function(i){e._multiResponse=i.response,e.prepareData(i.response).success?t(e._loaders):r(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.API_RESPONSE_MISMATCH,{headers:i.headers}))}),(function(e){r(e)}))}))},t.prepareData=function(e){var t=this;return this._loaders.forEach((function(r,n){var i=t._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=e.results.slice(i[0],i[i.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(2),i=r(3),a=r(4),s=r(0);function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;i0?t.slice(0):[]).forEach((function(t,n){("object"==typeof t&&t!=={}||Array.isArray(t)&&t.length>0)&&(r[n]=e(t))})):"object"==typeof t?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"==typeof r[t]&&r[t]!=={}||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(1);var n=function(){this.items=[]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.url=e.url,this.clickThroughUrl=e.clickThroughUrl}},function(e,t,r){"use strict";r.r(t),r.d(t,"Provider",(function(){return ye})),r.d(t,"NAME",(function(){return ve})),r.d(t,"VERSION",(function(){return _e})),r.d(t,"RequestBuilder",(function(){return K.a})),r.d(t,"ResponseTypes",(function(){return n}));var n={};r.r(n),r.d(n,"KalturaBaseEntryListResponse",(function(){return X})),r.d(n,"KalturaMediaEntry",(function(){return C})),r.d(n,"KalturaAccessControlModifyRequestHostRegexAction",(function(){return g})),r.d(n,"KalturaBumper",(function(){return v})),r.d(n,"KalturaFlavorAsset",(function(){return m})),r.d(n,"KalturaMediaEntries",(function(){return ae})),r.d(n,"KalturaMetadata",(function(){return R})),r.d(n,"KalturaMetadataListResponse",(function(){return O})),r.d(n,"KalturaPlaybackContext",(function(){return I})),r.d(n,"KalturaPlaybackSource",(function(){return d})),r.d(n,"KalturaPlaylist",(function(){return ie})),r.d(n,"KalturaRuleAction",(function(){return y})),r.d(n,"KalturaUIConfResponse",(function(){return me})),r.d(n,"KalturaDrmPlaybackPluginData",(function(){return l.a})),r.d(n,"KalturaAccessControlMessage",(function(){return c.a})),r.d(n,"BaseServiceResult",(function(){return u.a}));var i=r(3),a=r(14),s={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0},o=function(){function e(){}return e.set=function(e){e&&Object.assign(s,e)},e.get=function(){return Object(a.a)(s)},e}(),u=r(4),c=r(7),l=r(6);var d=function(){function e(e){var t,r,n,i=this;n=[],(r="drm")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(e){return i.drm.push(new l.a(e))}))}var t=e.prototype;return t.hasDrmData=function(){return this.drm&&this.drm.length>0},t.hasFlavorIds=function(){return!!this.flavorIds&&this.flavorIds.length>0},t.getProtocol=function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t},e}();var f,p,h,y=function(e){this.type=e.type};h={DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8},(p="Type")in(f=y)?Object.defineProperty(f,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[p]=h;var g=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).pattern=t.pattern,r.replacement=t.replacement,r.replacmenServerNodeId=t.replacmenServerNodeId,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(y);var m=function(e){this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(m,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var v=function(e){this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(e){return new d(e)})):[]};function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=function(e){var t,r;function n(t){var r;if(E(_(r=e.call(this,t)||this),"sources",[]),E(_(r),"actions",[]),E(_(r),"messages",[]),E(_(r),"flavorAssets",[]),E(_(r),"bumperData",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new c.a(e))}));var i=t.actions;i&&i.map((function(e){e.type===y.Type.REQUEST_HOST_REGEX?r.actions.push(new g(e)):r.actions.push(new y(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new d(e))}));var s=t.flavorAssets;s&&s.map((function(e){return r.flavorAssets.push(new m(e))}));var o=t.bumperData;o&&o.map((function(e){return r.bumperData.push(new v(e))}))}return r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.hasBlockAction=function(){return void 0!==this.getBlockAction()},i.getBlockAction=function(){return this.actions.find((function(e){return e.type===y.Type.BLOCK}))},i.getErrorMessages=function(){return this.messages},i.getRequestHostRegexAction=function(){var e=this.actions.find((function(e){return e.type===y.Type.REQUEST_HOST_REGEX}));if(e instanceof g)return e},n}(u.a);function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=function(e){this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml};b(R,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),b(R,"Status",{VALID:1,INVALID:2,DELETED:3});var O=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.metas=[],t.objects.map((function(e){return r.metas.push(new R(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C=function(e){this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags};T(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),T(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),T(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),T(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var A=function(){function e(){}return e.build=function(e){var t=o.get(),r=t.serviceUrl.substr(0,t.serviceUrl.lastIndexOf("/")),n=e.partnerId,i=e.entryId,a=e.ks,s=e.uiConfId,u=e.format,c=e.protocol,l=e.extension,d=e.flavorIds;if(!(r&&n&&i&&u&&c))return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+c+"/format/"+u,d?f+="/flavorIds/"+d:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==l&&(f+="/a."+l),s&&""!==d&&(f+="?uiConfId="+s),f},e}(),P=function(){function e(){}return e.xmlToJson=function(e){var t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r0&&(t.filter((function(e){return!Object(k.c)(e.format)})).forEach(l),o=t.find((function(t){return Object(k.c)(t.format)&&""!==t.getProtocol(e._getBaseProtocol())})),c.progressive=e._parseProgressiveSources(o,s,r,n,i,a.id)),c},e._parseAdaptiveSource=function(t,r,n,i,a,s){var o=new D.a;if(t){var u="",c=k.b.get(t.format),d=t.getProtocol(e._getBaseProtocol()),f=t.deliveryProfileId,p=t.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),t.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=A.build({entryId:s,flavorIds:t.flavorIds,format:p,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:d})):u=e.addKsToUrl(t.url,n),!u){var y="failed to create play url from source, discarding source: ("+s+"_"+f+"), "+p;return e._logger.warn(y),null}if(o.url=e._applyRegexAction(r,u),o.id=s+"_"+f+","+p,t.hasDrmData()){var g=[];t.drm.forEach((function(e){g.push(new S.a(e.licenseURL,l.a.Scheme[e.scheme],e.certificate))})),o.drmData=g}}return o},e._parseProgressiveSources=function(t,r,n,i,a,s){var o=[],u=[];if(t){var c=t.getProtocol(e._getBaseProtocol()),l=t.format,d=t.deliveryProfileId,f=d+","+l;r.flavorAssets.map((function(t){var p=new D.a;p.id=t.id+f,p.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",p.height=t.height,p.width=t.width,p.bandwidth=1024*t.bitrate,p.label=t.label||t.language;var h=A.build({entryId:s,flavorIds:t.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:t.fileExt,protocol:c});if(""===h)return e._logger.warn("failed to create play url from source, discarding source: ("+s+"_"+d+"), "+l+"."),null;p.url=e._applyRegexAction(r,h),t.height&&t.width?o.push(p):u.push(p)}))}return u.length&&!o.length?u:o},e._parseMetadata=function(e){var t={};return e&&e.metas&&e.metas.length>0&&e.metas.forEach((function(e){if(e.xml){var r,n=new DOMParser;e.xml=e.xml.replace(/\r?\n|\r/g,""),e.xml=e.xml.replace(/>\s*/g,">"),e.xml=e.xml.replace(/>\s*/g,">"),r=n.parseFromString(e.xml,"text/xml");var i=P.xmlToJson(r);Object.keys(i.metadata).forEach((function(e){t[e]=i.metadata[e]["#text"]}))}})),t},e._getBaseProtocol=function(){var e=o.get(),t=/^https?:/.exec(e.cdnUrl),r=t?t[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"},e.hasBlockAction=function(e){return e.playBackContextResult.hasBlockAction()},e.getBlockAction=function(e){return e.playBackContextResult.getBlockAction()},e.getErrorMessages=function(e){return e.playBackContextResult.getErrorMessages()},e._applyRegexAction=function(e,t){var r=e.getRequestHostRegexAction();if(r){var n=new RegExp(r.pattern,"i");if(t.match(n))return t.replace(n,r.replacement+"/")}return t},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(F,"_logger",Object(i.b)("OVPProviderParser"));var q=F.addKsToUrl,B=F,K=r(2),H=r(11),W=function(){function e(){}return e.getMultiRequest=function(e,t,r){var n=o.get(),i=n.serviceParams;Object.assign(i,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new H.a(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s},e}();var G=function e(t){void 0===t&&(t={}),this.type=t.type||e.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status"};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(G,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var Y=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.getPlaybackContext=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="baseEntry",i.action="getPlaybackContext",i.method="POST",i.url=i.getUrl(e),i.tag="baseEntry-getPlaybackContext";return i.params={entryId:r,ks:t,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},i},n.list=function(e,t,r,i,a){var s=new Map;s.set("Content-Type","application/json");var o=new K.a(s);return o.service="baseEntry",o.action="list",o.method="POST",o.url=o.getUrl(e),o.tag="list",o.params=n.getEntryListReqParams(r,t,i,a),o},n.getEntryListReqParams=function(e,t,r,n){var i={};return e?i=r?{redirectFromEntryId:e}:{idEqual:e}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:t,filter:i,responseProfile:new G}},n}(W);var J=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.list=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(e),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:t},i},n}(W);var X=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.entries=[],t.objects.map((function(e){return r.entries.push(new C(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function Q(e,t){for(var r=0;r-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t},a=n,(s=[{key:"env",get:function(){return o.get()}}])&&he(a.prototype,s),u&&he(a,u),n}(ce.a);function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var me=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.name=t.name,r.description=t.description,r.objTypeAsString=t.objTypeAsString,r.width=t.width,r.height=t.height,r.htmlParams=t.htmlParams,r.swfUrl=t.swfUrl,r.confFilePath=t.confFilePath,r.confFile=t.confFile,r.confFileFeatures=t.confFileFeatures,r.config=t.config,r.confVars=t.confVars,r.useCdn=t.useCdn,r.tags=t.tags,r.swfUrlVersion=t.swfUrlVersion,r.created=new Date(0),r.created.setUTCSeconds(t.createdAt),r.updated=new Date(0),r.updated.setUTCSeconds(t.updatedAt),r.html5Url=t.description,r.version=t.description,r.partnerTags=t.description,r.objType=t.description,r.creationMode=t.description),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);ge(me,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),ge(me,"CreationMode",{WIZARD:2,ADVANCED:3});var ve="playkit-js-providers-ovp",_e="2.32.0"}])})); //# sourceMappingURL=playkit-ovp-provider.js.map \ No newline at end of file diff --git a/dist/playkit-ovp-provider.js.map b/dist/playkit-ovp-provider.js.map index bc1629c1..43ab8187 100644 --- a/dist/playkit-ovp-provider.js.map +++ b/dist/playkit-ovp-provider.js.map @@ -1 +1 @@ -{"version":3,"sources":["./providers/webpack/universalModuleDefinition","./providers/webpack/bootstrap","./providers/./util/error/error.js","./providers/./util/error/severity.js","./providers/./util/error/category.js","./providers/./util/error/code.js","./providers/./entities/media-entry.js","./providers/./util/request-builder.js","./providers/./util/logger.js","./providers/./k-provider/common/base-service-result.js","./providers/./entities/media-format.js","./providers/./k-provider/common/response-types/kaltura-drm-playback-plugin-data.js","./providers/./k-provider/common/response-types/kaltura-access-control-message.js","./providers/./entities/media-sources.js","./providers/./entities/media-source.js","./providers/./k-provider/common/data-loader-manager.js","./providers/./k-provider/common/multi-request-builder.js","./providers/./entities/drm.js","./providers/./k-provider/common/base-provider.js","./providers/./util/clone.js","./providers/./entities/entry-list.js","./providers/./entities/bumper.js","./providers/./k-provider/ovp/config.js","./providers/./k-provider/ovp/response-types/kaltura-playback-source.js","./providers/./k-provider/ovp/response-types/kaltura-rule-action.js","./providers/./k-provider/ovp/response-types/kaltura-access-control-modify-request-host-regex-action.js","./providers/./k-provider/ovp/response-types/kaltura-flavor-asset.js","./providers/./k-provider/ovp/response-types/kaltura-bumper.js","./providers/./k-provider/ovp/response-types/kaltura-playback-context.js","./providers/./k-provider/ovp/response-types/kaltura-metadata.js","./providers/./k-provider/ovp/response-types/kaltura-metadata-list-response.js","./providers/./k-provider/ovp/response-types/kaltura-media-entry.js","./providers/./k-provider/ovp/play-source-url-builder.js","./providers/./util/xml-parser.js","./providers/./entities/playlist.js","./providers/./k-provider/ovp/external-captions-builder.js","./providers/./k-provider/ovp/provider-parser.js","./providers/./k-provider/ovp/services/ovp-service.js","./providers/./k-provider/ovp/request-params/base-entry-response-profile.js","./providers/./k-provider/ovp/services/base-entry-service.js","./providers/./k-provider/ovp/services/meta-data-service.js","./providers/./k-provider/ovp/response-types/kaltura-base-entry-list-response.js","./providers/./k-provider/ovp/loaders/media-entry-loader.js","./providers/./k-provider/ovp/services/session-service.js","./providers/./k-provider/ovp/loaders/session-loader.js","./providers/./k-provider/ovp/loaders/data-loader-manager.js","./providers/./k-provider/ovp/services/playlist-service.js","./providers/./k-provider/ovp/response-types/kaltura-playlist.js","./providers/./k-provider/ovp/response-types/kaltura-media-entries.js","./providers/./k-provider/ovp/loaders/playlist-loader.js","./providers/./k-provider/ovp/loaders/entry-list-loader.js","./providers/./k-provider/ovp/provider.js","./providers/./k-provider/ovp/response-types/kaltura-ui-conf-response.js","./providers/./k-provider/ovp/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Error","severity","category","code","data","this","_logger","error","RECOVERABLE","CRITICAL","NETWORK","SERVICE","PROVIDER","UNSUPPORTED_SCHEME","BAD_HTTP_STATUS","HTTP_ERROR","TIMEOUT","MALFORMED_DATA_URI","BAD_SERVER_RESPONSE","MULTIREQUEST_API_ERROR","API_RESPONSE_MISMATCH","ERROR","BLOCK_ACTION","MEDIA_STATUS_NOT_READY","MISSING_MANDATORY_PARAMS","MISSING_PLAY_SOURCE","METHOD_NOT_IMPLEMENTED","getLogger","MediaEntry","metadata","Map","sources","MediaSources","type","Type","UNKNOWN","toJSON","id","duration","dvrStatus","status","poster","assetReferenceType","VOD","LIVE","IMAGE","AUDIO","ON","OFF","RequestBuilder","headers","async","timeout","maxAttempts","getUrl","serviceUrl","service","action","doHttpRequest","promise","Promise","resolve","reject","_requestPromise","url","Severity","Category","Code","_createXHR","request","XMLHttpRequest","onreadystatechange","readyState","response","JSON","parse","responseText","responseHeaders","_getResponseHeaders","_createError","text","open","method","retryConfig","requestTime","performance","now","ontimeout","_handleError","statusText","onerror","onabort","forEach","setRequestHeader","send","params","getAllResponseHeaders","split","filter","header","toLowerCase","indexOf","_attemptCounter","assign","attempt","JsLogger","VERSION","DEBUG","INFO","TIME","TRACE","WARN","createDefaultHandler","debug","enabledFor","getLevel","info","log","setHandler","setLevel","time","timeEnd","trace","useDefaults","warn","LogLevel","setLogger","logger","getLogLevel","setLogLevel","level","ServiceResult","objectType","hasError","ServiceError","message","MediaFormat","DASH","mimeType","pathExt","HLS","WVM","MP4","MP3","SupportedStreamFormat","isProgressiveSource","formatName","sourceFormat","KalturaDrmPlaybackPluginData","drm","scheme","licenseURL","certificate","WIDEVINE_CENC","PLAYREADY_CENC","FAIRPLAY","KalturaAccessControlMessage","progressive","dash","hls","map","source","mediaFormat","push","h","MediaSource","mimetype","bandwidth","width","height","label","drmData","length","Array","isArray","DataLoaderManager","networkRetryConfig","_networkRetryConfig","add","loader","ks","execution_loader","isValid","_loaders","set","startIndex","_multiRequest","requests","executionLoaderResponseMap","from","val","index","_loadersResponseMap","fetchData","execute","then","_multiResponse","prepareData","success","err","loaderDataIndexes","results","slice","MultiRequestBuilder","requestParams","serviceDef","stringify","FAILED_PARSING_REQUEST","multiRequestResult","MultiRequestResult","result","serviceResult","Drm","licenseUrl","BaseProvider","options","playerVersion","_partnerId","partnerId","_widgetId","widgetId","_uiConfId","uiConfId","_isAnonymous","_ks","_playerVersion","defaultWidgetId","getMediaConfig","mediaInfo","getPlaylistConfig","playlistInfo","getEntryListConfig","entryListInfo","_verifyHasSources","concat","messages","clone","node","e","keys","EntryList","items","Bumper","clickThroughUrl","defaultConfig","cdnUrl","serviceParams","apiVersion","format","useApiCaptions","OVPConfiguration","clientConfig","KalturaPlaybackSource","deliveryProfileId","protocols","flavorIds","hasDrmData","hasFlavorIds","getProtocol","protocol","returnValue","KalturaRuleAction","DRM_POLICY","BLOCK","PREVIEW","LIMIT_FLAVORS","ADD_TO_STORAGE","LIMIT_DELIVERY_PROFILES","SERVE_FROM_REMOTE_SERVER","REQUEST_HOST_REGEX","LIMIT_THUMBNAIL_CAPTURE","KalturaAccessControlModifyRequestHostRegexAction","pattern","replacement","replacmenServerNodeId","KalturaFlavorAsset","flavorParamsId","fileExt","bitrate","frameRate","isOriginal","isWeb","containerFormat","videoCodecId","language","QUEUED","CONVERTING","READY","DELETED","NOT_APPLICABLE","TEMP","WAIT_FOR_CONVERT","IMPORTING","VALIDATING","EXPORTING","KalturaBumper","entryId","KalturaPlaybackContext","actions","flavorAssets","flavor","bumperData","bumper","hasBlockAction","undefined","getBlockAction","find","getErrorMessages","getRequestHostRegexAction","KalturaMetadata","metadataProfileId","metadataProfileVersion","metadataObjectType","objectId","version","created","Date","setUTCSeconds","createdAt","updated","updatedAt","xml","AD_CUE_POINT","ANNOTATION","CODE_CUE_POINT","THUMB_CUE_POINT","ENTRY","CATEGORY","USER","PARTNER","DYNAMIC_OBJECT","VALID","INVALID","KalturaMetadataListResponse","responseObj","totalCount","metas","objects","meta","KalturaMediaEntry","entry","referenceId","externalSourceType","description","dataUrl","entryType","mediaType","flavorParamsIds","thumbnailUrl","tags","AUTOMATIC","EXTERNAL_MEDIA","MEDIA_CLIP","MIX","PLAYLIST","DATA","LIVE_STREAM","LIVE_CHANNEL","DOCUMENT","VIDEO","LIVE_STREAM_FLASH","LIVE_STREAM_WINDOWS_MEDIA","LIVE_STREAM_REAL_MEDIA","LIVE_STREAM_QUICK_TIME","ERROR_IMPORTING","ERROR_CONVERTING","SCAN_FAILURE","IMPORT","INFECTED","PRECONVERT","PENDING","MODERATE","BLOCKED","NO_CONTENT","PENDING_MODERATION","APPROVED","REJECTED","FLAGGED_FOR_REVIEW","AUTO_APPROVED","PlaySourceUrlBuilder","build","urlParams","config","serviceUrlOrigin","substr","lastIndexOf","extension","playUrl","endsWith","XmlParser","xmlToJson","obj","nodeType","attributes","j","attribute","item","nodeName","nodeValue","hasChildNodes","childNodes","old","Playlist","KalturaCaptionType","SRT","DFXP","WEBVTT","CAP","CaptionsFormatsMap","ExternalCaptionsBuilder","createConfig","captions","caption","includes","webVttUrl","addKsToUrl","default","isDefault","languageCode","OVPProviderParser","getMediaEntry","mediaEntryResponse","mediaEntry","playbackContext","playBackContextResult","metadataList","metadataListResult","kalturaSources","_getParsedSources","playbackCaptions","_fillBaseData","ksParam","replace","getPlaylist","playlistResponse","playlist","playlistData","playlistItems","entries","getEntryList","entryList","getBumper","assetResponse","progressiveBumper","parsedSources","_parseProgressiveSources","_parseMetadata","_getEntryType","entryTypeEnum","typeEnum","MediaType","EntryType","progressiveSource","mediaSource","addAdaptiveSource","parsedSource","_parseAdaptiveSource","_getBaseProtocol","kalturaSource","_applyRegexAction","drmParams","Scheme","videoSources","audioSources","sourceId","metaXml","domParser","DOMParser","parseFromString","metasObj","exec","document","location","regexAction","regex","RegExp","match","OVPService","getMultiRequest","ovpParams","clientTag","multiReq","BaseEntryResponseProfile","responseProfile","INCLUDE_FIELDS","fields","EXCLUDE_FIELDS","OVPBaseEntryService","getPlaybackContext","serviceEntryId","tag","contextDataParams","flavorTags","list","redirectFromEntryId","getEntryListReqParams","filterParams","idEqual","referenceIdEqual","OVPMetadataService","objectIdEqual","metadataObjectTypeEqual","KalturaBaseEntryListResponse","OVPMediaEntryLoader","buildRequests","_entryId","_referenceId","_requests","_response","OVPSessionService","anonymousSession","OVPSessionLoader","OVPDataLoaderManager","OVPPlaylistService","playlistId","SERVICE_NAME","KalturaPlaylist","KalturaMediaEntries","OVPPlaylistLoader","_playlistId","OVPEntryListLoader","_entries","OVPProvider","env","_setFilterOptionsConfig","filterOptions","networkRetryParameters","_dataLoader","_getEntryRedirectFilter","_parseDataFromResponse","doRequest","loaders","theKs","dataLoader","loaderRequest","_filterOptionsConfig","mediaConfig","session","isAnonymous","_getDefaultSourcesObject","plugins","has","sessionLoader","mediaLoader","_getSourcesObject","_verifyMediaStatus","EntryStatus","_parsePlaylistDataFromResponse","playlistConfig","_getPlaylistObject","playlistLoader","_parseEntryListDataFromResponse","dvr","vr","sourcesObject","mediaSources","KalturaUIConfResponse","objTypeAsString","htmlParams","swfUrl","confFilePath","confFile","confFileFeatures","confVars","useCdn","swfUrlVersion","html5Url","partnerTags","objType","creationMode","PLAYER","CONTRIBUTION_WIZARD","SIMPLE_EDITOR","ADVANCED_EDITOR","APP_STUDIO","KRECORD","PLAYER_V3","KMC_ACCOUNT","KMC_ANALYTICS","KMC_CONTENT","KMC_DASHBOARD","KMC_LOGIN","PLAYER_SL","CLIENTSIDE_ENCODER","KMC_GENERAL","KMC_ROLES_AND_PERMISSIONS","CLIPPER","KSR","KUPLOAD","WEBCASTING","WIZARD","ADVANCED","NAME","__NAME__","__VERSION__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,KAEjBD,EAAc,QAAIA,EAAc,SAAK,GAAIA,EAAc,QAAa,UAAIA,EAAc,QAAa,WAAK,GAAIA,EAAc,QAAa,UAAO,IAAIC,KARpJ,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM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AKmV,YACpB,EAAKgO,YAAcnjB,EAAKmV,YACxB,EAAKiO,QAAUpjB,EAAKmV,YACpB,EAAKkO,aAAerjB,EAAKmV,aA1BH,EAzD5B,O,EAAA,G,EAAA,G,6EAAA,GAA2CpN,K,GAA9Bya,G,OAC6B,CACtCc,OAAQ,EACRC,oBAAqB,EACrBC,cAAe,EACfC,gBAAiB,EACjB3N,SAAU,EACV4N,WAAY,EACZC,QAAS,EACTC,UAAW,EACXC,YAAa,EACbC,cAAe,GACfC,YAAa,GACbC,cAAe,GACfC,UAAW,GACXC,UAAW,GACXC,mBAAoB,GACpBC,YAAa,GACbC,0BAA2B,GAC3BC,QAAS,GACTC,IAAK,GACLC,QAAS,GACTC,WAAY,K,GAtBHjC,G,eAyBqC,CAC9CkC,OAAQ,EACRC,SAAU,ICrBd,IAAMC,GAAOC,2BACPve,GAAUwe","file":"playkit-ovp-provider.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ovp\"] = factory();\n\telse\n\t\troot[\"playkit\"] = root[\"playkit\"] || {}, root[\"playkit\"][\"providers\"] = root[\"playkit\"][\"providers\"] || {}, root[\"playkit\"][\"providers\"][\"ovp\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 17);\n","//@flow\nimport getLogger from '../logger';\nimport {Severity} from './severity';\nimport type {SeverityType} from './severity';\nimport {Code} from './code';\nimport type {CodeType} from './code';\nimport {Category} from './category';\nimport type {CategoryType} from './category';\n\nconst CLASS_NAME: string = 'Error';\n\n/**\n * @classdesc This is a description of the error class.\n */\nexport default class Error {\n severity: number;\n category: number;\n code: number;\n data: any;\n /**\n * @enum {number}\n */\n static Severity: SeverityType = Severity;\n /**\n * @enum {number}\n */\n static Category: CategoryType = Category;\n /**\n * @enum {number}\n */\n static Code: CodeType = Code;\n static _logger: any = getLogger(CLASS_NAME);\n\n /**\n * @constructor\n * @param {number} severity - error's severity\n * @param {number} category - error's category.\n * @param {number} code - error's code.\n * @param {any} data - additional data for the error.\n */\n constructor(severity: number, category: number, code: number, data: any = {}) {\n this.severity = severity;\n this.category = category;\n this.code = code;\n this.data = data;\n Error._logger.error(`Category:${category} | Code:${code} |`, data);\n }\n}\n","//@flow\n\ntype SeverityType = {[severity: string]: number};\n\nconst Severity: SeverityType = {\n /**\n * An error occurred, but the Player is attempting to recover from the error.\n *\n * If the Player cannot ultimately recover, it still may not throw a CRITICAL\n * error. For example, retrying for a media segment will never result in\n * a CRITICAL error (the Player will just retry forever).\n */\n RECOVERABLE: 1,\n /**\n * A critical error that the library cannot recover from. These usually cause\n * the Player to stop loading or updating. A new manifest must be loaded\n * to reset the library.\n */\n CRITICAL: 2\n};\n\nexport {Severity};\nexport type {SeverityType};\n","//@flow\ntype CategoryType = {[category: string]: number};\n\nconst Category: CategoryType = {\n /** Errors from the network stack. */\n NETWORK: 1,\n SERVICE: 2,\n PROVIDER: 3\n};\n\nexport {Category};\nexport type {CategoryType};\n","//@flow\n\ntype CodeType = {[code: string]: number};\n\nconst Code: CodeType = {\n /**\n * A network request was made using an unsupported URI scheme.\n */\n UNSUPPORTED_SCHEME: 1000,\n\n /**\n * An HTTP network request returned an HTTP status that indicated a failure.\n */\n BAD_HTTP_STATUS: 1001,\n\n /**\n * An HTTP network request failed with an error, but not from the server.\n */\n HTTP_ERROR: 1002,\n\n /**\n * A network request timed out.\n */\n TIMEOUT: 1003,\n\n /**\n * A network request was made with a malformed data URI.\n */\n MALFORMED_DATA_URI: 1004,\n\n /**\n * The server responsded with 2xx response, but it couldn't be parsed\n */\n BAD_SERVER_RESPONSE: 1005,\n\n /**\n * The server response had a valid structure but contained an error from the API\n */\n MULTIREQUEST_API_ERROR: 1006,\n\n /**\n * The server response had a valid structure and valid API result, but it did not match the request\n */\n API_RESPONSE_MISMATCH: 1007,\n\n /**\n * The server responded with an error\n */\n ERROR: 2000,\n\n /**\n * The server responded with a block action\n */\n BLOCK_ACTION: 2001,\n\n /**\n * The server responded with status import or pre convert\n */\n MEDIA_STATUS_NOT_READY: 2002,\n\n /**\n * The provider is missing mandatory parameter/s\n */\n\n MISSING_MANDATORY_PARAMS: 3000,\n\n /**\n * The server responded with empty sources objects (for HLS, Dash and progressive)\n */\n MISSING_PLAY_SOURCE: 3001,\n\n /**\n * The provider doesn't implement the called api\n */\n METHOD_NOT_IMPLEMENTED: 3002\n};\n\nexport {Code};\nexport type {CodeType};\n","//@flow\nimport MediaSources from './media-sources';\n\nexport default class MediaEntry {\n static Type: {[type: string]: string} = {\n VOD: 'Vod',\n LIVE: 'Live',\n IMAGE: 'Image',\n AUDIO: 'Audio',\n UNKNOWN: 'Unknown'\n };\n static DvrStatus: {[type: string]: number} = {\n ON: 1,\n OFF: 0\n };\n\n /**\n * @member - entry id\n * @type {string}\n */\n id: string;\n /**\n * @member - entry name\n * @type {string}\n */\n name: string;\n /**\n * @member - entry sources\n * @type {MediaSources}\n */\n sources: MediaSources;\n /**\n * @member - entry duration\n * @type {number}\n */\n duration: number;\n /**\n * @member - entry type\n * @type {string}\n */\n type: string;\n /**\n * @member - entry metadata\n * @type {Object}\n */\n metadata: Object;\n /**\n * @member - DVR status\n * @type {number}\n */\n dvrStatus: number;\n /**\n * @member - media status\n * @type {number}\n */\n status: number;\n /**\n * @member - media poster\n * @type {string | Array}\n */\n poster: string | Array;\n\n /**\n * @member - assetReferenceType\n * @type {string }\n */\n assetReferenceType: string;\n\n /**\n * @constructor\n */\n constructor() {\n this.metadata = new Map();\n this.sources = new MediaSources();\n this.type = MediaEntry.Type.UNKNOWN;\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaEntryObject} - The json class object.\n */\n toJSON(): ProviderMediaEntryObject {\n return {\n id: this.id,\n name: this.name,\n sources: this.sources.toJSON(),\n duration: this.duration,\n dvrStatus: this.dvrStatus,\n status: this.status,\n metadata: this.metadata,\n type: this.type,\n poster: this.poster,\n assetReferenceType: this.assetReferenceType\n };\n }\n}\n","//@flow\nimport Error from './error/error';\n\nconst KALTURA_HEADER_PREFIX: string = 'x-';\n\nexport default class RequestBuilder {\n /**\n * @member - Service name\n * @type {string}\n */\n service: string;\n /**\n * @member - Service action\n * @type {string}\n */\n action: string;\n /**\n * @member - Service params\n * @type {any}\n */\n params: any;\n /**\n * @memberof - Service headers\n * @type {Map}\n */\n headers: Map;\n /**\n * @memberof - Service URL\n * @type {string}\n */\n url: string;\n /**\n * @memberof - Service method (POST,GET,DELETE etc..)\n * @type {string}\n */\n method: string;\n /**\n * @memberof - Service tag\n * @type {string}\n */\n tag: string;\n /**\n * @memberof - the response headers of the arra\n * @type {Array}\n */\n responseHeaders: Array;\n /**\n * @description network retry configuration\n * @memberof RequestBuilder\n * @type {ProviderNetworkRetryParameters}\n */\n retryConfig: ProviderNetworkRetryParameters = {\n async: true,\n timeout: 0,\n maxAttempts: 4\n };\n\n /**\n * @description number of xhr attempts for the same multi - request.\n * @memberof RequestBuilder\n * @type {number}\n * @private\n */\n _attemptCounter: number = 1;\n\n /**\n * @description hold the promise result of the XHR request(s) - if all tries fails, it rejects with the error.\n * @memberof RequestBuilder\n * @type {Object}\n * @private\n */\n _requestPromise: Object;\n\n /**\n * @constructor\n * @param {Map} headers The request headers\n */\n constructor(headers: Map = new Map()) {\n this.headers = headers;\n }\n\n /**\n * Builds restful service URL\n * @function getUrl\n * @param {string} serviceUrl - The service base URL\n * @returns {string} The service URL\n */\n getUrl(serviceUrl: string): string {\n return serviceUrl + '/service/' + this.service + (this.action ? '/action/' + this.action : '');\n }\n\n /**\n * Executes service\n * @function doHttpRequest\n * @returns {Promise.} Service response as promise\n */\n doHttpRequest(): Promise {\n const promise = new Promise((resolve, reject) => {\n this._requestPromise = {\n resolve,\n reject\n };\n });\n if (!this.url) {\n this._requestPromise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.MALFORMED_DATA_URI, {\n url: this.url\n })\n );\n }\n this._createXHR();\n return promise;\n }\n\n _createXHR(): void {\n let request = new XMLHttpRequest();\n request.onreadystatechange = () => {\n if (request.readyState === 4) {\n if (request.status === 200) {\n try {\n const response = JSON.parse(request.responseText);\n this.responseHeaders = this._getResponseHeaders(request);\n // the promise returns the response for backwards compatibility\n return this._requestPromise.resolve(response);\n } catch (error) {\n this._requestPromise.reject(\n this._createError(request, Error.Code.BAD_SERVER_RESPONSE, {\n text: request.responseText\n })\n );\n }\n }\n }\n };\n request.open(this.method, this.url, this.retryConfig.async);\n if (this.retryConfig.async && this.retryConfig.timeout) {\n request.timeout = this.retryConfig.timeout;\n }\n const requestTime = performance.now();\n request.ontimeout = () => {\n this._handleError(request, Error.Code.TIMEOUT, {\n timeout: (performance.now() - requestTime) / 1000,\n statusText: request.statusText\n });\n };\n request.onerror = request.onabort = () => {\n this._handleError(request, Error.Code.HTTP_ERROR, {\n text: request.responseText,\n statusText: request.statusText\n });\n };\n this.headers.forEach((value, key) => {\n request.setRequestHeader(key, value);\n });\n request.send(this.params);\n }\n\n _getResponseHeaders(request: XMLHttpRequest): Array {\n return request\n .getAllResponseHeaders()\n .split('\\n')\n .filter(header => header.toLowerCase().indexOf(KALTURA_HEADER_PREFIX) === 0);\n }\n\n _handleError(request: XMLHttpRequest, code: number, data: Object): Promise<*> | void {\n const error = this._createError(request, code, data);\n request.onreadystatechange = function () {};\n request.onerror = function () {};\n request.ontimeout = function () {};\n request.onabort = function () {};\n if (this.retryConfig.maxAttempts && this._attemptCounter < this.retryConfig.maxAttempts) {\n this._attemptCounter++;\n this._createXHR();\n } else {\n return this._requestPromise.reject(error);\n }\n }\n\n _createError(request: XMLHttpRequest, code: number, data: Object): Error {\n Object.assign(data, {\n url: this.url,\n headers: this._getResponseHeaders(request),\n attempt: this._attemptCounter\n });\n return new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, code, data);\n }\n}\n","//@flow\nexport type LogLevelObject = {value: number, name: string};\nexport type LogLevelType = {[level: string]: LogLevelObject};\nexport type loggerFunctionType = {\n VERSION: String,\n DEBUG: LogLevelObject,\n ERROR: LogLevelObject,\n INFO: LogLevelObject,\n OFF: LogLevelObject,\n TIME: LogLevelObject,\n TRACE: LogLevelObject,\n WARN: LogLevelObject,\n createDefaultHandler: Function,\n debug: Function,\n enabledFor: Function,\n error: Function,\n get: Function,\n getLevel: Function,\n info: Function,\n log: Function,\n setHandler: Function,\n setLevel: Function,\n time: Function,\n timeEnd: Function,\n trace: Function,\n useDefaults: Function,\n warn: Function\n};\n\nexport type LoggerType = {\n getLogger: loggerFunctionType,\n LogLevel: LogLevelType\n};\n\nlet JsLogger = {\n get: () => ({\n VERSION: '',\n DEBUG: {value: '', name: ''},\n ERROR: {value: '', name: ''},\n INFO: {value: '', name: ''},\n OFF: {value: '', name: ''},\n TIME: {value: '', name: ''},\n TRACE: {value: '', name: ''},\n WARN: {value: '', name: ''},\n createDefaultHandler: () => {},\n debug: () => {},\n enabledFor: () => {},\n error: () => {},\n get: () => {},\n getLevel: () => {},\n info: () => {},\n log: () => {},\n setHandler: () => {},\n setLevel: () => {},\n time: () => {},\n timeEnd: () => {},\n trace: () => {},\n useDefaults: () => {},\n warn: () => {}\n })\n};\n\nlet LogLevel: LogLevelType = {};\n/**\n * set logger\n * @param {LoggerType} logger - the logger\n * @returns {void}\n */\nfunction setLogger(logger: ?LoggerType): void {\n if (logger && typeof logger.getLogger === 'function') {\n JsLogger.get = logger.getLogger;\n }\n if (logger && logger.LogLevel) {\n LogLevel = logger.LogLevel;\n }\n}\n\n/**\n * get a logger\n * @param {?string} name - the logger name\n * @returns {Object} - the logger class\n */\nfunction getLogger(name?: string): Object {\n //$FlowFixMe\n return JsLogger.get(name);\n}\n\n/**\n * get the log level\n * @param {?string} name - the logger name\n * @returns {LogLevelObject} - the log level\n */\nfunction getLogLevel(name?: string): LogLevelObject {\n return getLogger(name).getLevel();\n}\n\n/**\n * sets the logger level\n * @param {LogLevelObject} level - the log level\n * @param {?string} name - the logger name\n * @returns {void}\n */\nfunction setLogLevel(level: LogLevelObject, name?: string): void {\n getLogger(name).setLevel(level);\n}\n\nexport default getLogger;\nexport {getLogLevel, setLogLevel, setLogger, LogLevel};\n","//@flow\nexport default class ServiceResult {\n /**\n * @member - Is service returned an error\n * @type {boolean}\n */\n hasError: boolean = false;\n /**\n * @member - The service error\n * @type {ServiceError}\n */\n error: ServiceError;\n /**\n * @member - The service result data\n * @type {Object}\n */\n data: Object;\n\n /**\n * @constructor\n * @param {Object} response - Service response\n */\n constructor(response: Object) {\n if (response.objectType === 'KalturaAPIException') {\n this.hasError = true;\n this.error = new ServiceError(response.code, response.message);\n } else if (response.error && response.error.objectType === 'KalturaAPIException') {\n this.hasError = true;\n this.error = new ServiceError(response.error.code, response.error.message);\n } else {\n this.data = response;\n }\n }\n}\n\nclass ServiceError {\n /**\n * @member - The error code\n * @type {string}\n */\n code: string;\n /**\n * @member - The error message\n * @type {string}\n */\n message: string;\n\n /**\n * @constructor\n * @param {string} code - The result code\n * @param {string} message - The result message\n */\n constructor(code: string, message: string) {\n this.code = code;\n this.message = message;\n }\n}\n","//@flow\nexport const MediaFormat: {[name: string]: ProviderMediaFormatType} = {\n DASH: {\n name: 'dash',\n mimeType: 'application/dash+xml',\n pathExt: 'mpd'\n },\n HLS: {\n name: 'hls',\n mimeType: 'application/x-mpegURL',\n pathExt: 'm3u8'\n },\n WVM: {\n name: 'wvm',\n mimeType: 'video/wvm',\n pathExt: 'wvm'\n },\n MP4: {\n name: 'mp4',\n mimeType: 'video/mp4',\n pathExt: 'mp4'\n },\n MP3: {\n name: 'mp3',\n mimeType: 'audio/mpeg',\n pathExt: 'mp3'\n }\n};\n\nexport const SupportedStreamFormat: Map = new Map([\n ['mpegdash', MediaFormat.DASH],\n ['applehttp', MediaFormat.HLS],\n ['url', MediaFormat.MP4]\n]);\n\n/**\n * returns a boolean whether a source is progressive or not\n * @param {string} formatName - the format name\n * @returns {boolean} - if source is progressive or not\n */\nfunction isProgressiveSource(formatName: string): boolean {\n const sourceFormat = SupportedStreamFormat.get(formatName);\n return !!sourceFormat && sourceFormat.name === MediaFormat.MP4.name;\n}\n\nexport {isProgressiveSource};\n","//@flow\nexport class KalturaDrmPlaybackPluginData {\n static Scheme: {[scheme: string]: string} = {\n 'drm.PLAYREADY_CENC': 'com.microsoft.playready',\n 'drm.WIDEVINE_CENC': 'com.widevine.alpha',\n 'fairplay.FAIRPLAY': 'com.apple.fairplay',\n WIDEVINE_CENC: 'com.widevine.alpha',\n PLAYREADY_CENC: 'com.microsoft.playready',\n FAIRPLAY: 'com.apple.fairplay'\n };\n\n /**\n * @member - The drm scheme\n * @type {string}\n */\n scheme: string;\n\n /**\n * @member - The license URL\n * @type {string}\n */\n licenseURL: string;\n\n /**\n * @member - The drm certificate\n * @type {?string}\n */\n certificate: ?string;\n\n /**\n * @constructor\n * @param {Object} drm The json response\n */\n constructor(drm: any) {\n this.scheme = drm.scheme;\n this.licenseURL = drm.licenseURL;\n this.certificate = drm.certificate;\n }\n}\n","//@flow\nexport class KalturaAccessControlMessage {\n /**\n * @member - The access control message\n * @type {string}\n */\n message: string;\n /**\n * @member - The access control message code\n * @@type {string}\n */\n code: string;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: Object) {\n this.message = data.message;\n this.code = data.code;\n }\n}\n","// @flow\nimport MediaSource from './media-source';\nimport {MediaFormat} from './media-format';\n\nexport default class MediaSources {\n /**\n * Progressive download media sources container.\n * @type {Array}\n * @public\n */\n progressive: Array;\n /**\n * Dash media sources container.\n * @type {Array}\n * @public\n */\n dash: Array;\n /**\n * Hls media sources container.\n * @type {Array}\n * @public\n */\n hls: Array;\n captions: Array;\n\n /**\n * @constructor\n */\n constructor() {\n this.progressive = [];\n this.dash = [];\n this.hls = [];\n }\n\n /**\n * Maps the source to one of the containers according to his media format.\n * @param {MediaSource} source - The source to add to one of the containers.\n * @param {MediaFormat} mediaFormat - The media format of the source.\n * @returns {void}\n */\n map(source: MediaSource, mediaFormat: ?ProviderMediaFormatType) {\n if (mediaFormat) {\n switch (mediaFormat.name) {\n case MediaFormat.MP4.name:\n this.progressive.push(source);\n break;\n case MediaFormat.DASH.name:\n this.dash.push(source);\n break;\n case MediaFormat.HLS.name:\n this.hls.push(source);\n break;\n default:\n break;\n }\n }\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaSourcesObject} - The json class object.\n */\n toJSON(): ProviderMediaSourcesObject {\n const response: ProviderMediaSourcesObject = {\n progressive: [],\n dash: [],\n hls: []\n };\n this.progressive.forEach(p => response.progressive.push(p.toJSON()));\n this.hls.forEach(h => response.hls.push(h.toJSON()));\n this.dash.forEach(d => response.dash.push(d.toJSON()));\n return response;\n }\n}\n","//@flow\nimport Drm from './drm';\n\nexport default class MediaSource {\n /**\n * @member - media source id\n * @type {string}\n */\n id: string;\n /**\n * @member - media source url\n * @type {string}\n */\n url: string;\n /**\n * @member - media source mimetype\n * @type {string}\n */\n mimetype: string;\n /**\n * @member - media source drm data\n * @type {Array}\n */\n drmData: Array;\n /**\n * @member - media source bandwidth\n * @type {number}\n */\n bandwidth: number;\n /**\n * @member - media source width\n * @type {number}\n */\n width: number;\n /**\n * @member - media source height\n * @type {number}\n */\n height: number;\n /**\n * @member - media source label\n * @type {string}\n */\n label: string;\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaSourceObject} - The json class object.\n */\n toJSON(): ProviderMediaSourceObject {\n const response: ProviderMediaSourceObject = {\n id: this.id,\n url: this.url,\n mimetype: this.mimetype\n };\n if (this.bandwidth) response.bandwidth = this.bandwidth;\n if (this.width) response.width = this.width;\n if (this.height) response.height = this.height;\n if (this.label) response.label = this.label;\n if (this.drmData && this.drmData.length > 0) {\n response.drmData = [];\n this.drmData.forEach(d => {\n if (Array.isArray(response.drmData)) {\n response.drmData.push(d.toJSON());\n }\n });\n }\n return response;\n }\n}\n","// @flow\nimport MultiRequestBuilder, {MultiRequestResult} from './multi-request-builder';\nimport Error from '../../util/error/error';\n\nexport default class DataLoaderManager {\n /**\n * @member - Loaders response map index\n * @type {Map>}\n * @private\n */\n _loadersResponseMap: Map> = new Map();\n /**\n * @member - Loaders multi request\n * @type {MultiRequestBuilder}\n * @protected\n */\n _multiRequest: MultiRequestBuilder;\n /**\n * @member - Loaders multi response\n * @type {MultiRequestResult}\n * @private\n */\n _multiResponse: MultiRequestResult;\n /**\n * @member - Loaders to execute\n * @type {Map}\n * @private\n */\n _loaders: Map = new Map();\n\n _networkRetryConfig: ProviderNetworkRetryParameters;\n\n constructor(networkRetryConfig: ProviderNetworkRetryParameters) {\n this._networkRetryConfig = networkRetryConfig;\n }\n\n /**\n * Add loader to execution loaders map\n * @function\n * @param {Function} loader Loader to add\n * @param {Object} params Loader params\n * @param {string} ks ks\n * @returns {void}\n */\n add(loader: Function, params: Object, ks?: string): void {\n let execution_loader = new loader(params);\n if (execution_loader.isValid()) {\n this._loaders.set(loader.id, execution_loader);\n // Get the start index from the multiReqeust before adding current execution_loader requests\n let startIndex = this._multiRequest.requests.length;\n // Get the requests\n let requests = execution_loader.requests;\n this._multiRequest.retryConfig = this._networkRetryConfig;\n // Add requests to multiRequest queue\n requests.forEach(request => {\n request.params = request.params || {};\n request.params.ks = request.params.ks || ks;\n this._multiRequest.add(request);\n });\n // Create range array of current execution_loader requests\n let executionLoaderResponseMap = Array.from(new Array(requests.length), (val, index) => index + startIndex);\n // Add to map\n this._loadersResponseMap.set(loader.id, executionLoaderResponseMap);\n }\n }\n\n /**\n * Get data from all loaders using multi request\n * @function\n * @returns {Promise} Promise\n */\n fetchData(): Promise {\n return new Promise((resolve, reject) => {\n this._multiRequest.execute().then(\n data => {\n this._multiResponse = data.response;\n let preparedData: Object = this.prepareData(data.response);\n if (preparedData.success) {\n resolve(this._loaders);\n } else {\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.API_RESPONSE_MISMATCH, {\n headers: data.headers\n })\n );\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n\n /**\n * Prepare fetched data\n * @function\n * @param {MultiRequestResult} response - The multi request result\n * @returns {Object} - The prepared data\n */\n prepareData(response: MultiRequestResult): Object {\n this._loaders.forEach((loader, name) => {\n let loaderDataIndexes = this._loadersResponseMap.get(name);\n try {\n if (loaderDataIndexes && loaderDataIndexes.length > 0) {\n loader.response = response.results.slice(loaderDataIndexes[0], loaderDataIndexes[loaderDataIndexes.length - 1] + 1);\n }\n } catch (err) {\n return {success: false, error: err};\n }\n });\n return {success: true, data: this._loaders};\n }\n}\n","//@flow\nimport RequestBuilder from '../../util/request-builder';\nimport getLogger from '../../util/logger';\nimport ServiceResult from './base-service-result';\nimport Error from '../../util/error/error';\n\nexport default class MultiRequestBuilder extends RequestBuilder {\n static _logger = getLogger('MultiRequestBuilder');\n /**\n * @memberof - MultiRequestBuilder\n * @type {Array}\n */\n requests: Array = [];\n /**\n * Adds request to requests array\n * @function add\n * @param {RequestBuilder} request The request\n * @returns {MultiRequestBuilder} The multiRequest\n */\n add(request: RequestBuilder): MultiRequestBuilder {\n this.requests.push(request);\n const requestParams = {};\n const serviceDef: Object = {service: request.service, action: request.action};\n Object.assign(requestParams, {[this.requests.length]: Object.assign(serviceDef, request.params)});\n Object.assign(requestParams, this.params);\n this.params = requestParams;\n return this;\n }\n\n /**\n * Executes a multi request\n * @function execute\n * @returns {Promise} The multirequest execution promise\n */\n execute(): Promise {\n return new Promise((resolve, reject) => {\n try {\n this.params = JSON.stringify(this.params);\n } catch (err) {\n MultiRequestBuilder._logger.error(`${err.message}`);\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.FAILED_PARSING_REQUEST, {\n error: err,\n params: this.params\n })\n );\n }\n this.doHttpRequest().then(\n data => {\n const multiRequestResult = new MultiRequestResult(data);\n if (multiRequestResult.success) {\n resolve({\n headers: this.responseHeaders,\n response: multiRequestResult\n });\n } else {\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.MULTIREQUEST_API_ERROR, {\n url: this.url,\n headers: this.responseHeaders,\n results: multiRequestResult.results\n })\n );\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n}\n\nexport class MultiRequestResult {\n static _logger = getLogger('MultiRequestResult');\n /**\n * @memberof MultiRequestResult\n * @type {boolean}\n */\n success: boolean;\n /**\n * @memberof MultiRequestResult\n * @type {Object}\n */\n results: Array = [];\n /**\n * @constructor\n * @param {Object} response data\n */\n constructor(response: Object) {\n this.success = true;\n const result = response.result ? response.result : response;\n const responseArr = Array.isArray(result) ? result : [result];\n responseArr.forEach(result => {\n const serviceResult: ServiceResult = new ServiceResult(result);\n this.results.push(serviceResult);\n if (serviceResult.hasError) {\n MultiRequestResult._logger.error(\n `Service returned an error with error code: ${serviceResult.error.code} and message: ${serviceResult.error.message}.`\n );\n this.success = false;\n return;\n }\n });\n }\n}\n","//@flow\nexport default class Drm {\n /**\n * @member - license url\n * @type {string}\n */\n licenseUrl: string;\n /**\n * @member - drm scheme\n * @type {string}\n */\n scheme: string;\n\n /**\n * @member - drm certificate\n * @type {string}\n */\n certificate: string;\n\n /**\n * @constructor\n * @param {string} licenseUrl - the license url\n * @param {string} scheme - the drm scheme\n * @param {?string} certificate - the drm certificate\n */\n constructor(licenseUrl: string, scheme: string, certificate: ?string) {\n this.licenseUrl = licenseUrl;\n this.scheme = scheme;\n if (certificate) {\n this.certificate = certificate;\n }\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderDrmDataObject} - The json class object.\n */\n toJSON(): ProviderDrmDataObject {\n const response: ProviderDrmDataObject = {\n licenseUrl: this.licenseUrl,\n scheme: this.scheme\n };\n if (this.certificate) response.certificate = this.certificate;\n return response;\n }\n}\n","// @flow\nimport {getLogLevel, setLogLevel, setLogger, type LogLevelType, LogLevel} from '../../util/logger';\nimport DataLoaderManager from './data-loader-manager';\nimport Error from '../../util/error/error';\n\nexport default class BaseProvider {\n _partnerId: number;\n _widgetId: ?string;\n _ks: string;\n _uiConfId: ?number;\n _dataLoader: DataLoaderManager;\n _playerVersion: string;\n _logger: any;\n _isAnonymous: boolean;\n _networkRetryConfig: ProviderNetworkRetryParameters = {\n async: true,\n timeout: 0,\n maxAttempts: 4\n };\n\n get partnerId(): number {\n return this._partnerId;\n }\n\n get widgetId(): string {\n return this._widgetId || this.defaultWidgetId;\n }\n\n get defaultWidgetId(): string {\n return '_' + this._partnerId;\n }\n\n get uiConfId(): ?number {\n return this._uiConfId;\n }\n\n get ks(): string {\n return this._ks;\n }\n\n set ks(value: string): void {\n this._ks = value;\n }\n\n get playerVersion(): string {\n return this._playerVersion;\n }\n\n get isAnonymous(): boolean {\n return this._isAnonymous;\n }\n\n constructor(options: ProviderOptionsObject, playerVersion: string) {\n setLogger(options.logger);\n this._partnerId = options.partnerId;\n this._widgetId = options.widgetId;\n this._uiConfId = options.uiConfId;\n this._isAnonymous = !options.ks;\n this._ks = options.ks || '';\n this._playerVersion = playerVersion;\n }\n\n // eslint-disable-next-line no-unused-vars\n getMediaConfig(mediaInfo: MI): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'getMediaConfig method must be implement by the derived class'\n })\n );\n }\n\n // eslint-disable-next-line no-unused-vars\n getPlaylistConfig(playlistInfo: ProviderPlaylistInfoObject): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'The provider does not support loading playlist by id'\n })\n );\n }\n\n // eslint-disable-next-line no-unused-vars\n getEntryListConfig(entryListInfo: ProviderEntryListObject): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'The provider does not support loading entry list'\n })\n );\n }\n\n _verifyHasSources(sources: ProviderMediaConfigSourcesObject) {\n if (sources.hls.concat(sources.dash, sources.progressive).length === 0) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.MISSING_PLAY_SOURCE, {\n action: '',\n messages: `No play source for entry id: ${sources.id}`\n });\n }\n }\n\n get LogLevel(): LogLevelType {\n return LogLevel;\n }\n\n getLogLevel(name?: string): Object {\n return getLogLevel(name);\n }\n\n setLogLevel(level: Object, name?: string): void {\n setLogLevel(level, name);\n }\n}\n","const clone = data => {\n let node;\n if (Array.isArray(data)) {\n node = data.length > 0 ? data.slice(0) : [];\n node.forEach((e, i) => {\n if ((typeof e === 'object' && e !== {}) || (Array.isArray(e) && e.length > 0)) {\n node[i] = clone(e);\n }\n });\n } else if (typeof data === 'object') {\n node = Object.assign({}, data);\n Object.keys(node).forEach(key => {\n if ((typeof node[key] === 'object' && node[key] !== {}) || (Array.isArray(node[key]) && node[key].length > 0)) {\n node[key] = clone(node[key]);\n }\n });\n } else {\n node = data;\n }\n return node;\n};\n\nexport {clone};\n","//@flow\n\nimport MediaEntry from '../entities/media-entry';\n\nexport default class EntryList {\n /**\n * @member - entry list items\n * @type {Array}\n */\n items: Array;\n\n constructor() {\n this.items = [];\n }\n}\n","//@flow\n\nexport default class Bumper {\n /**\n * @member - bumper url\n * @type {string}\n */\n url: string;\n /**\n * @member - bumper click through url\n * @type {string}\n */\n clickThroughUrl: string;\n\n /**\n * @constructor\n * @param {Object} data - The bumper response\n */\n constructor(data: Object) {\n this.url = data.url;\n this.clickThroughUrl = data.clickThroughUrl;\n }\n}\n","//@flow\nimport {clone} from '../../util/clone';\n\nconst defaultConfig: Object = {\n serviceUrl: 'https://cdnapisec.kaltura.com/api_v3',\n cdnUrl: 'https://cdnapisec.kaltura.com',\n serviceParams: {\n apiVersion: '3.3.0',\n format: 1\n },\n useApiCaptions: true\n};\n\nexport default class OVPConfiguration {\n static set(clientConfig?: ProviderEnvConfigObject) {\n if (clientConfig) {\n Object.assign(defaultConfig, clientConfig);\n }\n }\n\n static get(): Object {\n return clone(defaultConfig);\n }\n}\n\nexport {OVPConfiguration};\n","//@flow\nimport {KalturaDrmPlaybackPluginData} from '../../common/response-types/kaltura-drm-playback-plugin-data';\n\nexport type OVPKalturaPlaybackSource = KalturaPlaybackSource;\n\nexport class KalturaPlaybackSource {\n /**\n * @member - source format according to delivery profile streamer type (applehttp, mpegdash etc.)\n * @type {string}\n */\n format: string;\n /**\n * @member - delivery profile Id\n * @type {string}\n */\n deliveryProfileId: string;\n /**\n * @member - The source URL\n * @type {string}\n */\n url: string;\n /**\n * @member - comma separated string according to deliveryProfile media protocols ('http,https' etc.)\n * @type {string}\n */\n protocols: string;\n /**\n * @member - comma separated string of flavor ids\n * @type {string}\n */\n flavorIds: string;\n /**\n * @member - drm data object containing relevant license url ,scheme name and certificate\n * @type {Array}\n */\n drm: Array = [];\n\n /**\n * @constructor\n * @param {Object} source The response\n */\n constructor(source: Object) {\n this.format = source.format;\n this.deliveryProfileId = source.deliveryProfileId;\n this.url = source.url;\n this.protocols = source.protocols;\n this.flavorIds = source.flavorIds;\n if (source.drm) {\n source.drm.map(drm => this.drm.push(new KalturaDrmPlaybackPluginData(drm)));\n }\n }\n\n /**\n * Checks if source has DRM data\n * @function hasDrmData\n * @returns {boolean} Is source has DRM\n */\n hasDrmData(): boolean {\n return this.drm && this.drm.length > 0;\n }\n\n /**\n * Checks if source has flavor IDs\n * @function hasFlavorIds\n * @returns {boolean} Is source ha flavor IDs\n */\n hasFlavorIds(): boolean {\n return !!this.flavorIds && this.flavorIds.length > 0;\n }\n\n /**\n * Returns source desired protocol if supported\n * @param {string} protocol - the desired protocol for the source (base play url protocol)\n * @returns {string} - protocol if protocol is in the protocols list - if not empty string returned\n */\n getProtocol(protocol: string): string {\n let returnValue: string = '';\n if (this.protocols && this.protocols.length > 0) {\n let protocolsArr: Array = this.protocols.split(',');\n protocolsArr.forEach(p => {\n if (p === protocol) {\n returnValue = p;\n }\n });\n } else if (protocol === 'http') {\n return protocol;\n }\n return returnValue;\n }\n}\n","//@flow\nexport class KalturaRuleAction {\n static Type: {[type: string]: string | number} = {\n DRM_POLICY: 'drm.DRM_POLICY',\n BLOCK: 1,\n PREVIEW: 2,\n LIMIT_FLAVORS: 3,\n ADD_TO_STORAGE: 4,\n LIMIT_DELIVERY_PROFILES: 5,\n SERVE_FROM_REMOTE_SERVER: 6,\n REQUEST_HOST_REGEX: 7,\n LIMIT_THUMBNAIL_CAPTURE: 8\n };\n\n /**\n * @member - The type of the action\n * @type {string|number}\n */\n type: string | number;\n\n /**\n * @constructor\n * @param {Object} data - The response\n */\n constructor(data: Object) {\n this.type = data.type;\n }\n}\n","//@flow\nimport {KalturaRuleAction} from './kaltura-rule-action';\n\nexport class KalturaAccessControlModifyRequestHostRegexAction extends KalturaRuleAction {\n /**\n * @member - Request host regex pattern\n * @type {string}\n */\n pattern: string;\n /**\n * @member - Request host regex replacement\n * @type {string}\n */\n replacement: string;\n /**\n * @member - serverNodeId to generate replacment host from\n * @type {number}\n */\n replacmenServerNodeId: number;\n\n /**\n * @constructor\n * @param {Object} data - The response\n */\n constructor(data: Object) {\n super(data);\n this.pattern = data.pattern;\n this.replacement = data.replacement;\n this.replacmenServerNodeId = data.replacmenServerNodeId;\n }\n}\n","//@flow\nexport class KalturaFlavorAsset {\n static Status: {[status: string]: number} = {\n ERROR: -1,\n QUEUED: 0,\n CONVERTING: 1,\n READY: 2,\n DELETED: 3,\n NOT_APPLICABLE: 4,\n TEMP: 5,\n WAIT_FOR_CONVERT: 6,\n IMPORTING: 7,\n VALIDATING: 8,\n EXPORTING: 9\n };\n\n /**\n * @member - The ID of the Flavor Asset\n * @type {string}\n */\n id: string;\n /**\n * @member -The Flavor Params used to create this Flavor Asset\n * @type {string}\n */\n flavorParamsId: string;\n /**\n * @member -The file extension\n * @type {string}\n */\n fileExt: string;\n /**\n * @member - The overall bitrate (in KBits) of the Flavor Asset\n * @type {string}\n */\n bitrate: number;\n /**\n * @member - The width of the Flavor Asset\n * @type {number}\n */\n width: number;\n /**\n * @member - The height of the Flavor Asset\n * @type {number}\n */\n height: number;\n /**\n * @member - The frame rate (in FPS) of the Flavor Asset\n * @type {number}\n */\n frameRate: number;\n /**\n * @member - True if this Flavor Asset is the original source\n * @type {number}\n */\n isOriginal: boolean;\n /**\n * @member - True if this Flavor Asset is playable in KDP\n * @type {boolean}\n */\n isWeb: boolean;\n /**\n * @member - The container format\n * @type {boolean}\n */\n containerFormat: string;\n /**\n *@member - The video codec\n * @type {boolean}\n */\n videoCodecId: string;\n /**\n * @member - The status of the Flavor Asset\n * @type {number}\n */\n status: number;\n /**\n * @member - The language of the flavor asset\n * @type {Status}\n */\n language: string;\n /**\n * @member - The label of the flavor asset\n * @type {string}\n */\n label: string;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: any) {\n this.id = data.id;\n this.flavorParamsId = data.flavorParamsId;\n this.fileExt = data.fileExt;\n this.bitrate = data.bitrate;\n this.width = data.width;\n this.height = data.height;\n this.id = data.id;\n this.frameRate = data.frameRate;\n this.isOriginal = data.isOriginal;\n this.isWeb = data.isWeb;\n this.containerFormat = data.containerFormat;\n this.videoCodecId = data.videoCodecId;\n this.status = data.status;\n this.language = data.language;\n this.label = data.label;\n }\n}\n","//@flow\nimport {KalturaPlaybackSource} from './kaltura-playback-source';\n\nexport class KalturaBumper {\n /**\n * @member - The bumper entry ID\n * @type {string}\n */\n entryId: string;\n /**\n * @member - The bumper click through url\n * @type {string}\n */\n clickThroughUrl: string;\n /**\n * @member - The bumper sources\n * @type {Array}\n */\n sources: Array;\n\n constructor(data: any) {\n this.entryId = data.entryId;\n this.clickThroughUrl = data.url;\n this.sources = data.sources ? data.sources.map(source => new KalturaPlaybackSource(source)) : [];\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaAccessControlMessage} from '../../common/response-types/kaltura-access-control-message';\nimport {KalturaPlaybackSource} from './kaltura-playback-source';\nimport {KalturaAccessControlModifyRequestHostRegexAction} from './kaltura-access-control-modify-request-host-regex-action';\nimport {KalturaRuleAction} from './kaltura-rule-action';\nimport {KalturaFlavorAsset} from './kaltura-flavor-asset';\nimport {KalturaBumper} from './kaltura-bumper';\n\nexport class KalturaPlaybackContext extends ServiceResult {\n /**\n * @member - The playback sources\n * @type {Array}\n */\n sources: Array = [];\n /**\n * @member - Array of actions as received from the rules that invalidated\n * @type {Array}\n */\n actions: Array = [];\n /**\n * @member - Array of actions as received from the rules that invalidated\n * @type {Array}\n */\n messages: Array = [];\n /**\n * @member - The flavor assets\n * @type {Array}\n */\n flavorAssets: Array = [];\n /**\n * @member - The bumper data\n * @type {Array}\n */\n bumperData: Array = [];\n\n /**\n * @constructor\n * @param {Object} response The response\n */\n constructor(response: Object) {\n super(response);\n if (!this.hasError) {\n const messages = response.messages;\n if (messages) {\n messages.map(message => this.messages.push(new KalturaAccessControlMessage(message)));\n }\n const actions = response.actions;\n if (actions) {\n actions.map(action => {\n if (action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX) {\n this.actions.push(new KalturaAccessControlModifyRequestHostRegexAction(action));\n } else {\n this.actions.push(new KalturaRuleAction(action));\n }\n });\n }\n const sources = response.sources;\n if (sources) {\n sources.map(source => this.sources.push(new KalturaPlaybackSource(source)));\n }\n const flavorAssets = response.flavorAssets;\n if (flavorAssets) {\n flavorAssets.map(flavor => this.flavorAssets.push(new KalturaFlavorAsset(flavor)));\n }\n const bumperData = response.bumperData;\n if (bumperData) {\n bumperData.map(bumper => this.bumperData.push(new KalturaBumper(bumper)));\n }\n }\n }\n\n hasBlockAction(): boolean {\n return this.getBlockAction() !== undefined;\n }\n\n getBlockAction(): ?KalturaRuleAction {\n return this.actions.find(action => action.type === KalturaRuleAction.Type.BLOCK);\n }\n\n getErrorMessages(): Array {\n return this.messages;\n }\n\n /**\n * Get the KalturaAccessControlModifyRequestHostRegexAction action\n * @function getRequestHostRegexAction\n * @returns {?KalturaAccessControlModifyRequestHostRegexAction} The action\n * */\n getRequestHostRegexAction(): ?KalturaAccessControlModifyRequestHostRegexAction {\n const action = this.actions.find(action => action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX);\n if (action instanceof KalturaAccessControlModifyRequestHostRegexAction) {\n return action;\n }\n }\n}\n","//@flow\nexport class KalturaMetadata {\n static ObjectType: {[type: string]: string | number} = {\n AD_CUE_POINT: 'adCuePointMetadata.AdCuePoint',\n ANNOTATION: 'annotationMetadata.Annotation',\n CODE_CUE_POINT: 'codeCuePointMetadata.CodeCuePoint',\n THUMB_CUE_POINT: 'thumbCuePointMetadata.thumbCuePoint',\n ENTRY: 1,\n CATEGORY: 2,\n USER: 3,\n PARTNER: 4,\n DYNAMIC_OBJECT: 5\n };\n\n static Status: {[status: string]: number} = {\n VALID: 1,\n INVALID: 2,\n DELETED: 3\n };\n\n id: number;\n metadataProfileId: number;\n metadataProfileVersion: number;\n metadataObjectType: string | number;\n objectId: string;\n version: number;\n created: Date;\n updated: Date;\n status: number;\n xml: string;\n\n /**\n * @constructor\n * @param {Object} data The response\n */\n constructor(data: Object) {\n this.id = data.id;\n this.metadataProfileId = data.metadataProfileId;\n this.metadataProfileVersion = data.metadataProfileVersion;\n this.metadataProfileId = data.metadataProfileId;\n this.metadataObjectType = data.metadataObjectType;\n this.objectId = data.objectId;\n this.version = data.version;\n this.created = new Date(0);\n this.created.setUTCSeconds(data.createdAt);\n this.updated = new Date(0);\n this.updated.setUTCSeconds(data.updatedAt);\n this.status = data.status;\n this.xml = data.xml;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMetadata} from './kaltura-metadata';\n\nexport class KalturaMetadataListResponse extends ServiceResult {\n totalCount: number;\n metas: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.totalCount = responseObj.totalCount;\n if (this.totalCount > 0) {\n this.metas = [];\n responseObj.objects.map(meta => this.metas.push(new KalturaMetadata(meta)));\n }\n }\n }\n}\n","//@flow\nexport class KalturaMediaEntry {\n static EntryType: {[entryType: string]: {value: number | string}} = {\n AUTOMATIC: {value: -1},\n EXTERNAL_MEDIA: {value: 'externalMedia.externalMedia'},\n MEDIA_CLIP: {value: 1},\n MIX: {value: 2},\n PLAYLIST: {value: 5},\n DATA: {value: 6},\n LIVE_STREAM: {value: 7},\n LIVE_CHANNEL: {value: 8},\n DOCUMENT: {value: 10}\n };\n\n static MediaType: {[mediaType: string]: {value: number}} = {\n VIDEO: {value: 1},\n IMAGE: {value: 2},\n AUDIO: {value: 5},\n LIVE_STREAM_FLASH: {value: 201},\n LIVE_STREAM_WINDOWS_MEDIA: {value: 202},\n LIVE_STREAM_REAL_MEDIA: {value: 203},\n LIVE_STREAM_QUICK_TIME: {value: 204}\n };\n\n static EntryStatus: {[status: string]: string | number} = {\n ERROR_IMPORTING: -2,\n ERROR_CONVERTING: -1,\n SCAN_FAILURE: 'virusScan.ScanFailure',\n IMPORT: 0,\n INFECTED: 'virusScan.Infected',\n PRECONVERT: 1,\n READY: 2,\n DELETED: 3,\n PENDING: 4,\n MODERATE: 5,\n BLOCKED: 6,\n NO_CONTENT: 7\n };\n\n static EntryModerationStatus: {[status: string]: number} = {\n PENDING_MODERATION: 1,\n APPROVED: 2,\n REJECTED: 3,\n FLAGGED_FOR_REVIEW: 4,\n MODERATE: 5,\n AUTO_APPROVED: 6\n };\n\n /**\n * @member - The entry id\n * @type {string}\n */\n id: string;\n /**\n * @member - The entry referenceId\n * @type {string}\n */\n referenceId: string;\n /**\n * @member - The entry externalSourceType\n * @type {string}\n */\n externalSourceType: string;\n /**\n * @member - Entry name (Min 1 chars)\n * @type {string}\n */\n name: string;\n /**\n * @member - Entry description\n * @type {string}\n */\n description: string;\n /**\n * @member - The URL used for playback. This is not the download URL.\n * @type {string}\n */\n dataUrl: string;\n /**\n * @member - Comma separated flavor params ids that exists for this media entry\n * @type {string}\n */\n flavorParamsIds: string;\n /**\n * @member - The entry duration\n * @type {number}\n */\n duration: number;\n /**\n * @member - The type of the entry, this is auto filled by the derived entry object\n * @type {string | number}\n */\n type: string | number;\n /**\n * @member - The type of the entry, this is auto filled by the derived entry object (Image, Audio etc.)\n * @type {number}\n */\n entryType: number;\n /**\n * @member - Entry poster image\n * @type {string}\n */\n poster: string;\n /**\n * @member - DVR status\n * @type {number}\n */\n dvrStatus: number;\n /**\n * @member - Entry tags\n * @type {string}\n */\n tags: string;\n\n /**\n * @member - Entry status\n * @type {number}\n */\n status: number;\n\n /**\n * @constructor\n * @param {Object} entry The json response\n */\n constructor(entry: Object) {\n this.id = entry.id;\n this.referenceId = entry.referenceId;\n this.externalSourceType = entry.externalSourceType;\n this.name = entry.name;\n this.description = entry.description;\n this.dataUrl = entry.dataUrl;\n this.type = entry.type;\n this.entryType = entry.mediaType;\n this.flavorParamsIds = entry.flavorParamsIds;\n this.duration = entry.duration;\n this.poster = entry.thumbnailUrl;\n this.status = entry.status;\n this.dvrStatus = entry.dvrStatus;\n this.tags = entry.tags;\n }\n}\n","//@flow\nimport OVPConfiguration from './config';\n\ntype urlParamsType = {\n partnerId: number,\n entryId: string,\n ks: string,\n uiConfId: ?number,\n format: string,\n protocol: string,\n extension: string,\n flavorIds: ?string\n};\n\nexport default class PlaySourceUrlBuilder {\n /**\n * Returns source url by given url params\n * @function build\n * @param {urlParamsType} urlParams The params\n * @returns {string} The URL\n * @static\n */\n static build(urlParams: urlParamsType): string {\n const config = OVPConfiguration.get();\n const serviceUrlOrigin: string = config.serviceUrl.substr(0, config.serviceUrl.lastIndexOf('/'));\n const {partnerId, entryId, ks, uiConfId, format, protocol, extension, flavorIds} = urlParams;\n\n //verify mandatory params\n if (!serviceUrlOrigin || !partnerId || !entryId || !format || !protocol) {\n return '';\n }\n\n let playUrl = serviceUrlOrigin;\n if (!serviceUrlOrigin.endsWith('/')) {\n playUrl += '/';\n }\n playUrl += 'p/' + partnerId + '/sp/' + partnerId + '00' + '/playManifest/entryId/' + entryId + '/protocol/' + protocol + '/format/' + format;\n\n if (flavorIds) {\n playUrl += '/flavorIds/' + flavorIds;\n } else if (uiConfId) {\n playUrl += '/uiConfId/' + uiConfId;\n }\n\n if (ks !== '') {\n playUrl += '/ks/' + ks;\n }\n\n if (extension !== '') {\n playUrl += '/a.' + extension;\n }\n\n if (uiConfId && flavorIds !== '') {\n playUrl += '?uiConfId=' + uiConfId;\n }\n\n return playUrl;\n }\n}\n","//@flow\nexport default class XmlParser {\n /**\n * Parses xml string to json object\n * @param {string} xml The xml to parse\n * @returns {{}} The parsed xml as Json object\n * @static\n */\n static xmlToJson(xml: Object) {\n let obj = {};\n if (xml.nodeType === 1) {\n if (xml.attributes.length > 0) {\n obj['@attributes'] = {};\n for (let j = 0; j < xml.attributes.length; j++) {\n let attribute = xml.attributes.item(j);\n obj['@attributes'][attribute.nodeName] = attribute.nodeValue;\n }\n }\n } else if (xml.nodeType === 3) {\n obj = xml.nodeValue;\n }\n if (xml.hasChildNodes()) {\n for (let i = 0; i < xml.childNodes.length; i++) {\n let item = xml.childNodes.item(i);\n let nodeName = item.nodeName;\n if (typeof obj[nodeName] === 'undefined') {\n obj[nodeName] = this.xmlToJson(item);\n } else {\n if (typeof obj[nodeName].push === 'undefined') {\n let old = obj[nodeName];\n obj[nodeName] = [];\n obj[nodeName].push(old);\n }\n obj[nodeName].push(this.xmlToJson(item));\n }\n }\n }\n return obj;\n }\n}\n","//@flow\n\nimport MediaEntry from '../entities/media-entry';\n\nexport default class Playlist {\n /**\n * @member - playlist id\n * @type {string}\n */\n id: string;\n /**\n * @member - playlist name\n * @type {string}\n */\n name: string;\n /**\n * @member - playlist description\n * @type {string}\n */\n description: string;\n\n /**\n * @member - playlist poster\n * @type {string}\n */\n poster: string;\n\n /**\n * @member - playlist items\n * @type {Array}\n */\n items: Array;\n\n constructor() {\n this.items = [];\n }\n}\n","// @flow\n\nimport {addKsToUrl} from './provider-parser';\n\nconst KalturaCaptionType: CaptionType = {\n SRT: '1',\n DFXP: '2',\n WEBVTT: '3',\n CAP: '4'\n};\n\nconst CaptionsFormatsMap: {[format: string]: string} = {\n '3': 'vtt',\n '1': 'srt'\n};\n\nclass ExternalCaptionsBuilder {\n static createConfig(captions: Array, ks: string): Array {\n return captions.map(caption => {\n let url = caption.url;\n let type = CaptionsFormatsMap[caption.format];\n if ([KalturaCaptionType.DFXP, KalturaCaptionType.CAP].includes(caption.format)) {\n url = caption.webVttUrl;\n type = CaptionsFormatsMap[KalturaCaptionType.WEBVTT];\n }\n url = addKsToUrl(url, ks);\n return {\n default: !!caption.isDefault,\n type: type,\n language: caption.languageCode,\n label: caption.label,\n url: url\n };\n });\n }\n}\n\nexport {ExternalCaptionsBuilder};\n","//@flow\nimport {KalturaPlaybackContext} from './response-types/kaltura-playback-context';\nimport {KalturaMetadataListResponse} from './response-types/kaltura-metadata-list-response';\nimport {KalturaMediaEntry} from './response-types/kaltura-media-entry';\nimport {KalturaPlaybackSource} from './response-types/kaltura-playback-source';\nimport {KalturaBumper} from './response-types/kaltura-bumper';\nimport {KalturaDrmPlaybackPluginData} from '../common/response-types/kaltura-drm-playback-plugin-data';\nimport PlaySourceUrlBuilder from './play-source-url-builder';\nimport XmlParser from '../../util/xml-parser';\nimport getLogger from '../../util/logger';\nimport OVPConfiguration from './config';\nimport MediaEntry from '../../entities/media-entry';\nimport Drm from '../../entities/drm';\nimport MediaSource from '../../entities/media-source';\nimport MediaSources from '../../entities/media-sources';\nimport {SupportedStreamFormat, isProgressiveSource} from '../../entities/media-format';\nimport Playlist from '../../entities/playlist';\nimport EntryList from '../../entities/entry-list';\nimport Bumper from '../../entities/bumper';\nimport {KalturaRuleAction} from './response-types/kaltura-rule-action';\nimport {KalturaAccessControlMessage} from '../common/response-types/kaltura-access-control-message';\nimport type {OVPMediaEntryLoaderResponse} from './loaders/media-entry-loader';\nimport {ExternalCaptionsBuilder} from './external-captions-builder';\n\nclass OVPProviderParser {\n static _logger = getLogger('OVPProviderParser');\n\n /**\n * Returns parsed media entry by given OVP response objects\n * @function getMediaEntry\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {any} mediaEntryResponse - The media entry response\n * @returns {MediaEntry} - The media entry\n * @static\n * @public\n */\n static getMediaEntry(ks: string, partnerId: number, uiConfId: ?number, mediaEntryResponse: any): MediaEntry {\n const mediaEntry = new MediaEntry();\n const entry = mediaEntryResponse.entry;\n const playbackContext = mediaEntryResponse.playBackContextResult;\n const metadataList = mediaEntryResponse.metadataListResult;\n const kalturaSources = playbackContext.sources;\n\n mediaEntry.sources = OVPProviderParser._getParsedSources(kalturaSources, ks, partnerId, uiConfId, entry, playbackContext);\n if (OVPConfiguration.get().useApiCaptions && playbackContext.data.playbackCaptions) {\n mediaEntry.sources.captions = ExternalCaptionsBuilder.createConfig(playbackContext.data.playbackCaptions, ks);\n }\n OVPProviderParser._fillBaseData(mediaEntry, entry, metadataList);\n return mediaEntry;\n }\n\n /**\n * Returns the url with KS\n * @function addKsToUrl\n * @param {String} url - The url to add the KS\n * @param {string} ks - The ks\n * @returns {string} - The url with KS\n * @static\n * @public\n */\n static addKsToUrl(url: string, ks: string): string {\n const hasUrlExtension = path => {\n const pathWithoutQuery = path.split('?')[0];\n const pathAfterLastSlash = pathWithoutQuery.replace(/^.*[\\\\/]/, '');\n return pathAfterLastSlash.indexOf('.') !== -1;\n };\n let ksParam;\n if (ks) {\n if (hasUrlExtension(url)) {\n ksParam = url.indexOf('?') === -1 ? '?ks=' : '&ks=';\n } else {\n ksParam = '/ks/';\n }\n return url + ksParam + ks;\n }\n return url;\n }\n\n /**\n * Returns parsed playlist by given OVP response objects\n * @function getPlaylist\n * @param {any} playlistResponse - The playlist response\n * @returns {Playlist} - The playlist\n * @static\n * @public\n */\n static getPlaylist(playlistResponse: any): Playlist {\n const playlist = new Playlist();\n const playlistData = playlistResponse.playlistData;\n const playlistItems = playlistResponse.playlistItems.entries;\n playlist.id = playlistData.id;\n playlist.name = playlistData.name;\n playlist.description = playlistData.description;\n playlist.poster = playlistData.poster;\n playlistItems.forEach((entry: KalturaMediaEntry) => {\n const mediaEntry = new MediaEntry();\n OVPProviderParser._fillBaseData(mediaEntry, entry);\n playlist.items.push(mediaEntry);\n });\n return playlist;\n }\n\n /**\n * Returns parsed entry list by given OVP response objects\n * @function getEntryList\n * @param {any} playlistResponse - response\n * @returns {Playlist} - The entry list\n * @static\n * @public\n */\n static getEntryList(playlistResponse: any): EntryList {\n const entryList = new EntryList();\n const playlistItems = playlistResponse.playlistItems.entries;\n playlistItems.forEach(entry => {\n const mediaEntry = new MediaEntry();\n OVPProviderParser._fillBaseData(mediaEntry, entry);\n entryList.items.push(mediaEntry);\n });\n return entryList;\n }\n\n /**\n * Returns parsed bumper by given OTT response objects.\n * @function getBumper\n * @param {any} assetResponse - The asset response.\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @returns {?Bumper} - The bumper\n * @static\n * @public\n */\n static getBumper(assetResponse: any, ks: string, partnerId: number): ?Bumper {\n const playbackContext = assetResponse.playBackContextResult;\n const bumperData: KalturaBumper = playbackContext.bumperData[0];\n if (bumperData) {\n const bumperSources = bumperData && bumperData.sources;\n const progressiveBumper = bumperSources.find(bumper => isProgressiveSource(bumper.format));\n if (progressiveBumper) {\n const parsedSources = OVPProviderParser._parseProgressiveSources(progressiveBumper, playbackContext, ks, partnerId, 0, bumperData.entryId);\n if (parsedSources[0]) {\n return new Bumper({url: parsedSources[0].url, clickThroughUrl: bumperData.clickThroughUrl});\n }\n }\n }\n }\n\n static _fillBaseData(mediaEntry: MediaEntry, entry: KalturaMediaEntry, metadataList: ?KalturaMetadataListResponse) {\n mediaEntry.poster = entry.poster;\n mediaEntry.id = entry.id;\n mediaEntry.duration = entry.duration;\n mediaEntry.metadata = OVPProviderParser._parseMetadata(metadataList);\n mediaEntry.metadata.description = entry.description || '';\n mediaEntry.metadata.name = entry.name || '';\n mediaEntry.metadata.tags = entry.tags || '';\n mediaEntry.status = entry.status;\n\n mediaEntry.type = OVPProviderParser._getEntryType(entry.entryType, entry.type);\n if (mediaEntry.type === MediaEntry.Type.LIVE) {\n mediaEntry.dvrStatus = entry.dvrStatus;\n }\n\n return mediaEntry;\n }\n\n static _getEntryType(entryTypeEnum: number, typeEnum: number | string): string {\n let type = MediaEntry.Type.UNKNOWN;\n switch (entryTypeEnum) {\n case KalturaMediaEntry.MediaType.IMAGE.value:\n type = MediaEntry.Type.IMAGE;\n break;\n case KalturaMediaEntry.MediaType.AUDIO.value:\n type = MediaEntry.Type.AUDIO;\n break;\n default:\n switch (typeEnum) {\n case KalturaMediaEntry.EntryType.MEDIA_CLIP.value:\n type = MediaEntry.Type.VOD;\n break;\n case KalturaMediaEntry.EntryType.LIVE_STREAM.value:\n case KalturaMediaEntry.EntryType.LIVE_CHANNEL.value:\n type = MediaEntry.Type.LIVE;\n break;\n default:\n type = MediaEntry.Type.UNKNOWN;\n }\n }\n return type;\n }\n\n /**\n * Returns the parsed sources\n * @function _getParsedSources\n * @param {Array} kalturaSources - The kaltura sources\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {Object} entry - The entry\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @return {MediaSources} - A media sources\n * @static\n * @private\n */\n static _getParsedSources(\n kalturaSources: Array,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entry: Object,\n playbackContext: KalturaPlaybackContext\n ): MediaSources {\n const sources = new MediaSources();\n const addAdaptiveSource = (source: KalturaPlaybackSource) => {\n const parsedSource = OVPProviderParser._parseAdaptiveSource(source, playbackContext, ks, partnerId, uiConfId, entry.id);\n if (parsedSource) {\n const sourceFormat = SupportedStreamFormat.get(source.format);\n sources.map(parsedSource, sourceFormat);\n }\n };\n const parseAdaptiveSources = () => {\n kalturaSources.filter(source => !isProgressiveSource(source.format)).forEach(addAdaptiveSource);\n };\n const parseProgressiveSources = () => {\n const progressiveSource = kalturaSources.find(source => {\n //match progressive source with supported protocol(http/s)\n return isProgressiveSource(source.format) && source.getProtocol(OVPProviderParser._getBaseProtocol()) !== '';\n });\n sources.progressive = OVPProviderParser._parseProgressiveSources(progressiveSource, playbackContext, ks, partnerId, uiConfId, entry.id);\n };\n\n const parseExternalMedia = () => {\n const mediaSource = new MediaSource();\n mediaSource.mimetype = 'video/youtube';\n mediaSource.url = entry.referenceId;\n mediaSource.id = entry.id + '_youtube';\n sources.progressive.push(mediaSource);\n };\n\n if (entry.type === KalturaMediaEntry.EntryType.EXTERNAL_MEDIA.value) {\n parseExternalMedia();\n } else if (kalturaSources && kalturaSources.length > 0) {\n parseAdaptiveSources();\n parseProgressiveSources();\n }\n return sources;\n }\n\n /**\n * Returns a parsed adaptive source\n * @function _parseAdaptiveSource\n * @param {KalturaPlaybackSource} kalturaSource - A kaltura source\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {string} entryId - The entry id\n * @returns {?MediaSource} - The parsed adaptive kalturaSource\n * @static\n * @private\n */\n static _parseAdaptiveSource(\n kalturaSource: ?KalturaPlaybackSource,\n playbackContext: KalturaPlaybackContext,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entryId: string\n ): ?MediaSource {\n const mediaSource: MediaSource = new MediaSource();\n if (kalturaSource) {\n let playUrl: string = '';\n const mediaFormat = SupportedStreamFormat.get(kalturaSource.format);\n const protocol = kalturaSource.getProtocol(OVPProviderParser._getBaseProtocol());\n const deliveryProfileId = kalturaSource.deliveryProfileId;\n const format = kalturaSource.format;\n let extension: string = '';\n if (mediaFormat) {\n extension = mediaFormat.pathExt;\n mediaSource.mimetype = mediaFormat.mimeType;\n }\n // in case playbackSource doesn't have flavors we don't need to build the url and we'll use the provided one.\n if (kalturaSource.hasFlavorIds()) {\n if (!extension && playbackContext.flavorAssets && playbackContext.flavorAssets.length > 0) {\n extension = playbackContext.flavorAssets[0].fileExt;\n }\n playUrl = PlaySourceUrlBuilder.build({\n entryId,\n flavorIds: kalturaSource.flavorIds,\n format,\n ks,\n partnerId,\n uiConfId,\n extension,\n protocol\n });\n } else {\n playUrl = OVPProviderParser.addKsToUrl(kalturaSource.url, ks);\n }\n if (!playUrl) {\n const message = `failed to create play url from source, discarding source: (${entryId}_${deliveryProfileId}), ${format}`;\n OVPProviderParser._logger.warn(message);\n return null;\n }\n mediaSource.url = OVPProviderParser._applyRegexAction(playbackContext, playUrl);\n mediaSource.id = entryId + '_' + deliveryProfileId + ',' + format;\n if (kalturaSource.hasDrmData()) {\n const drmParams: Array = [];\n kalturaSource.drm.forEach(drm => {\n drmParams.push(new Drm(drm.licenseURL, KalturaDrmPlaybackPluginData.Scheme[drm.scheme], drm.certificate));\n });\n mediaSource.drmData = drmParams;\n }\n }\n return mediaSource;\n }\n\n /**\n * Returns parsed progressive sources\n * @function _parseProgressiveSources\n * @param {KalturaPlaybackSource} kalturaSource - A kaltura source\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {string} entryId - The entry id\n * @returns {Array} - The parsed progressive kalturaSources\n * @static\n * @private\n */\n static _parseProgressiveSources(\n kalturaSource: ?KalturaPlaybackSource,\n playbackContext: KalturaPlaybackContext,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entryId: string\n ): Array {\n const videoSources: Array = [];\n const audioSources: Array = [];\n if (kalturaSource) {\n const protocol = kalturaSource.getProtocol(OVPProviderParser._getBaseProtocol());\n const format = kalturaSource.format;\n const deliveryProfileId = kalturaSource.deliveryProfileId;\n const sourceId = deliveryProfileId + ',' + format;\n playbackContext.flavorAssets.map(flavor => {\n const mediaSource: MediaSource = new MediaSource();\n mediaSource.id = flavor.id + sourceId;\n mediaSource.mimetype = flavor.fileExt === 'mp3' ? 'audio/mp3' : 'video/mp4';\n mediaSource.height = flavor.height;\n mediaSource.width = flavor.width;\n mediaSource.bandwidth = flavor.bitrate * 1024;\n mediaSource.label = flavor.label || flavor.language;\n const playUrl = PlaySourceUrlBuilder.build({\n entryId,\n flavorIds: flavor.id,\n format,\n ks,\n partnerId: partnerId,\n uiConfId: uiConfId,\n extension: flavor.fileExt,\n protocol\n });\n if (playUrl === '') {\n OVPProviderParser._logger.warn(`failed to create play url from source, discarding source: (${entryId}_${deliveryProfileId}), ${format}.`);\n return null;\n } else {\n mediaSource.url = OVPProviderParser._applyRegexAction(playbackContext, playUrl);\n if (flavor.height && flavor.width) {\n videoSources.push(mediaSource);\n } else {\n audioSources.push(mediaSource);\n }\n }\n });\n }\n //If we have only audio flavors return them, otherwise return video flavors\n return audioSources.length && !videoSources.length ? audioSources : videoSources;\n }\n\n /**\n * Ovp metadata parser\n * @function _parseMetaData\n * @param {KalturaMetadataListResponse} metadataList The metadata list\n * @returns {Object} Parsed metadata\n * @static\n * @private\n */\n static _parseMetadata(metadataList: ?KalturaMetadataListResponse): Object {\n const metadata = {};\n if (metadataList && metadataList.metas && metadataList.metas.length > 0) {\n metadataList.metas.forEach(meta => {\n if (meta.xml) {\n let metaXml: Object;\n const domParser: DOMParser = new DOMParser();\n meta.xml = meta.xml.replace(/\\r?\\n|\\r/g, '');\n meta.xml = meta.xml.replace(/>\\s*/g, '>');\n meta.xml = meta.xml.replace(/>\\s*/g, '>');\n metaXml = domParser.parseFromString(meta.xml, 'text/xml');\n const metasObj: Object = XmlParser.xmlToJson(metaXml);\n const metaKeys = Object.keys(metasObj.metadata);\n metaKeys.forEach(key => {\n metadata[key] = metasObj.metadata[key]['#text'];\n });\n }\n });\n }\n return metadata;\n }\n\n /**\n * Returns the base protocol\n * @function _getBaseProtocol\n * @returns {string} - The base protocol\n * @static\n * @private\n */\n static _getBaseProtocol(): string {\n const config = OVPConfiguration.get();\n const protocolRegex = /^https?:/;\n const result = protocolRegex.exec(config.cdnUrl);\n const protocol = result ? result[0] : document.location.protocol;\n if (typeof protocol === 'string') {\n return protocol.slice(0, -1); // remove ':' from the end\n }\n return 'https';\n }\n\n static hasBlockAction(response: OVPMediaEntryLoaderResponse): boolean {\n return response.playBackContextResult.hasBlockAction();\n }\n\n static getBlockAction(response: OVPMediaEntryLoaderResponse): ?KalturaRuleAction {\n return response.playBackContextResult.getBlockAction();\n }\n\n static getErrorMessages(response: OVPMediaEntryLoaderResponse): Array {\n return response.playBackContextResult.getErrorMessages();\n }\n\n /**\n * Applies the request host regex on the url\n * @function _applyRegexAction\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} playUrl - The original url\n * @returns {string} - The request host regex applied url\n * @static\n * @private\n */\n static _applyRegexAction(playbackContext: KalturaPlaybackContext, playUrl: string): string {\n const regexAction = playbackContext.getRequestHostRegexAction();\n if (regexAction) {\n const regex = new RegExp(regexAction.pattern, 'i');\n if (playUrl.match(regex)) {\n return playUrl.replace(regex, regexAction.replacement + '/');\n }\n }\n return playUrl;\n }\n}\n\nexport const addKsToUrl = OVPProviderParser.addKsToUrl;\nexport default OVPProviderParser;\n","//@flow\nimport MultiRequestBuilder from '../../common/multi-request-builder';\nimport OVPConfiguration from '../config';\n\nconst SERVICE_NAME: string = 'multirequest';\n\nexport default class OVPService {\n /**\n * Gets a new instance of MultiRequestBuilder with ovp params\n * @function getMultiRequest\n * @param {string} playerVersion The player version\n * @param {string} ks The ks\n * @param {string} partnerId The partner ID\n * @returns {MultiRequestBuilder} The multi request builder\n * @static\n */\n static getMultiRequest(playerVersion: string, ks: string, partnerId?: number): MultiRequestBuilder {\n const config = OVPConfiguration.get();\n const ovpParams = config.serviceParams;\n Object.assign(ovpParams, {ks: ks, clientTag: 'html5:v' + playerVersion});\n if (partnerId) {\n Object.assign(ovpParams, {partnerId: partnerId});\n }\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const multiReq = new MultiRequestBuilder(headers);\n multiReq.method = 'POST';\n multiReq.service = SERVICE_NAME;\n multiReq.url = multiReq.getUrl(config.serviceUrl);\n multiReq.params = ovpParams;\n return multiReq;\n }\n}\n","//@flow\nconst FIELDS =\n 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status';\nconst RESPONSE_PROFILE_TYPE = {\n INCLUDE_FIELDS: 1,\n EXCLUDE_FIELDS: 2\n};\nexport class BaseEntryResponseProfile {\n static Type: {[type: string]: number} = RESPONSE_PROFILE_TYPE;\n /**\n * @member - the response profile type\n * @type {number}\n */\n type: number;\n /**\n * @member - Comma separated fields list to be included or excluded\n * @type {string}\n */\n fields: string;\n\n /**\n * @constructor\n * @param {Object} responseProfile -\n */\n constructor(responseProfile: Object = {}) {\n this.type = responseProfile.type || BaseEntryResponseProfile.Type.INCLUDE_FIELDS;\n this.fields = responseProfile.fields || FIELDS;\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\nimport {BaseEntryResponseProfile} from '../request-params/base-entry-response-profile';\n\nconst SERVICE_NAME: string = 'baseEntry';\n\nexport default class OVPBaseEntryService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for baseentry.getPlaybackContext\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {serviceEntryId} serviceEntryId The entry id from the request result (to support loading by referenceId)\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static getPlaybackContext(serviceUrl: string, ks: string, serviceEntryId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'getPlaybackContext';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'baseEntry-getPlaybackContext';\n const contextDataParams = {objectType: 'KalturaContextDataParams', flavorTags: 'all'};\n request.params = {entryId: serviceEntryId, ks: ks, contextDataParams: contextDataParams};\n return request;\n }\n\n /**\n * Creates an instance of RequestBuilder for baseentry.list\n * @function list\n * @param {string} serviceUrl The base URL\n * @param {string} ks The ks\n * @param {string} entryId The entry ID\n * @param {boolean} redirectFromEntryId whether the live entry should continue and play the VOD one after the live stream ends.\n * @param {string} referenceId a Reference id instead of an entry id\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static list(serviceUrl: string, ks: string, entryId: string, redirectFromEntryId: boolean, referenceId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'list';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'list';\n request.params = OVPBaseEntryService.getEntryListReqParams(entryId, ks, redirectFromEntryId, referenceId);\n return request;\n }\n\n /**\n * Gets baseentry.list service params\n * @function getEntryListReqParams\n * @param {string} entryId The entry ID\n * @param {string} ks The ks\n * @param {boolean} redirectFromEntryId whether the live entry should continue and play the VOD one after the live stream ends.\n * @param {string} referenceId a Reference id instead of an entry id\n * @returns {{ks: string, filter: {redirectFromEntryId: string}, responseProfile: {fields: string, type: number}}} The service params object\n * @static\n */\n static getEntryListReqParams(entryId: string, ks: string, redirectFromEntryId: boolean, referenceId: string): any {\n let filterParams = {};\n if (entryId) {\n filterParams = redirectFromEntryId ? {redirectFromEntryId: entryId} : {idEqual: entryId};\n } else if (referenceId) {\n filterParams = {objectType: 'KalturaBaseEntryFilter', referenceIdEqual: referenceId};\n }\n\n return {ks: ks, filter: filterParams, responseProfile: new BaseEntryResponseProfile()};\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\n\nconst SERVICE_NAME: string = 'metadata_metadata';\n\nexport default class OVPMetadataService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for metadata_metadata.list\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {string} entryId The entry ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static list(serviceUrl: string, ks: string, entryId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'list';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'metadata_metadata-list';\n const filter = {objectType: 'KalturaMetadataFilter', objectIdEqual: entryId, metadataObjectTypeEqual: '1'};\n request.params = {filter: filter, ks: ks};\n return request;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMediaEntry} from './kaltura-media-entry';\n\nexport class KalturaBaseEntryListResponse extends ServiceResult {\n /**\n * @member - The total count\n * @type {number}\n */\n totalCount: number;\n /**\n * @member - The entries\n * @type {Array}\n */\n entries: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The json response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.totalCount = responseObj.totalCount;\n if (this.totalCount > 0) {\n this.entries = [];\n responseObj.objects.map(entry => this.entries.push(new KalturaMediaEntry(entry)));\n }\n }\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPBaseEntryService from '../services/base-entry-service';\nimport OVPMetadataService from '../services/meta-data-service';\nimport OVPConfiguration from '../config';\nimport {KalturaPlaybackContext} from '../response-types/kaltura-playback-context';\nimport {KalturaMetadataListResponse} from '../response-types/kaltura-metadata-list-response';\nimport {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';\nimport {KalturaMediaEntry} from '../response-types/kaltura-media-entry';\n\ntype OVPMediaEntryLoaderResponse = {\n entry: KalturaMediaEntry,\n playBackContextResult: KalturaPlaybackContext,\n metadataListResult: KalturaMetadataListResponse\n};\nexport type {OVPMediaEntryLoaderResponse};\n\nexport default class OVPMediaEntryLoader implements ILoader {\n _entryId: string;\n _referenceId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'media';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n * @boolean {boolean} useExternalCaptions - if we should add captions request to the multirequests.\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._entryId = params.entryId;\n this._referenceId = params.referenceId;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n let mediaEntryResponse: KalturaBaseEntryListResponse = new KalturaBaseEntryListResponse(response[0].data);\n this._response.entry = mediaEntryResponse.entries[0];\n this._response.playBackContextResult = new KalturaPlaybackContext(response[1].data);\n this._response.metadataListResult = new KalturaMetadataListResponse(response[2].data);\n }\n\n get response(): OVPMediaEntryLoaderResponse {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, params.entryId, params.redirectFromEntryId, params.referenceId));\n // Use the entry id from the request result to support loading by referenceId\n const serviceEntryId = params.ks === '{1:result:ks}' ? '{2:result:objects:0:id}' : '{1:result:objects:0:id}';\n requests.push(OVPBaseEntryService.getPlaybackContext(config.serviceUrl, params.ks, serviceEntryId));\n requests.push(OVPMetadataService.list(config.serviceUrl, params.ks, serviceEntryId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!(this._entryId || this._referenceId);\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\n\nconst SERVICE_NAME: string = 'session';\n\nexport default class OVPSessionService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for session.startWidgetSession\n * @function anonymousSession\n * @param {string} serviceUrl The service base URL\n * @param {string} widgetId The widget ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static anonymousSession(serviceUrl: string, widgetId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'startWidgetSession';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'session-startWidget';\n request.params = {widgetId};\n return request;\n }\n}\n","//@flow\nimport OVPSessionService from '../services/session-service';\nimport OVPConfiguration from '../config';\nimport RequestBuilder from '../../../util/request-builder';\n\nexport default class OVPSessionLoader implements ILoader {\n _widgetId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'session';\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n this._response.ks = response[0].data.ks;\n }\n\n get response(): any {\n return this._response.ks;\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._widgetId = params.widgetId;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPSessionService.anonymousSession(config.serviceUrl, params.widgetId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!this._widgetId;\n }\n}\n","// @flow\nimport DataLoaderManager from '../../common/data-loader-manager';\nimport OVPService from '../services/ovp-service';\n\n/**\n * OTTDataLoaderManager is a class that handles the OVP data loading\n * @param {string} playerVersion - player version\n * @param {string} partnerId - partner id\n * @param {string} ks - ks\n * @param {ProviderNetworkRetryParameters} [networkRetryConfig] - network retry configuration\n */\nexport default class OVPDataLoaderManager extends DataLoaderManager {\n constructor(playerVersion: string, partnerId: number, ks: string = '', networkRetryConfig: ProviderNetworkRetryParameters) {\n super(networkRetryConfig);\n this._multiRequest = OVPService.getMultiRequest(playerVersion, ks, partnerId);\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\nimport {BaseEntryResponseProfile} from '../request-params/base-entry-response-profile';\n\nconst SERVICE_NAME: string = 'playlist';\n\nexport default class OVPPlaylistService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for playlist.getPlaybackContext\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {string} playlistId The playlist ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static execute(serviceUrl: string, ks: string, playlistId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'execute';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = `${SERVICE_NAME}-execute`;\n request.params = {\n ks: ks,\n id: playlistId,\n responseProfile: new BaseEntryResponseProfile()\n };\n return request;\n }\n\n /**\n * Creates an instance of RequestBuilder for playlist.list\n * @function list\n * @param {string} serviceUrl The base URL\n * @param {string} ks The ks\n * @param {string} playlistId The playlist ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static get(serviceUrl: string, ks: string, playlistId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'get';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = `${SERVICE_NAME}-get`;\n request.params = {\n ks: ks,\n id: playlistId,\n responseProfile: {\n fields: 'id,name,description,thumbnailUrl',\n type: 1\n }\n };\n return request;\n }\n}\n","//@flow\n\nexport class KalturaPlaylist {\n /**\n * @member - playlist id\n * @type {string}\n */\n id: string;\n /**\n * @member - playlist name\n * @type {string}\n */\n name: string;\n /**\n * @member - playlist description\n * @type {string}\n */\n description: string;\n /**\n * @member - playlist poster image\n * @type {string}\n */\n poster: string;\n\n /**\n * @constructor\n * @param {Object} playlist - The json response\n */\n constructor(playlist: Object) {\n this.id = playlist.id;\n this.name = playlist.name;\n this.description = playlist.description;\n this.poster = playlist.thumbnailUrl;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMediaEntry} from './kaltura-media-entry';\n\nexport class KalturaMediaEntries extends ServiceResult {\n /**\n * @member - The entries\n * @type {Array}\n */\n entries: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The json response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.entries = [];\n responseObj.map(entry => this.entries.push(new KalturaMediaEntry(entry)));\n }\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPPlaylistService from '../services/playlist-service';\nimport OVPConfiguration from '../config';\nimport {KalturaPlaylist} from '../response-types/kaltura-playlist';\nimport {KalturaMediaEntries} from '../response-types/kaltura-media-entries';\n\nexport default class OVPPlaylistLoader implements ILoader {\n _playlistId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'playlist';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._playlistId = params.playlistId;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n this._response.playlistData = new KalturaPlaylist(response[0].data);\n this._response.playlistItems = new KalturaMediaEntries(response[1].data);\n }\n\n get response(): any {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPPlaylistService.get(config.serviceUrl, params.ks, params.playlistId));\n requests.push(OVPPlaylistService.execute(config.serviceUrl, params.ks, params.playlistId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!this._playlistId;\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPConfiguration from '../config';\nimport OVPBaseEntryService from '../services/base-entry-service';\nimport {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';\n\nexport default class OVPEntryListLoader implements ILoader {\n _entries: Array;\n _requests: Array;\n _response: any = {playlistItems: {entries: []}};\n\n static get id(): string {\n return 'entry_list';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._entries = params.entries;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n let mediaEntryResponse: KalturaBaseEntryListResponse;\n response.forEach(item => {\n mediaEntryResponse = new KalturaBaseEntryListResponse(item.data);\n this._response.playlistItems.entries.push(mediaEntryResponse.entries[0]);\n });\n }\n\n get response(): any {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n params.entries.forEach(entry => {\n requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, entry.entryId || entry, params.redirectFromEntryId, entry.referenceId));\n });\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!(this._entries && this._entries.length);\n }\n}\n","//@flow\nimport getLogger from '../../util/logger';\nimport OVPConfiguration from './config';\nimport OVPProviderParser from './provider-parser';\nimport {KalturaMediaEntry} from './response-types/kaltura-media-entry';\nimport OVPMediaEntryLoader from './loaders/media-entry-loader';\nimport OVPSessionLoader from './loaders/session-loader';\nimport OVPDataLoaderManager from './loaders/data-loader-manager';\nimport OVPPlaylistLoader from './loaders/playlist-loader';\nimport BaseProvider from '../common/base-provider';\nimport MediaEntry from '../../entities/media-entry';\nimport OVPEntryListLoader from './loaders/entry-list-loader';\nimport Error from '../../util/error/error';\n\nexport default class OVPProvider extends BaseProvider {\n _filterOptionsConfig: ProviderFilterOptionsObject = {redirectFromEntryId: true};\n /**\n * @constructor\n * @param {ProviderOptionsObject} options - provider options\n * @param {string} playerVersion - player version\n */\n constructor(options: ProviderOptionsObject, playerVersion: string) {\n super(options, playerVersion);\n this._logger = getLogger('OVPProvider');\n OVPConfiguration.set(options.env);\n this._setFilterOptionsConfig(options.filterOptions);\n this._networkRetryConfig = Object.assign(this._networkRetryConfig, options.networkRetryParameters);\n }\n\n get env() {\n return OVPConfiguration.get();\n }\n\n /**\n * Gets the backend media config.\n * @param {OVPProviderMediaInfoObject} mediaInfo - ovp media info\n * @returns {Promise} - The provider media config\n */\n getMediaConfig(mediaInfo: OVPProviderMediaInfoObject): Promise {\n if (mediaInfo.ks) {\n this.ks = mediaInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const entryId = mediaInfo.entryId;\n const referenceId = mediaInfo.referenceId;\n if (entryId || referenceId) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n const redirectFromEntryId = this._getEntryRedirectFilter(mediaInfo);\n this._dataLoader.add(OVPMediaEntryLoader, {entryId, ks, redirectFromEntryId, referenceId});\n return this._dataLoader.fetchData().then(\n response => {\n try {\n resolve(this._parseDataFromResponse(response));\n } catch (err) {\n reject(err);\n }\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject(new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.MISSING_MANDATORY_PARAMS, {message: 'missing entry id'}));\n }\n });\n }\n\n doRequest(loaders: Array, ks?: string): Promise {\n let theKs: string = ks || this.ks;\n const dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, theKs, this._networkRetryConfig);\n\n return new Promise((resolve, reject) => {\n if (!theKs) {\n dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n loaders.forEach((loaderRequest: RequestLoader) => {\n dataLoader.add(loaderRequest.loader, loaderRequest.params, theKs || '{1:result:ks}');\n });\n return dataLoader.fetchData().then(\n response => {\n try {\n resolve(response);\n } catch (err) {\n reject(err);\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n\n _getEntryRedirectFilter(mediaInfo: Object): boolean {\n return typeof mediaInfo.redirectFromEntryId === 'boolean'\n ? mediaInfo.redirectFromEntryId\n : typeof this._filterOptionsConfig.redirectFromEntryId === 'boolean'\n ? this._filterOptionsConfig.redirectFromEntryId\n : true;\n }\n\n _setFilterOptionsConfig(options?: ProviderFilterOptionsObject): void {\n if (options && typeof options.redirectFromEntryId == 'boolean') {\n this._filterOptionsConfig.redirectFromEntryId = options.redirectFromEntryId;\n }\n }\n\n _parseDataFromResponse(data: Map): ProviderMediaConfigObject {\n this._logger.debug('Data parsing started');\n const mediaConfig: ProviderMediaConfigObject = {\n session: {\n isAnonymous: this._isAnonymous,\n partnerId: this.partnerId\n },\n sources: this._getDefaultSourcesObject(),\n plugins: {}\n };\n\n if (this.uiConfId) {\n mediaConfig.session.uiConfId = this.uiConfId;\n }\n\n if (data) {\n if (data.has(OVPSessionLoader.id)) {\n const sessionLoader = data.get(OVPSessionLoader.id);\n if (sessionLoader && sessionLoader.response) {\n mediaConfig.session.ks = sessionLoader.response;\n if (this.widgetId !== this.defaultWidgetId) {\n this.ks = mediaConfig.session.ks;\n }\n }\n } else {\n mediaConfig.session.ks = this.ks;\n }\n if (data.has(OVPMediaEntryLoader.id)) {\n const mediaLoader = data.get(OVPMediaEntryLoader.id);\n if (mediaLoader && mediaLoader.response) {\n const response = (mediaLoader: OVPMediaEntryLoader).response;\n if (OVPProviderParser.hasBlockAction(response)) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.BLOCK_ACTION, {\n action: OVPProviderParser.getBlockAction(response),\n messages: OVPProviderParser.getErrorMessages(response)\n });\n }\n const mediaEntry = OVPProviderParser.getMediaEntry(this.isAnonymous ? '' : this.ks, this.partnerId, this.uiConfId, response);\n Object.assign(mediaConfig.sources, this._getSourcesObject(mediaEntry));\n this._verifyMediaStatus(mediaEntry);\n this._verifyHasSources(mediaConfig.sources);\n const bumper = OVPProviderParser.getBumper(response, this.isAnonymous ? '' : this.ks, this.partnerId);\n if (bumper) {\n Object.assign(mediaConfig.plugins, {bumper});\n }\n }\n }\n }\n this._logger.debug('Data parsing finished', mediaConfig);\n return mediaConfig;\n }\n\n /**\n * Checks media is ready for playback (not being imported or converted)\n * @param {MediaEntry} mediaEntry - the media entry info\n * @returns {void}\n */\n _verifyMediaStatus(mediaEntry: MediaEntry) {\n if ([KalturaMediaEntry.EntryStatus.IMPORT, KalturaMediaEntry.EntryStatus.PRECONVERT].includes(mediaEntry.status)) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.MEDIA_STATUS_NOT_READY, {\n messages: `Status of entry id ${mediaEntry.id} is ${mediaEntry.status} and is still being imported or converted`,\n data: {status}\n });\n }\n }\n /**\n * Gets the backend playlist config.\n * @param {ProviderPlaylistInfoObject} playlistInfo - ovp playlist info\n * @returns {Promise} - The provider playlist config\n */\n getPlaylistConfig(playlistInfo: ProviderPlaylistInfoObject): Promise {\n if (playlistInfo.ks) {\n this.ks = playlistInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const playlistId = playlistInfo.playlistId;\n if (playlistId) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n this._dataLoader.add(OVPPlaylistLoader, {playlistId, ks});\n this._dataLoader.fetchData().then(\n response => {\n resolve(this._parsePlaylistDataFromResponse(response));\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject({success: false, data: 'Missing mandatory parameter'});\n }\n });\n }\n\n _parsePlaylistDataFromResponse(data: Map): ProviderPlaylistObject {\n this._logger.debug('Data parsing started');\n const playlistConfig: ProviderPlaylistObject = this._getPlaylistObject();\n if (data && data.has(OVPPlaylistLoader.id)) {\n const playlistLoader = data.get(OVPPlaylistLoader.id);\n if (playlistLoader && playlistLoader.response) {\n const playlist = OVPProviderParser.getPlaylist(playlistLoader.response);\n playlistConfig.id = playlist.id;\n playlistConfig.poster = playlist.poster;\n playlistConfig.metadata.name = playlist.name;\n playlistConfig.metadata.description = playlist.description;\n playlist.items.forEach(i => playlistConfig.items.push({sources: this._getSourcesObject(i)}));\n }\n }\n this._logger.debug('Data parsing finished', playlistConfig);\n return playlistConfig;\n }\n\n /**\n * Gets playlist config from entry list.\n * @param {ProviderEntryListObject} entryListInfo - ovp entry list info\n * @returns {Promise} - The provider playlist config\n */\n getEntryListConfig(entryListInfo: ProviderEntryListObject): Promise {\n if (entryListInfo.ks) {\n this.ks = entryListInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const entries = entryListInfo.entries;\n if (entries && entries.length) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n const redirectFromEntryId = this._getEntryRedirectFilter(entryListInfo);\n this._dataLoader.add(OVPEntryListLoader, {entries, ks, redirectFromEntryId});\n this._dataLoader.fetchData().then(\n response => {\n resolve(this._parseEntryListDataFromResponse(response));\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject({success: false, data: 'Missing mandatory parameter'});\n }\n });\n }\n\n _parseEntryListDataFromResponse(data: Map): ProviderPlaylistObject {\n this._logger.debug('Data parsing started');\n const playlistConfig: ProviderPlaylistObject = this._getPlaylistObject();\n if (data && data.has(OVPEntryListLoader.id)) {\n const playlistLoader = data.get(OVPEntryListLoader.id);\n if (playlistLoader && playlistLoader.response) {\n const entryList = OVPProviderParser.getEntryList(playlistLoader.response);\n entryList.items.forEach(i => playlistConfig.items.push({sources: this._getSourcesObject(i)}));\n }\n }\n this._logger.debug('Data parsing finished', playlistConfig);\n return playlistConfig;\n }\n\n _getPlaylistObject(): ProviderPlaylistObject {\n return {\n id: '',\n metadata: {\n name: '',\n description: ''\n },\n poster: '',\n items: []\n };\n }\n\n _getDefaultSourcesObject(): ProviderMediaConfigSourcesObject {\n return {\n hls: [],\n dash: [],\n progressive: [],\n id: '',\n duration: 0,\n type: MediaEntry.Type.UNKNOWN,\n poster: '',\n dvr: false,\n vr: null,\n metadata: {\n name: '',\n description: '',\n tags: ''\n }\n };\n }\n\n _getSourcesObject(mediaEntry: MediaEntry) {\n const sourcesObject: ProviderMediaConfigSourcesObject = this._getDefaultSourcesObject();\n const mediaSources = mediaEntry.sources.toJSON();\n sourcesObject.hls = mediaSources.hls;\n sourcesObject.dash = mediaSources.dash;\n sourcesObject.progressive = mediaSources.progressive;\n sourcesObject.id = mediaEntry.id;\n sourcesObject.duration = mediaEntry.duration;\n sourcesObject.type = mediaEntry.type;\n sourcesObject.dvr = !!mediaEntry.dvrStatus;\n sourcesObject.poster = mediaEntry.poster;\n if (mediaEntry.sources.captions) {\n sourcesObject.captions = mediaEntry.sources.captions;\n }\n if (mediaEntry.metadata && typeof mediaEntry.metadata.tags === 'string' && mediaEntry.metadata.tags.indexOf('360') > -1) {\n sourcesObject.vr = {};\n }\n Object.assign(sourcesObject.metadata, mediaEntry.metadata);\n return sourcesObject;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\n\nexport class KalturaUIConfResponse extends ServiceResult {\n static Type: {[type: string]: number} = {\n PLAYER: 1,\n CONTRIBUTION_WIZARD: 2,\n SIMPLE_EDITOR: 3,\n ADVANCED_EDITOR: 4,\n PLAYLIST: 5,\n APP_STUDIO: 6,\n KRECORD: 7,\n PLAYER_V3: 8,\n KMC_ACCOUNT: 9,\n KMC_ANALYTICS: 10,\n KMC_CONTENT: 11,\n KMC_DASHBOARD: 12,\n KMC_LOGIN: 13,\n PLAYER_SL: 14,\n CLIENTSIDE_ENCODER: 15,\n KMC_GENERAL: 16,\n KMC_ROLES_AND_PERMISSIONS: 17,\n CLIPPER: 18,\n KSR: 19,\n KUPLOAD: 20,\n WEBCASTING: 21\n };\n\n static CreationMode: {[mode: string]: number} = {\n WIZARD: 2,\n ADVANCED: 3\n };\n\n description: string;\n objTypeAsString: string;\n width: number;\n height: number;\n htmlParams: string;\n swfUrl: string;\n confFilePath: string;\n confFile: string;\n confFileFeatures: string;\n name: string;\n config: string;\n confVars: string;\n useCdn: boolean;\n tags: string;\n swfUrlVersion: string;\n created: Date;\n updated: Date;\n html5Url: string;\n version: string;\n partnerTags: string;\n objType: number;\n creationMode: number;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: Object) {\n super(data);\n if (!this.hasError) {\n this.name = data.name;\n this.description = data.description;\n this.objTypeAsString = data.objTypeAsString;\n this.width = data.width;\n this.height = data.height;\n this.htmlParams = data.htmlParams;\n this.swfUrl = data.swfUrl;\n this.confFilePath = data.confFilePath;\n this.confFile = data.confFile;\n this.confFileFeatures = data.confFileFeatures;\n this.config = data.config;\n this.confVars = data.confVars;\n this.useCdn = data.useCdn;\n this.tags = data.tags;\n this.swfUrlVersion = data.swfUrlVersion;\n this.created = new Date(0);\n this.created.setUTCSeconds(data.createdAt);\n this.updated = new Date(0);\n this.updated.setUTCSeconds(data.updatedAt);\n this.html5Url = data.description;\n this.version = data.description;\n this.partnerTags = data.description;\n this.objType = data.description;\n this.creationMode = data.description;\n }\n }\n}\n","// @flow\nimport OVPProvider from './provider';\nimport RequestBuilder from '../../util/request-builder';\nimport ServiceResult from '../common/base-service-result';\nimport * as ResponseTypes from './response-types';\n\ndeclare var __VERSION__: string;\ndeclare var __NAME__: string;\n\nconst NAME = __NAME__ + '-ovp';\nconst VERSION = __VERSION__;\n\nexport {OVPProvider as Provider, NAME, VERSION, RequestBuilder, ResponseTypes, ServiceResult};\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["./providers/webpack/universalModuleDefinition","./providers/webpack/bootstrap","./providers/./util/error/error.js","./providers/./util/error/severity.js","./providers/./util/error/category.js","./providers/./util/error/code.js","./providers/./entities/media-entry.js","./providers/./util/request-builder.js","./providers/./util/logger.js","./providers/./k-provider/common/base-service-result.js","./providers/./entities/media-format.js","./providers/./k-provider/common/response-types/kaltura-drm-playback-plugin-data.js","./providers/./k-provider/common/response-types/kaltura-access-control-message.js","./providers/./entities/media-sources.js","./providers/./entities/media-source.js","./providers/./k-provider/common/data-loader-manager.js","./providers/./k-provider/common/multi-request-builder.js","./providers/./entities/drm.js","./providers/./k-provider/common/base-provider.js","./providers/./util/clone.js","./providers/./entities/entry-list.js","./providers/./entities/bumper.js","./providers/./k-provider/ovp/config.js","./providers/./k-provider/ovp/response-types/kaltura-playback-source.js","./providers/./k-provider/ovp/response-types/kaltura-rule-action.js","./providers/./k-provider/ovp/response-types/kaltura-access-control-modify-request-host-regex-action.js","./providers/./k-provider/ovp/response-types/kaltura-flavor-asset.js","./providers/./k-provider/ovp/response-types/kaltura-bumper.js","./providers/./k-provider/ovp/response-types/kaltura-playback-context.js","./providers/./k-provider/ovp/response-types/kaltura-metadata.js","./providers/./k-provider/ovp/response-types/kaltura-metadata-list-response.js","./providers/./k-provider/ovp/response-types/kaltura-media-entry.js","./providers/./k-provider/ovp/play-source-url-builder.js","./providers/./util/xml-parser.js","./providers/./entities/playlist.js","./providers/./k-provider/ovp/external-captions-builder.js","./providers/./k-provider/ovp/provider-parser.js","./providers/./k-provider/ovp/services/ovp-service.js","./providers/./k-provider/ovp/request-params/base-entry-response-profile.js","./providers/./k-provider/ovp/services/base-entry-service.js","./providers/./k-provider/ovp/services/meta-data-service.js","./providers/./k-provider/ovp/response-types/kaltura-base-entry-list-response.js","./providers/./k-provider/ovp/loaders/media-entry-loader.js","./providers/./k-provider/ovp/services/session-service.js","./providers/./k-provider/ovp/loaders/session-loader.js","./providers/./k-provider/ovp/loaders/data-loader-manager.js","./providers/./k-provider/ovp/services/playlist-service.js","./providers/./k-provider/ovp/response-types/kaltura-playlist.js","./providers/./k-provider/ovp/response-types/kaltura-media-entries.js","./providers/./k-provider/ovp/loaders/playlist-loader.js","./providers/./k-provider/ovp/loaders/entry-list-loader.js","./providers/./k-provider/ovp/provider.js","./providers/./k-provider/ovp/response-types/kaltura-ui-conf-response.js","./providers/./k-provider/ovp/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Error","severity","category","code","data","this","_logger","error","RECOVERABLE","CRITICAL","NETWORK","SERVICE","PROVIDER","UNSUPPORTED_SCHEME","BAD_HTTP_STATUS","HTTP_ERROR","TIMEOUT","MALFORMED_DATA_URI","BAD_SERVER_RESPONSE","MULTIREQUEST_API_ERROR","API_RESPONSE_MISMATCH","ERROR","BLOCK_ACTION","MEDIA_STATUS_NOT_READY","MISSING_MANDATORY_PARAMS","MISSING_PLAY_SOURCE","METHOD_NOT_IMPLEMENTED","getLogger","MediaEntry","metadata","Map","sources","MediaSources","type","Type","UNKNOWN","toJSON","id","duration","dvrStatus","status","poster","assetReferenceType","VOD","LIVE","IMAGE","AUDIO","ON","OFF","RequestBuilder","headers","async","timeout","maxAttempts","getUrl","serviceUrl","service","action","doHttpRequest","promise","Promise","resolve","reject","_requestPromise","url","Severity","Category","Code","_createXHR","request","XMLHttpRequest","onreadystatechange","readyState","response","JSON","parse","responseText","responseHeaders","_getResponseHeaders","_createError","text","open","method","retryConfig","requestTime","performance","now","ontimeout","_handleError","statusText","onerror","onabort","forEach","setRequestHeader","send","params","getAllResponseHeaders","split","filter","header","toLowerCase","indexOf","_attemptCounter","assign","attempt","JsLogger","VERSION","DEBUG","INFO","TIME","TRACE","WARN","createDefaultHandler","debug","enabledFor","getLevel","info","log","setHandler","setLevel","time","timeEnd","trace","useDefaults","warn","LogLevel","setLogger","logger","getLogLevel","setLogLevel","level","ServiceResult","objectType","hasError","ServiceError","message","MediaFormat","DASH","mimeType","pathExt","HLS","WVM","MP4","MP3","SupportedStreamFormat","isProgressiveSource","formatName","sourceFormat","KalturaDrmPlaybackPluginData","drm","scheme","licenseURL","certificate","WIDEVINE_CENC","PLAYREADY_CENC","FAIRPLAY","KalturaAccessControlMessage","progressive","dash","hls","map","source","mediaFormat","push","h","MediaSource","mimetype","bandwidth","width","height","label","drmData","length","Array","isArray","DataLoaderManager","networkRetryConfig","_networkRetryConfig","add","loader","ks","execution_loader","isValid","_loaders","set","startIndex","_multiRequest","requests","executionLoaderResponseMap","from","val","index","_loadersResponseMap","fetchData","execute","then","_multiResponse","prepareData","success","err","loaderDataIndexes","results","slice","MultiRequestBuilder","requestParams","serviceDef","stringify","FAILED_PARSING_REQUEST","multiRequestResult","MultiRequestResult","result","serviceResult","Drm","licenseUrl","BaseProvider","options","playerVersion","_partnerId","partnerId","_widgetId","widgetId","_uiConfId","uiConfId","_isAnonymous","_ks","_playerVersion","defaultWidgetId","getMediaConfig","mediaInfo","getPlaylistConfig","playlistInfo","getEntryListConfig","entryListInfo","_verifyHasSources","concat","messages","clone","node","e","keys","EntryList","items","Bumper","clickThroughUrl","defaultConfig","cdnUrl","serviceParams","apiVersion","format","useApiCaptions","OVPConfiguration","clientConfig","KalturaPlaybackSource","deliveryProfileId","protocols","flavorIds","hasDrmData","hasFlavorIds","getProtocol","protocol","returnValue","KalturaRuleAction","DRM_POLICY","BLOCK","PREVIEW","LIMIT_FLAVORS","ADD_TO_STORAGE","LIMIT_DELIVERY_PROFILES","SERVE_FROM_REMOTE_SERVER","REQUEST_HOST_REGEX","LIMIT_THUMBNAIL_CAPTURE","KalturaAccessControlModifyRequestHostRegexAction","pattern","replacement","replacmenServerNodeId","KalturaFlavorAsset","flavorParamsId","fileExt","bitrate","frameRate","isOriginal","isWeb","containerFormat","videoCodecId","language","QUEUED","CONVERTING","READY","DELETED","NOT_APPLICABLE","TEMP","WAIT_FOR_CONVERT","IMPORTING","VALIDATING","EXPORTING","KalturaBumper","entryId","KalturaPlaybackContext","actions","flavorAssets","flavor","bumperData","bumper","hasBlockAction","undefined","getBlockAction","find","getErrorMessages","getRequestHostRegexAction","KalturaMetadata","metadataProfileId","metadataProfileVersion","metadataObjectType","objectId","version","created","Date","setUTCSeconds","createdAt","updated","updatedAt","xml","AD_CUE_POINT","ANNOTATION","CODE_CUE_POINT","THUMB_CUE_POINT","ENTRY","CATEGORY","USER","PARTNER","DYNAMIC_OBJECT","VALID","INVALID","KalturaMetadataListResponse","responseObj","totalCount","metas","objects","meta","KalturaMediaEntry","entry","referenceId","externalSourceType","description","dataUrl","entryType","mediaType","flavorParamsIds","thumbnailUrl","tags","AUTOMATIC","EXTERNAL_MEDIA","MEDIA_CLIP","MIX","PLAYLIST","DATA","LIVE_STREAM","LIVE_CHANNEL","DOCUMENT","VIDEO","LIVE_STREAM_FLASH","LIVE_STREAM_WINDOWS_MEDIA","LIVE_STREAM_REAL_MEDIA","LIVE_STREAM_QUICK_TIME","ERROR_IMPORTING","ERROR_CONVERTING","SCAN_FAILURE","IMPORT","INFECTED","PRECONVERT","PENDING","MODERATE","BLOCKED","NO_CONTENT","PENDING_MODERATION","APPROVED","REJECTED","FLAGGED_FOR_REVIEW","AUTO_APPROVED","PlaySourceUrlBuilder","build","urlParams","config","serviceUrlOrigin","substr","lastIndexOf","extension","playUrl","endsWith","XmlParser","xmlToJson","obj","nodeType","attributes","j","attribute","item","nodeName","nodeValue","hasChildNodes","childNodes","old","Playlist","KalturaCaptionType","SRT","DFXP","WEBVTT","CAP","CaptionsFormatsMap","ExternalCaptionsBuilder","createConfig","captions","caption","includes","webVttUrl","addKsToUrl","default","isDefault","languageCode","OVPProviderParser","getMediaEntry","mediaEntryResponse","mediaEntry","playbackContext","playBackContextResult","metadataList","metadataListResult","kalturaSources","_getParsedSources","playbackCaptions","_fillBaseData","ksParam","replace","getPlaylist","playlistResponse","playlist","playlistData","playlistItems","entries","getEntryList","entryList","getBumper","assetResponse","progressiveBumper","parsedSources","_parseProgressiveSources","_parseMetadata","_getEntryType","entryTypeEnum","typeEnum","MediaType","EntryType","progressiveSource","mediaSource","addAdaptiveSource","parsedSource","_parseAdaptiveSource","_getBaseProtocol","kalturaSource","_applyRegexAction","drmParams","Scheme","videoSources","audioSources","sourceId","metaXml","domParser","DOMParser","parseFromString","metasObj","exec","document","location","regexAction","regex","RegExp","match","OVPService","getMultiRequest","ovpParams","clientTag","multiReq","BaseEntryResponseProfile","responseProfile","INCLUDE_FIELDS","fields","EXCLUDE_FIELDS","OVPBaseEntryService","getPlaybackContext","serviceEntryId","tag","contextDataParams","flavorTags","list","redirectFromEntryId","getEntryListReqParams","filterParams","idEqual","referenceIdEqual","OVPMetadataService","objectIdEqual","metadataObjectTypeEqual","KalturaBaseEntryListResponse","OVPMediaEntryLoader","buildRequests","_entryId","_referenceId","_requests","_response","OVPSessionService","anonymousSession","OVPSessionLoader","OVPDataLoaderManager","OVPPlaylistService","playlistId","SERVICE_NAME","KalturaPlaylist","KalturaMediaEntries","OVPPlaylistLoader","_playlistId","OVPEntryListLoader","_entries","OVPProvider","env","_setFilterOptionsConfig","filterOptions","networkRetryParameters","_dataLoader","_getEntryRedirectFilter","_parseDataFromResponse","doRequest","loaders","theKs","dataLoader","loaderRequest","_filterOptionsConfig","mediaConfig","session","isAnonymous","_getDefaultSourcesObject","plugins","has","sessionLoader","mediaLoader","_getSourcesObject","_verifyMediaStatus","EntryStatus","_parsePlaylistDataFromResponse","playlistConfig","_getPlaylistObject","playlistLoader","_parseEntryListDataFromResponse","dvr","vr","sourcesObject","mediaSources","KalturaUIConfResponse","objTypeAsString","htmlParams","swfUrl","confFilePath","confFile","confFileFeatures","confVars","useCdn","swfUrlVersion","html5Url","partnerTags","objType","creationMode","PLAYER","CONTRIBUTION_WIZARD","SIMPLE_EDITOR","ADVANCED_EDITOR","APP_STUDIO","KRECORD","PLAYER_V3","KMC_ACCOUNT","KMC_ANALYTICS","KMC_CONTENT","KMC_DASHBOARD","KMC_LOGIN","PLAYER_SL","CLIENTSIDE_ENCODER","KMC_GENERAL","KMC_ROLES_AND_PERMISSIONS","CLIPPER","KSR","KUPLOAD","WEBCASTING","WIZARD","ADVANCED","NAME","__NAME__","__VERSION__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,KAEjBD,EAAc,QAAIA,EAAc,SAAK,GAAIA,EAAc,QAAa,UAAIA,EAAc,QAAa,WAAK,GAAIA,EAAc,QAAa,UAAO,IAAIC,KARpJ,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAStB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BC,cAAe,EACfC,gBAAiB,EACjB3N,SAAU,EACV4N,WAAY,EACZC,QAAS,EACTC,UAAW,EACXC,YAAa,EACbC,cAAe,GACfC,YAAa,GACbC,cAAe,GACfC,UAAW,GACXC,UAAW,GACXC,mBAAoB,GACpBC,YAAa,GACbC,0BAA2B,GAC3BC,QAAS,GACTC,IAAK,GACLC,QAAS,GACTC,WAAY,K,GAtBHjC,G,eAyBqC,CAC9CkC,OAAQ,EACRC,SAAU,ICtBd,IAAMC,GAAOC,2BACPve,GAAUwe","file":"playkit-ovp-provider.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ovp\"] = factory();\n\telse\n\t\troot[\"playkit\"] = root[\"playkit\"] || {}, root[\"playkit\"][\"providers\"] = root[\"playkit\"][\"providers\"] || {}, root[\"playkit\"][\"providers\"][\"ovp\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 17);\n","//@flow\nimport getLogger from '../logger';\nimport {Severity} from './severity';\nimport type {SeverityType} from './severity';\nimport {Code} from './code';\nimport type {CodeType} from './code';\nimport {Category} from './category';\nimport type {CategoryType} from './category';\n\nconst CLASS_NAME: string = 'Error';\n\n/**\n * @classdesc This is a description of the error class.\n */\nexport default class Error {\n severity: number;\n category: number;\n code: number;\n data: any;\n /**\n * @enum {number}\n */\n static Severity: SeverityType = Severity;\n /**\n * @enum {number}\n */\n static Category: CategoryType = Category;\n /**\n * @enum {number}\n */\n static Code: CodeType = Code;\n static _logger: any = getLogger(CLASS_NAME);\n\n /**\n * @constructor\n * @param {number} severity - error's severity\n * @param {number} category - error's category.\n * @param {number} code - error's code.\n * @param {any} data - additional data for the error.\n */\n constructor(severity: number, category: number, code: number, data: any = {}) {\n this.severity = severity;\n this.category = category;\n this.code = code;\n this.data = data;\n Error._logger.error(`Category:${category} | Code:${code} |`, data);\n }\n}\n","//@flow\n\ntype SeverityType = {[severity: string]: number};\n\nconst Severity: SeverityType = {\n /**\n * An error occurred, but the Player is attempting to recover from the error.\n *\n * If the Player cannot ultimately recover, it still may not throw a CRITICAL\n * error. For example, retrying for a media segment will never result in\n * a CRITICAL error (the Player will just retry forever).\n */\n RECOVERABLE: 1,\n /**\n * A critical error that the library cannot recover from. These usually cause\n * the Player to stop loading or updating. A new manifest must be loaded\n * to reset the library.\n */\n CRITICAL: 2\n};\n\nexport {Severity};\nexport type {SeverityType};\n","//@flow\ntype CategoryType = {[category: string]: number};\n\nconst Category: CategoryType = {\n /** Errors from the network stack. */\n NETWORK: 1,\n SERVICE: 2,\n PROVIDER: 3\n};\n\nexport {Category};\nexport type {CategoryType};\n","//@flow\n\ntype CodeType = {[code: string]: number};\n\nconst Code: CodeType = {\n /**\n * A network request was made using an unsupported URI scheme.\n */\n UNSUPPORTED_SCHEME: 1000,\n\n /**\n * An HTTP network request returned an HTTP status that indicated a failure.\n */\n BAD_HTTP_STATUS: 1001,\n\n /**\n * An HTTP network request failed with an error, but not from the server.\n */\n HTTP_ERROR: 1002,\n\n /**\n * A network request timed out.\n */\n TIMEOUT: 1003,\n\n /**\n * A network request was made with a malformed data URI.\n */\n MALFORMED_DATA_URI: 1004,\n\n /**\n * The server responsded with 2xx response, but it couldn't be parsed\n */\n BAD_SERVER_RESPONSE: 1005,\n\n /**\n * The server response had a valid structure but contained an error from the API\n */\n MULTIREQUEST_API_ERROR: 1006,\n\n /**\n * The server response had a valid structure and valid API result, but it did not match the request\n */\n API_RESPONSE_MISMATCH: 1007,\n\n /**\n * The server responded with an error\n */\n ERROR: 2000,\n\n /**\n * The server responded with a block action\n */\n BLOCK_ACTION: 2001,\n\n /**\n * The server responded with status import or pre convert\n */\n MEDIA_STATUS_NOT_READY: 2002,\n\n /**\n * The provider is missing mandatory parameter/s\n */\n\n MISSING_MANDATORY_PARAMS: 3000,\n\n /**\n * The server responded with empty sources objects (for HLS, Dash and progressive)\n */\n MISSING_PLAY_SOURCE: 3001,\n\n /**\n * The provider doesn't implement the called api\n */\n METHOD_NOT_IMPLEMENTED: 3002\n};\n\nexport {Code};\nexport type {CodeType};\n","//@flow\nimport MediaSources from './media-sources';\n\nexport default class MediaEntry {\n static Type: {[type: string]: string} = {\n VOD: 'Vod',\n LIVE: 'Live',\n IMAGE: 'Image',\n AUDIO: 'Audio',\n UNKNOWN: 'Unknown'\n };\n static DvrStatus: {[type: string]: number} = {\n ON: 1,\n OFF: 0\n };\n\n /**\n * @member - entry id\n * @type {string}\n */\n id: string;\n /**\n * @member - entry name\n * @type {string}\n */\n name: string;\n /**\n * @member - entry sources\n * @type {MediaSources}\n */\n sources: MediaSources;\n /**\n * @member - entry duration\n * @type {number}\n */\n duration: number;\n /**\n * @member - entry type\n * @type {string}\n */\n type: string;\n /**\n * @member - entry metadata\n * @type {Object}\n */\n metadata: Object;\n /**\n * @member - DVR status\n * @type {number}\n */\n dvrStatus: number;\n /**\n * @member - media status\n * @type {number}\n */\n status: number;\n /**\n * @member - media poster\n * @type {string | Array}\n */\n poster: string | Array;\n\n /**\n * @member - assetReferenceType\n * @type {string }\n */\n assetReferenceType: string;\n\n /**\n * @constructor\n */\n constructor() {\n this.metadata = new Map();\n this.sources = new MediaSources();\n this.type = MediaEntry.Type.UNKNOWN;\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaEntryObject} - The json class object.\n */\n toJSON(): ProviderMediaEntryObject {\n return {\n id: this.id,\n name: this.name,\n sources: this.sources.toJSON(),\n duration: this.duration,\n dvrStatus: this.dvrStatus,\n status: this.status,\n metadata: this.metadata,\n type: this.type,\n poster: this.poster,\n assetReferenceType: this.assetReferenceType\n };\n }\n}\n","//@flow\nimport Error from './error/error';\n\nconst KALTURA_HEADER_PREFIX: string = 'x-';\n\nexport default class RequestBuilder {\n /**\n * @member - Service name\n * @type {string}\n */\n service: string;\n /**\n * @member - Service action\n * @type {string}\n */\n action: string;\n /**\n * @member - Service params\n * @type {any}\n */\n params: any;\n /**\n * @memberof - Service headers\n * @type {Map}\n */\n headers: Map;\n /**\n * @memberof - Service URL\n * @type {string}\n */\n url: string;\n /**\n * @memberof - Service method (POST,GET,DELETE etc..)\n * @type {string}\n */\n method: string;\n /**\n * @memberof - Service tag\n * @type {string}\n */\n tag: string;\n /**\n * @memberof - the response headers of the arra\n * @type {Array}\n */\n responseHeaders: Array;\n /**\n * @description network retry configuration\n * @memberof RequestBuilder\n * @type {ProviderNetworkRetryParameters}\n */\n retryConfig: ProviderNetworkRetryParameters = {\n async: true,\n timeout: 0,\n maxAttempts: 4\n };\n\n /**\n * @description number of xhr attempts for the same multi - request.\n * @memberof RequestBuilder\n * @type {number}\n * @private\n */\n _attemptCounter: number = 1;\n\n /**\n * @description hold the promise result of the XHR request(s) - if all tries fails, it rejects with the error.\n * @memberof RequestBuilder\n * @type {Object}\n * @private\n */\n _requestPromise: Object;\n\n /**\n * @constructor\n * @param {Map} headers The request headers\n */\n constructor(headers: Map = new Map()) {\n this.headers = headers;\n }\n\n /**\n * Builds restful service URL\n * @function getUrl\n * @param {string} serviceUrl - The service base URL\n * @returns {string} The service URL\n */\n getUrl(serviceUrl: string): string {\n return serviceUrl + '/service/' + this.service + (this.action ? '/action/' + this.action : '');\n }\n\n /**\n * Executes service\n * @function doHttpRequest\n * @returns {Promise.} Service response as promise\n */\n doHttpRequest(): Promise {\n const promise = new Promise((resolve, reject) => {\n this._requestPromise = {\n resolve,\n reject\n };\n });\n if (!this.url) {\n this._requestPromise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.MALFORMED_DATA_URI, {\n url: this.url\n })\n );\n }\n this._createXHR();\n return promise;\n }\n\n _createXHR(): void {\n let request = new XMLHttpRequest();\n request.onreadystatechange = () => {\n if (request.readyState === 4) {\n if (request.status === 200) {\n try {\n const response = JSON.parse(request.responseText);\n this.responseHeaders = this._getResponseHeaders(request);\n // the promise returns the response for backwards compatibility\n return this._requestPromise.resolve(response);\n } catch (error) {\n this._requestPromise.reject(\n this._createError(request, Error.Code.BAD_SERVER_RESPONSE, {\n text: request.responseText\n })\n );\n }\n }\n }\n };\n request.open(this.method, this.url, this.retryConfig.async);\n if (this.retryConfig.async && this.retryConfig.timeout) {\n request.timeout = this.retryConfig.timeout;\n }\n const requestTime = performance.now();\n request.ontimeout = () => {\n this._handleError(request, Error.Code.TIMEOUT, {\n timeout: (performance.now() - requestTime) / 1000,\n statusText: request.statusText\n });\n };\n request.onerror = request.onabort = () => {\n this._handleError(request, Error.Code.HTTP_ERROR, {\n text: request.responseText,\n statusText: request.statusText\n });\n };\n this.headers.forEach((value, key) => {\n request.setRequestHeader(key, value);\n });\n request.send(this.params);\n }\n\n _getResponseHeaders(request: XMLHttpRequest): Array {\n return request\n .getAllResponseHeaders()\n .split('\\n')\n .filter(header => header.toLowerCase().indexOf(KALTURA_HEADER_PREFIX) === 0);\n }\n\n _handleError(request: XMLHttpRequest, code: number, data: Object): Promise<*> | void {\n const error = this._createError(request, code, data);\n request.onreadystatechange = function () {};\n request.onerror = function () {};\n request.ontimeout = function () {};\n request.onabort = function () {};\n if (this.retryConfig.maxAttempts && this._attemptCounter < this.retryConfig.maxAttempts) {\n this._attemptCounter++;\n this._createXHR();\n } else {\n return this._requestPromise.reject(error);\n }\n }\n\n _createError(request: XMLHttpRequest, code: number, data: Object): Error {\n Object.assign(data, {\n url: this.url,\n headers: this._getResponseHeaders(request),\n attempt: this._attemptCounter\n });\n return new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, code, data);\n }\n}\n","//@flow\nexport type LogLevelObject = {value: number, name: string};\nexport type LogLevelType = {[level: string]: LogLevelObject};\nexport type loggerFunctionType = {\n VERSION: String,\n DEBUG: LogLevelObject,\n ERROR: LogLevelObject,\n INFO: LogLevelObject,\n OFF: LogLevelObject,\n TIME: LogLevelObject,\n TRACE: LogLevelObject,\n WARN: LogLevelObject,\n createDefaultHandler: Function,\n debug: Function,\n enabledFor: Function,\n error: Function,\n get: Function,\n getLevel: Function,\n info: Function,\n log: Function,\n setHandler: Function,\n setLevel: Function,\n time: Function,\n timeEnd: Function,\n trace: Function,\n useDefaults: Function,\n warn: Function\n};\n\nexport type LoggerType = {\n getLogger: loggerFunctionType,\n LogLevel: LogLevelType\n};\n\nlet JsLogger = {\n get: () => ({\n VERSION: '',\n DEBUG: {value: '', name: ''},\n ERROR: {value: '', name: ''},\n INFO: {value: '', name: ''},\n OFF: {value: '', name: ''},\n TIME: {value: '', name: ''},\n TRACE: {value: '', name: ''},\n WARN: {value: '', name: ''},\n createDefaultHandler: () => {},\n debug: () => {},\n enabledFor: () => {},\n error: () => {},\n get: () => {},\n getLevel: () => {},\n info: () => {},\n log: () => {},\n setHandler: () => {},\n setLevel: () => {},\n time: () => {},\n timeEnd: () => {},\n trace: () => {},\n useDefaults: () => {},\n warn: () => {}\n })\n};\n\nlet LogLevel: LogLevelType = {};\n/**\n * set logger\n * @param {LoggerType} logger - the logger\n * @returns {void}\n */\nfunction setLogger(logger: ?LoggerType): void {\n if (logger && typeof logger.getLogger === 'function') {\n JsLogger.get = logger.getLogger;\n }\n if (logger && logger.LogLevel) {\n LogLevel = logger.LogLevel;\n }\n}\n\n/**\n * get a logger\n * @param {?string} name - the logger name\n * @returns {Object} - the logger class\n */\nfunction getLogger(name?: string): Object {\n //$FlowFixMe\n return JsLogger.get(name);\n}\n\n/**\n * get the log level\n * @param {?string} name - the logger name\n * @returns {LogLevelObject} - the log level\n */\nfunction getLogLevel(name?: string): LogLevelObject {\n return getLogger(name).getLevel();\n}\n\n/**\n * sets the logger level\n * @param {LogLevelObject} level - the log level\n * @param {?string} name - the logger name\n * @returns {void}\n */\nfunction setLogLevel(level: LogLevelObject, name?: string): void {\n getLogger(name).setLevel(level);\n}\n\nexport default getLogger;\nexport {getLogLevel, setLogLevel, setLogger, LogLevel};\n","//@flow\nexport default class ServiceResult {\n /**\n * @member - Is service returned an error\n * @type {boolean}\n */\n hasError: boolean = false;\n /**\n * @member - The service error\n * @type {ServiceError}\n */\n error: ServiceError;\n /**\n * @member - The service result data\n * @type {Object}\n */\n data: Object;\n\n /**\n * @constructor\n * @param {Object} response - Service response\n */\n constructor(response: Object) {\n if (response.objectType === 'KalturaAPIException') {\n this.hasError = true;\n this.error = new ServiceError(response.code, response.message);\n } else if (response.error && response.error.objectType === 'KalturaAPIException') {\n this.hasError = true;\n this.error = new ServiceError(response.error.code, response.error.message);\n } else {\n this.data = response;\n }\n }\n}\n\nclass ServiceError {\n /**\n * @member - The error code\n * @type {string}\n */\n code: string;\n /**\n * @member - The error message\n * @type {string}\n */\n message: string;\n\n /**\n * @constructor\n * @param {string} code - The result code\n * @param {string} message - The result message\n */\n constructor(code: string, message: string) {\n this.code = code;\n this.message = message;\n }\n}\n","//@flow\nexport const MediaFormat: {[name: string]: ProviderMediaFormatType} = {\n DASH: {\n name: 'dash',\n mimeType: 'application/dash+xml',\n pathExt: 'mpd'\n },\n HLS: {\n name: 'hls',\n mimeType: 'application/x-mpegURL',\n pathExt: 'm3u8'\n },\n WVM: {\n name: 'wvm',\n mimeType: 'video/wvm',\n pathExt: 'wvm'\n },\n MP4: {\n name: 'mp4',\n mimeType: 'video/mp4',\n pathExt: 'mp4'\n },\n MP3: {\n name: 'mp3',\n mimeType: 'audio/mpeg',\n pathExt: 'mp3'\n }\n};\n\nexport const SupportedStreamFormat: Map = new Map([\n ['mpegdash', MediaFormat.DASH],\n ['applehttp', MediaFormat.HLS],\n ['url', MediaFormat.MP4]\n]);\n\n/**\n * returns a boolean whether a source is progressive or not\n * @param {string} formatName - the format name\n * @returns {boolean} - if source is progressive or not\n */\nfunction isProgressiveSource(formatName: string): boolean {\n const sourceFormat = SupportedStreamFormat.get(formatName);\n return !!sourceFormat && sourceFormat.name === MediaFormat.MP4.name;\n}\n\nexport {isProgressiveSource};\n","//@flow\nexport class KalturaDrmPlaybackPluginData {\n static Scheme: {[scheme: string]: string} = {\n 'drm.PLAYREADY_CENC': 'com.microsoft.playready',\n 'drm.WIDEVINE_CENC': 'com.widevine.alpha',\n 'fairplay.FAIRPLAY': 'com.apple.fairplay',\n WIDEVINE_CENC: 'com.widevine.alpha',\n PLAYREADY_CENC: 'com.microsoft.playready',\n FAIRPLAY: 'com.apple.fairplay'\n };\n\n /**\n * @member - The drm scheme\n * @type {string}\n */\n scheme: string;\n\n /**\n * @member - The license URL\n * @type {string}\n */\n licenseURL: string;\n\n /**\n * @member - The drm certificate\n * @type {?string}\n */\n certificate: ?string;\n\n /**\n * @constructor\n * @param {Object} drm The json response\n */\n constructor(drm: any) {\n this.scheme = drm.scheme;\n this.licenseURL = drm.licenseURL;\n this.certificate = drm.certificate;\n }\n}\n","//@flow\nexport class KalturaAccessControlMessage {\n /**\n * @member - The access control message\n * @type {string}\n */\n message: string;\n /**\n * @member - The access control message code\n * @@type {string}\n */\n code: string;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: Object) {\n this.message = data.message;\n this.code = data.code;\n }\n}\n","// @flow\nimport MediaSource from './media-source';\nimport {MediaFormat} from './media-format';\n\nexport default class MediaSources {\n /**\n * Progressive download media sources container.\n * @type {Array}\n * @public\n */\n progressive: Array;\n /**\n * Dash media sources container.\n * @type {Array}\n * @public\n */\n dash: Array;\n /**\n * Hls media sources container.\n * @type {Array}\n * @public\n */\n hls: Array;\n captions: Array;\n\n /**\n * @constructor\n */\n constructor() {\n this.progressive = [];\n this.dash = [];\n this.hls = [];\n }\n\n /**\n * Maps the source to one of the containers according to his media format.\n * @param {MediaSource} source - The source to add to one of the containers.\n * @param {MediaFormat} mediaFormat - The media format of the source.\n * @returns {void}\n */\n map(source: MediaSource, mediaFormat: ?ProviderMediaFormatType) {\n if (mediaFormat) {\n switch (mediaFormat.name) {\n case MediaFormat.MP4.name:\n this.progressive.push(source);\n break;\n case MediaFormat.DASH.name:\n this.dash.push(source);\n break;\n case MediaFormat.HLS.name:\n this.hls.push(source);\n break;\n default:\n break;\n }\n }\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaSourcesObject} - The json class object.\n */\n toJSON(): ProviderMediaSourcesObject {\n const response: ProviderMediaSourcesObject = {\n progressive: [],\n dash: [],\n hls: []\n };\n this.progressive.forEach(p => response.progressive.push(p.toJSON()));\n this.hls.forEach(h => response.hls.push(h.toJSON()));\n this.dash.forEach(d => response.dash.push(d.toJSON()));\n return response;\n }\n}\n","//@flow\nimport Drm from './drm';\n\nexport default class MediaSource {\n /**\n * @member - media source id\n * @type {string}\n */\n id: string;\n /**\n * @member - media source url\n * @type {string}\n */\n url: string;\n /**\n * @member - media source mimetype\n * @type {string}\n */\n mimetype: string;\n /**\n * @member - media source drm data\n * @type {Array}\n */\n drmData: Array;\n /**\n * @member - media source bandwidth\n * @type {number}\n */\n bandwidth: number;\n /**\n * @member - media source width\n * @type {number}\n */\n width: number;\n /**\n * @member - media source height\n * @type {number}\n */\n height: number;\n /**\n * @member - media source label\n * @type {string}\n */\n label: string;\n\n /**\n * Convert class to native js object.\n * @returns {ProviderMediaSourceObject} - The json class object.\n */\n toJSON(): ProviderMediaSourceObject {\n const response: ProviderMediaSourceObject = {\n id: this.id,\n url: this.url,\n mimetype: this.mimetype\n };\n if (this.bandwidth) response.bandwidth = this.bandwidth;\n if (this.width) response.width = this.width;\n if (this.height) response.height = this.height;\n if (this.label) response.label = this.label;\n if (this.drmData && this.drmData.length > 0) {\n response.drmData = [];\n this.drmData.forEach(d => {\n if (Array.isArray(response.drmData)) {\n response.drmData.push(d.toJSON());\n }\n });\n }\n return response;\n }\n}\n","// @flow\nimport MultiRequestBuilder, {MultiRequestResult} from './multi-request-builder';\nimport Error from '../../util/error/error';\n\nexport default class DataLoaderManager {\n /**\n * @member - Loaders response map index\n * @type {Map>}\n * @private\n */\n _loadersResponseMap: Map> = new Map();\n /**\n * @member - Loaders multi request\n * @type {MultiRequestBuilder}\n * @protected\n */\n _multiRequest: MultiRequestBuilder;\n /**\n * @member - Loaders multi response\n * @type {MultiRequestResult}\n * @private\n */\n _multiResponse: MultiRequestResult;\n /**\n * @member - Loaders to execute\n * @type {Map}\n * @private\n */\n _loaders: Map = new Map();\n\n _networkRetryConfig: ProviderNetworkRetryParameters;\n\n constructor(networkRetryConfig: ProviderNetworkRetryParameters) {\n this._networkRetryConfig = networkRetryConfig;\n }\n\n /**\n * Add loader to execution loaders map\n * @function\n * @param {Function} loader Loader to add\n * @param {Object} params Loader params\n * @param {string} ks ks\n * @returns {void}\n */\n add(loader: Function, params: Object, ks?: string): void {\n let execution_loader = new loader(params);\n if (execution_loader.isValid()) {\n this._loaders.set(loader.id, execution_loader);\n // Get the start index from the multiReqeust before adding current execution_loader requests\n let startIndex = this._multiRequest.requests.length;\n // Get the requests\n let requests = execution_loader.requests;\n this._multiRequest.retryConfig = this._networkRetryConfig;\n // Add requests to multiRequest queue\n requests.forEach(request => {\n request.params = request.params || {};\n request.params.ks = request.params.ks || ks;\n this._multiRequest.add(request);\n });\n // Create range array of current execution_loader requests\n let executionLoaderResponseMap = Array.from(new Array(requests.length), (val, index) => index + startIndex);\n // Add to map\n this._loadersResponseMap.set(loader.id, executionLoaderResponseMap);\n }\n }\n\n /**\n * Get data from all loaders using multi request\n * @function\n * @returns {Promise} Promise\n */\n fetchData(): Promise {\n return new Promise((resolve, reject) => {\n this._multiRequest.execute().then(\n data => {\n this._multiResponse = data.response;\n let preparedData: Object = this.prepareData(data.response);\n if (preparedData.success) {\n resolve(this._loaders);\n } else {\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.API_RESPONSE_MISMATCH, {\n headers: data.headers\n })\n );\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n\n /**\n * Prepare fetched data\n * @function\n * @param {MultiRequestResult} response - The multi request result\n * @returns {Object} - The prepared data\n */\n prepareData(response: MultiRequestResult): Object {\n this._loaders.forEach((loader, name) => {\n let loaderDataIndexes = this._loadersResponseMap.get(name);\n try {\n if (loaderDataIndexes && loaderDataIndexes.length > 0) {\n loader.response = response.results.slice(loaderDataIndexes[0], loaderDataIndexes[loaderDataIndexes.length - 1] + 1);\n }\n } catch (err) {\n return {success: false, error: err};\n }\n });\n return {success: true, data: this._loaders};\n }\n}\n","//@flow\nimport RequestBuilder from '../../util/request-builder';\nimport getLogger from '../../util/logger';\nimport ServiceResult from './base-service-result';\nimport Error from '../../util/error/error';\n\nexport default class MultiRequestBuilder extends RequestBuilder {\n static _logger = getLogger('MultiRequestBuilder');\n /**\n * @memberof - MultiRequestBuilder\n * @type {Array}\n */\n requests: Array = [];\n /**\n * Adds request to requests array\n * @function add\n * @param {RequestBuilder} request The request\n * @returns {MultiRequestBuilder} The multiRequest\n */\n add(request: RequestBuilder): MultiRequestBuilder {\n this.requests.push(request);\n const requestParams = {};\n const serviceDef: Object = {service: request.service, action: request.action};\n Object.assign(requestParams, {[this.requests.length]: Object.assign(serviceDef, request.params)});\n Object.assign(requestParams, this.params);\n this.params = requestParams;\n return this;\n }\n\n /**\n * Executes a multi request\n * @function execute\n * @returns {Promise} The multirequest execution promise\n */\n execute(): Promise {\n return new Promise((resolve, reject) => {\n try {\n this.params = JSON.stringify(this.params);\n } catch (err) {\n MultiRequestBuilder._logger.error(`${err.message}`);\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.FAILED_PARSING_REQUEST, {\n error: err,\n params: this.params\n })\n );\n }\n this.doHttpRequest().then(\n data => {\n const multiRequestResult = new MultiRequestResult(data);\n if (multiRequestResult.success) {\n resolve({\n headers: this.responseHeaders,\n response: multiRequestResult\n });\n } else {\n reject(\n new Error(Error.Severity.CRITICAL, Error.Category.NETWORK, Error.Code.MULTIREQUEST_API_ERROR, {\n url: this.url,\n headers: this.responseHeaders,\n results: multiRequestResult.results\n })\n );\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n}\n\nexport class MultiRequestResult {\n static _logger = getLogger('MultiRequestResult');\n /**\n * @memberof MultiRequestResult\n * @type {boolean}\n */\n success: boolean;\n /**\n * @memberof MultiRequestResult\n * @type {Object}\n */\n results: Array = [];\n /**\n * @constructor\n * @param {Object} response data\n */\n constructor(response: Object) {\n this.success = true;\n const result = response.result ? response.result : response;\n const responseArr = Array.isArray(result) ? result : [result];\n responseArr.forEach(result => {\n const serviceResult: ServiceResult = new ServiceResult(result);\n this.results.push(serviceResult);\n if (serviceResult.hasError) {\n MultiRequestResult._logger.error(\n `Service returned an error with error code: ${serviceResult.error.code} and message: ${serviceResult.error.message}.`\n );\n this.success = false;\n return;\n }\n });\n }\n}\n","//@flow\nexport default class Drm {\n /**\n * @member - license url\n * @type {string}\n */\n licenseUrl: string;\n /**\n * @member - drm scheme\n * @type {string}\n */\n scheme: string;\n\n /**\n * @member - drm certificate\n * @type {string}\n */\n certificate: string;\n\n /**\n * @constructor\n * @param {string} licenseUrl - the license url\n * @param {string} scheme - the drm scheme\n * @param {?string} certificate - the drm certificate\n */\n constructor(licenseUrl: string, scheme: string, certificate: ?string) {\n this.licenseUrl = licenseUrl;\n this.scheme = scheme;\n if (certificate) {\n this.certificate = certificate;\n }\n }\n\n /**\n * Convert class to native js object.\n * @returns {ProviderDrmDataObject} - The json class object.\n */\n toJSON(): ProviderDrmDataObject {\n const response: ProviderDrmDataObject = {\n licenseUrl: this.licenseUrl,\n scheme: this.scheme\n };\n if (this.certificate) response.certificate = this.certificate;\n return response;\n }\n}\n","// @flow\nimport {getLogLevel, setLogLevel, setLogger, type LogLevelType, LogLevel} from '../../util/logger';\nimport DataLoaderManager from './data-loader-manager';\nimport Error from '../../util/error/error';\n\nexport default class BaseProvider {\n _partnerId: number;\n _widgetId: ?string;\n _ks: string;\n _uiConfId: ?number;\n _dataLoader: DataLoaderManager;\n _playerVersion: string;\n _logger: any;\n _isAnonymous: boolean;\n _networkRetryConfig: ProviderNetworkRetryParameters = {\n async: true,\n timeout: 0,\n maxAttempts: 4\n };\n\n get partnerId(): number {\n return this._partnerId;\n }\n\n get widgetId(): string {\n return this._widgetId || this.defaultWidgetId;\n }\n\n get defaultWidgetId(): string {\n return '_' + this._partnerId;\n }\n\n get uiConfId(): ?number {\n return this._uiConfId;\n }\n\n get ks(): string {\n return this._ks;\n }\n\n set ks(value: string): void {\n this._ks = value;\n }\n\n get playerVersion(): string {\n return this._playerVersion;\n }\n\n get isAnonymous(): boolean {\n return this._isAnonymous;\n }\n\n constructor(options: ProviderOptionsObject, playerVersion: string) {\n setLogger(options.logger);\n this._partnerId = options.partnerId;\n this._widgetId = options.widgetId;\n this._uiConfId = options.uiConfId;\n this._isAnonymous = !options.ks;\n this._ks = options.ks || '';\n this._playerVersion = playerVersion;\n }\n\n // eslint-disable-next-line no-unused-vars\n getMediaConfig(mediaInfo: MI): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'getMediaConfig method must be implement by the derived class'\n })\n );\n }\n\n // eslint-disable-next-line no-unused-vars\n getPlaylistConfig(playlistInfo: ProviderPlaylistInfoObject): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'The provider does not support loading playlist by id'\n })\n );\n }\n\n // eslint-disable-next-line no-unused-vars\n getEntryListConfig(entryListInfo: ProviderEntryListObject): Promise {\n return Promise.reject(\n new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.METHOD_NOT_IMPLEMENTED, {\n message: 'The provider does not support loading entry list'\n })\n );\n }\n\n _verifyHasSources(sources: ProviderMediaConfigSourcesObject) {\n if (sources.hls.concat(sources.dash, sources.progressive).length === 0) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.MISSING_PLAY_SOURCE, {\n action: '',\n messages: `No play source for entry id: ${sources.id}`\n });\n }\n }\n\n get LogLevel(): LogLevelType {\n return LogLevel;\n }\n\n getLogLevel(name?: string): Object {\n return getLogLevel(name);\n }\n\n setLogLevel(level: Object, name?: string): void {\n setLogLevel(level, name);\n }\n}\n","const clone = data => {\n let node;\n if (Array.isArray(data)) {\n node = data.length > 0 ? data.slice(0) : [];\n node.forEach((e, i) => {\n if ((typeof e === 'object' && e !== {}) || (Array.isArray(e) && e.length > 0)) {\n node[i] = clone(e);\n }\n });\n } else if (typeof data === 'object') {\n node = Object.assign({}, data);\n Object.keys(node).forEach(key => {\n if ((typeof node[key] === 'object' && node[key] !== {}) || (Array.isArray(node[key]) && node[key].length > 0)) {\n node[key] = clone(node[key]);\n }\n });\n } else {\n node = data;\n }\n return node;\n};\n\nexport {clone};\n","//@flow\n\nimport MediaEntry from '../entities/media-entry';\n\nexport default class EntryList {\n /**\n * @member - entry list items\n * @type {Array}\n */\n items: Array;\n\n constructor() {\n this.items = [];\n }\n}\n","//@flow\n\nexport default class Bumper {\n /**\n * @member - bumper url\n * @type {string}\n */\n url: string;\n /**\n * @member - bumper click through url\n * @type {string}\n */\n clickThroughUrl: string;\n\n /**\n * @constructor\n * @param {Object} data - The bumper response\n */\n constructor(data: Object) {\n this.url = data.url;\n this.clickThroughUrl = data.clickThroughUrl;\n }\n}\n","//@flow\nimport {clone} from '../../util/clone';\n\nconst defaultConfig: Object = {\n serviceUrl: 'https://cdnapisec.kaltura.com/api_v3',\n cdnUrl: 'https://cdnapisec.kaltura.com',\n serviceParams: {\n apiVersion: '3.3.0',\n format: 1\n },\n useApiCaptions: true\n};\n\nexport default class OVPConfiguration {\n static set(clientConfig?: ProviderEnvConfigObject) {\n if (clientConfig) {\n Object.assign(defaultConfig, clientConfig);\n }\n }\n\n static get(): Object {\n return clone(defaultConfig);\n }\n}\n\nexport {OVPConfiguration};\n","//@flow\nimport {KalturaDrmPlaybackPluginData} from '../../common/response-types/kaltura-drm-playback-plugin-data';\n\nexport type OVPKalturaPlaybackSource = KalturaPlaybackSource;\n\nexport class KalturaPlaybackSource {\n /**\n * @member - source format according to delivery profile streamer type (applehttp, mpegdash etc.)\n * @type {string}\n */\n format: string;\n /**\n * @member - delivery profile Id\n * @type {string}\n */\n deliveryProfileId: string;\n /**\n * @member - The source URL\n * @type {string}\n */\n url: string;\n /**\n * @member - comma separated string according to deliveryProfile media protocols ('http,https' etc.)\n * @type {string}\n */\n protocols: string;\n /**\n * @member - comma separated string of flavor ids\n * @type {string}\n */\n flavorIds: string;\n /**\n * @member - drm data object containing relevant license url ,scheme name and certificate\n * @type {Array}\n */\n drm: Array = [];\n\n /**\n * @constructor\n * @param {Object} source The response\n */\n constructor(source: Object) {\n this.format = source.format;\n this.deliveryProfileId = source.deliveryProfileId;\n this.url = source.url;\n this.protocols = source.protocols;\n this.flavorIds = source.flavorIds;\n if (source.drm) {\n source.drm.map(drm => this.drm.push(new KalturaDrmPlaybackPluginData(drm)));\n }\n }\n\n /**\n * Checks if source has DRM data\n * @function hasDrmData\n * @returns {boolean} Is source has DRM\n */\n hasDrmData(): boolean {\n return this.drm && this.drm.length > 0;\n }\n\n /**\n * Checks if source has flavor IDs\n * @function hasFlavorIds\n * @returns {boolean} Is source ha flavor IDs\n */\n hasFlavorIds(): boolean {\n return !!this.flavorIds && this.flavorIds.length > 0;\n }\n\n /**\n * Returns source desired protocol if supported\n * @param {string} protocol - the desired protocol for the source (base play url protocol)\n * @returns {string} - protocol if protocol is in the protocols list - if not empty string returned\n */\n getProtocol(protocol: string): string {\n let returnValue: string = '';\n if (this.protocols && this.protocols.length > 0) {\n let protocolsArr: Array = this.protocols.split(',');\n protocolsArr.forEach(p => {\n if (p === protocol) {\n returnValue = p;\n }\n });\n } else if (protocol === 'http') {\n return protocol;\n }\n return returnValue;\n }\n}\n","//@flow\nexport class KalturaRuleAction {\n static Type: {[type: string]: string | number} = {\n DRM_POLICY: 'drm.DRM_POLICY',\n BLOCK: 1,\n PREVIEW: 2,\n LIMIT_FLAVORS: 3,\n ADD_TO_STORAGE: 4,\n LIMIT_DELIVERY_PROFILES: 5,\n SERVE_FROM_REMOTE_SERVER: 6,\n REQUEST_HOST_REGEX: 7,\n LIMIT_THUMBNAIL_CAPTURE: 8\n };\n\n /**\n * @member - The type of the action\n * @type {string|number}\n */\n type: string | number;\n\n /**\n * @constructor\n * @param {Object} data - The response\n */\n constructor(data: Object) {\n this.type = data.type;\n }\n}\n","//@flow\nimport {KalturaRuleAction} from './kaltura-rule-action';\n\nexport class KalturaAccessControlModifyRequestHostRegexAction extends KalturaRuleAction {\n /**\n * @member - Request host regex pattern\n * @type {string}\n */\n pattern: string;\n /**\n * @member - Request host regex replacement\n * @type {string}\n */\n replacement: string;\n /**\n * @member - serverNodeId to generate replacment host from\n * @type {number}\n */\n replacmenServerNodeId: number;\n\n /**\n * @constructor\n * @param {Object} data - The response\n */\n constructor(data: Object) {\n super(data);\n this.pattern = data.pattern;\n this.replacement = data.replacement;\n this.replacmenServerNodeId = data.replacmenServerNodeId;\n }\n}\n","//@flow\nexport class KalturaFlavorAsset {\n static Status: {[status: string]: number} = {\n ERROR: -1,\n QUEUED: 0,\n CONVERTING: 1,\n READY: 2,\n DELETED: 3,\n NOT_APPLICABLE: 4,\n TEMP: 5,\n WAIT_FOR_CONVERT: 6,\n IMPORTING: 7,\n VALIDATING: 8,\n EXPORTING: 9\n };\n\n /**\n * @member - The ID of the Flavor Asset\n * @type {string}\n */\n id: string;\n /**\n * @member -The Flavor Params used to create this Flavor Asset\n * @type {string}\n */\n flavorParamsId: string;\n /**\n * @member -The file extension\n * @type {string}\n */\n fileExt: string;\n /**\n * @member - The overall bitrate (in KBits) of the Flavor Asset\n * @type {string}\n */\n bitrate: number;\n /**\n * @member - The width of the Flavor Asset\n * @type {number}\n */\n width: number;\n /**\n * @member - The height of the Flavor Asset\n * @type {number}\n */\n height: number;\n /**\n * @member - The frame rate (in FPS) of the Flavor Asset\n * @type {number}\n */\n frameRate: number;\n /**\n * @member - True if this Flavor Asset is the original source\n * @type {number}\n */\n isOriginal: boolean;\n /**\n * @member - True if this Flavor Asset is playable in KDP\n * @type {boolean}\n */\n isWeb: boolean;\n /**\n * @member - The container format\n * @type {boolean}\n */\n containerFormat: string;\n /**\n *@member - The video codec\n * @type {boolean}\n */\n videoCodecId: string;\n /**\n * @member - The status of the Flavor Asset\n * @type {number}\n */\n status: number;\n /**\n * @member - The language of the flavor asset\n * @type {Status}\n */\n language: string;\n /**\n * @member - The label of the flavor asset\n * @type {string}\n */\n label: string;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: any) {\n this.id = data.id;\n this.flavorParamsId = data.flavorParamsId;\n this.fileExt = data.fileExt;\n this.bitrate = data.bitrate;\n this.width = data.width;\n this.height = data.height;\n this.id = data.id;\n this.frameRate = data.frameRate;\n this.isOriginal = data.isOriginal;\n this.isWeb = data.isWeb;\n this.containerFormat = data.containerFormat;\n this.videoCodecId = data.videoCodecId;\n this.status = data.status;\n this.language = data.language;\n this.label = data.label;\n }\n}\n","//@flow\nimport {KalturaPlaybackSource} from './kaltura-playback-source';\n\nexport class KalturaBumper {\n /**\n * @member - The bumper entry ID\n * @type {string}\n */\n entryId: string;\n /**\n * @member - The bumper click through url\n * @type {string}\n */\n clickThroughUrl: string;\n /**\n * @member - The bumper sources\n * @type {Array}\n */\n sources: Array;\n\n constructor(data: any) {\n this.entryId = data.entryId;\n this.clickThroughUrl = data.url;\n this.sources = data.sources ? data.sources.map(source => new KalturaPlaybackSource(source)) : [];\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaAccessControlMessage} from '../../common/response-types/kaltura-access-control-message';\nimport {KalturaPlaybackSource} from './kaltura-playback-source';\nimport {KalturaAccessControlModifyRequestHostRegexAction} from './kaltura-access-control-modify-request-host-regex-action';\nimport {KalturaRuleAction} from './kaltura-rule-action';\nimport {KalturaFlavorAsset} from './kaltura-flavor-asset';\nimport {KalturaBumper} from './kaltura-bumper';\n\nexport class KalturaPlaybackContext extends ServiceResult {\n /**\n * @member - The playback sources\n * @type {Array}\n */\n sources: Array = [];\n /**\n * @member - Array of actions as received from the rules that invalidated\n * @type {Array}\n */\n actions: Array = [];\n /**\n * @member - Array of actions as received from the rules that invalidated\n * @type {Array}\n */\n messages: Array = [];\n /**\n * @member - The flavor assets\n * @type {Array}\n */\n flavorAssets: Array = [];\n /**\n * @member - The bumper data\n * @type {Array}\n */\n bumperData: Array = [];\n\n /**\n * @constructor\n * @param {Object} response The response\n */\n constructor(response: Object) {\n super(response);\n if (!this.hasError) {\n const messages = response.messages;\n if (messages) {\n messages.map(message => this.messages.push(new KalturaAccessControlMessage(message)));\n }\n const actions = response.actions;\n if (actions) {\n actions.map(action => {\n if (action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX) {\n this.actions.push(new KalturaAccessControlModifyRequestHostRegexAction(action));\n } else {\n this.actions.push(new KalturaRuleAction(action));\n }\n });\n }\n const sources = response.sources;\n if (sources) {\n sources.map(source => this.sources.push(new KalturaPlaybackSource(source)));\n }\n const flavorAssets = response.flavorAssets;\n if (flavorAssets) {\n flavorAssets.map(flavor => this.flavorAssets.push(new KalturaFlavorAsset(flavor)));\n }\n const bumperData = response.bumperData;\n if (bumperData) {\n bumperData.map(bumper => this.bumperData.push(new KalturaBumper(bumper)));\n }\n }\n }\n\n hasBlockAction(): boolean {\n return this.getBlockAction() !== undefined;\n }\n\n getBlockAction(): ?KalturaRuleAction {\n return this.actions.find(action => action.type === KalturaRuleAction.Type.BLOCK);\n }\n\n getErrorMessages(): Array {\n return this.messages;\n }\n\n /**\n * Get the KalturaAccessControlModifyRequestHostRegexAction action\n * @function getRequestHostRegexAction\n * @returns {?KalturaAccessControlModifyRequestHostRegexAction} The action\n * */\n getRequestHostRegexAction(): ?KalturaAccessControlModifyRequestHostRegexAction {\n const action = this.actions.find(action => action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX);\n if (action instanceof KalturaAccessControlModifyRequestHostRegexAction) {\n return action;\n }\n }\n}\n","//@flow\nexport class KalturaMetadata {\n static ObjectType: {[type: string]: string | number} = {\n AD_CUE_POINT: 'adCuePointMetadata.AdCuePoint',\n ANNOTATION: 'annotationMetadata.Annotation',\n CODE_CUE_POINT: 'codeCuePointMetadata.CodeCuePoint',\n THUMB_CUE_POINT: 'thumbCuePointMetadata.thumbCuePoint',\n ENTRY: 1,\n CATEGORY: 2,\n USER: 3,\n PARTNER: 4,\n DYNAMIC_OBJECT: 5\n };\n\n static Status: {[status: string]: number} = {\n VALID: 1,\n INVALID: 2,\n DELETED: 3\n };\n\n id: number;\n metadataProfileId: number;\n metadataProfileVersion: number;\n metadataObjectType: string | number;\n objectId: string;\n version: number;\n created: Date;\n updated: Date;\n status: number;\n xml: string;\n\n /**\n * @constructor\n * @param {Object} data The response\n */\n constructor(data: Object) {\n this.id = data.id;\n this.metadataProfileId = data.metadataProfileId;\n this.metadataProfileVersion = data.metadataProfileVersion;\n this.metadataProfileId = data.metadataProfileId;\n this.metadataObjectType = data.metadataObjectType;\n this.objectId = data.objectId;\n this.version = data.version;\n this.created = new Date(0);\n this.created.setUTCSeconds(data.createdAt);\n this.updated = new Date(0);\n this.updated.setUTCSeconds(data.updatedAt);\n this.status = data.status;\n this.xml = data.xml;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMetadata} from './kaltura-metadata';\n\nexport class KalturaMetadataListResponse extends ServiceResult {\n totalCount: number;\n metas: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.totalCount = responseObj.totalCount;\n if (this.totalCount > 0) {\n this.metas = [];\n responseObj.objects.map(meta => this.metas.push(new KalturaMetadata(meta)));\n }\n }\n }\n}\n","//@flow\nexport class KalturaMediaEntry {\n static EntryType: {[entryType: string]: {value: number | string}} = {\n AUTOMATIC: {value: -1},\n EXTERNAL_MEDIA: {value: 'externalMedia.externalMedia'},\n MEDIA_CLIP: {value: 1},\n MIX: {value: 2},\n PLAYLIST: {value: 5},\n DATA: {value: 6},\n LIVE_STREAM: {value: 7},\n LIVE_CHANNEL: {value: 8},\n DOCUMENT: {value: 10}\n };\n\n static MediaType: {[mediaType: string]: {value: number}} = {\n VIDEO: {value: 1},\n IMAGE: {value: 2},\n AUDIO: {value: 5},\n LIVE_STREAM_FLASH: {value: 201},\n LIVE_STREAM_WINDOWS_MEDIA: {value: 202},\n LIVE_STREAM_REAL_MEDIA: {value: 203},\n LIVE_STREAM_QUICK_TIME: {value: 204}\n };\n\n static EntryStatus: {[status: string]: string | number} = {\n ERROR_IMPORTING: -2,\n ERROR_CONVERTING: -1,\n SCAN_FAILURE: 'virusScan.ScanFailure',\n IMPORT: 0,\n INFECTED: 'virusScan.Infected',\n PRECONVERT: 1,\n READY: 2,\n DELETED: 3,\n PENDING: 4,\n MODERATE: 5,\n BLOCKED: 6,\n NO_CONTENT: 7\n };\n\n static EntryModerationStatus: {[status: string]: number} = {\n PENDING_MODERATION: 1,\n APPROVED: 2,\n REJECTED: 3,\n FLAGGED_FOR_REVIEW: 4,\n MODERATE: 5,\n AUTO_APPROVED: 6\n };\n\n /**\n * @member - The entry id\n * @type {string}\n */\n id: string;\n /**\n * @member - The entry referenceId\n * @type {string}\n */\n referenceId: string;\n /**\n * @member - The entry externalSourceType\n * @type {string}\n */\n externalSourceType: string;\n /**\n * @member - Entry name (Min 1 chars)\n * @type {string}\n */\n name: string;\n /**\n * @member - Entry description\n * @type {string}\n */\n description: string;\n /**\n * @member - The URL used for playback. This is not the download URL.\n * @type {string}\n */\n dataUrl: string;\n /**\n * @member - Comma separated flavor params ids that exists for this media entry\n * @type {string}\n */\n flavorParamsIds: string;\n /**\n * @member - The entry duration\n * @type {number}\n */\n duration: number;\n /**\n * @member - The type of the entry, this is auto filled by the derived entry object\n * @type {string | number}\n */\n type: string | number;\n /**\n * @member - The type of the entry, this is auto filled by the derived entry object (Image, Audio etc.)\n * @type {number}\n */\n entryType: number;\n /**\n * @member - Entry poster image\n * @type {string}\n */\n poster: string;\n /**\n * @member - DVR status\n * @type {number}\n */\n dvrStatus: number;\n /**\n * @member - Entry tags\n * @type {string}\n */\n tags: string;\n\n /**\n * @member - Entry status\n * @type {number}\n */\n status: number;\n\n /**\n * @constructor\n * @param {Object} entry The json response\n */\n constructor(entry: Object) {\n this.id = entry.id;\n this.referenceId = entry.referenceId;\n this.externalSourceType = entry.externalSourceType;\n this.name = entry.name;\n this.description = entry.description;\n this.dataUrl = entry.dataUrl;\n this.type = entry.type;\n this.entryType = entry.mediaType;\n this.flavorParamsIds = entry.flavorParamsIds;\n this.duration = entry.duration;\n this.poster = entry.thumbnailUrl;\n this.status = entry.status;\n this.dvrStatus = entry.dvrStatus;\n this.tags = entry.tags;\n }\n}\n","//@flow\nimport OVPConfiguration from './config';\n\ntype urlParamsType = {\n partnerId: number,\n entryId: string,\n ks: string,\n uiConfId: ?number,\n format: string,\n protocol: string,\n extension: string,\n flavorIds: ?string\n};\n\nexport default class PlaySourceUrlBuilder {\n /**\n * Returns source url by given url params\n * @function build\n * @param {urlParamsType} urlParams The params\n * @returns {string} The URL\n * @static\n */\n static build(urlParams: urlParamsType): string {\n const config = OVPConfiguration.get();\n const serviceUrlOrigin: string = config.serviceUrl.substr(0, config.serviceUrl.lastIndexOf('/'));\n const {partnerId, entryId, ks, uiConfId, format, protocol, extension, flavorIds} = urlParams;\n\n //verify mandatory params\n if (!serviceUrlOrigin || !partnerId || !entryId || !format || !protocol) {\n return '';\n }\n\n let playUrl = serviceUrlOrigin;\n if (!serviceUrlOrigin.endsWith('/')) {\n playUrl += '/';\n }\n playUrl += 'p/' + partnerId + '/sp/' + partnerId + '00' + '/playManifest/entryId/' + entryId + '/protocol/' + protocol + '/format/' + format;\n\n if (flavorIds) {\n playUrl += '/flavorIds/' + flavorIds;\n } else if (uiConfId) {\n playUrl += '/uiConfId/' + uiConfId;\n }\n\n if (ks !== '') {\n playUrl += '/ks/' + ks;\n }\n\n if (extension !== '') {\n playUrl += '/a.' + extension;\n }\n\n if (uiConfId && flavorIds !== '') {\n playUrl += '?uiConfId=' + uiConfId;\n }\n\n return playUrl;\n }\n}\n","//@flow\nexport default class XmlParser {\n /**\n * Parses xml string to json object\n * @param {string} xml The xml to parse\n * @returns {{}} The parsed xml as Json object\n * @static\n */\n static xmlToJson(xml: Object) {\n let obj = {};\n if (xml.nodeType === 1) {\n if (xml.attributes.length > 0) {\n obj['@attributes'] = {};\n for (let j = 0; j < xml.attributes.length; j++) {\n let attribute = xml.attributes.item(j);\n obj['@attributes'][attribute.nodeName] = attribute.nodeValue;\n }\n }\n } else if (xml.nodeType === 3) {\n obj = xml.nodeValue;\n }\n if (xml.hasChildNodes()) {\n for (let i = 0; i < xml.childNodes.length; i++) {\n let item = xml.childNodes.item(i);\n let nodeName = item.nodeName;\n if (typeof obj[nodeName] === 'undefined') {\n obj[nodeName] = this.xmlToJson(item);\n } else {\n if (typeof obj[nodeName].push === 'undefined') {\n let old = obj[nodeName];\n obj[nodeName] = [];\n obj[nodeName].push(old);\n }\n obj[nodeName].push(this.xmlToJson(item));\n }\n }\n }\n return obj;\n }\n}\n","//@flow\n\nimport MediaEntry from '../entities/media-entry';\n\nexport default class Playlist {\n /**\n * @member - playlist id\n * @type {string}\n */\n id: string;\n /**\n * @member - playlist name\n * @type {string}\n */\n name: string;\n /**\n * @member - playlist description\n * @type {string}\n */\n description: string;\n\n /**\n * @member - playlist poster\n * @type {string}\n */\n poster: string;\n\n /**\n * @member - playlist items\n * @type {Array}\n */\n items: Array;\n\n constructor() {\n this.items = [];\n }\n}\n","// @flow\n\nimport {addKsToUrl} from './provider-parser';\n\nconst KalturaCaptionType: CaptionType = {\n SRT: '1',\n DFXP: '2',\n WEBVTT: '3',\n CAP: '4'\n};\n\nconst CaptionsFormatsMap: {[format: string]: string} = {\n '3': 'vtt',\n '1': 'srt'\n};\n\nclass ExternalCaptionsBuilder {\n static createConfig(captions: Array, ks: string): Array {\n return captions.map(caption => {\n let url = caption.url;\n let type = CaptionsFormatsMap[caption.format];\n if ([KalturaCaptionType.DFXP, KalturaCaptionType.CAP].includes(caption.format)) {\n url = caption.webVttUrl;\n type = CaptionsFormatsMap[KalturaCaptionType.WEBVTT];\n }\n url = addKsToUrl(url, ks);\n return {\n default: !!caption.isDefault,\n type: type,\n language: caption.languageCode,\n label: caption.label,\n url: url\n };\n });\n }\n}\n\nexport {ExternalCaptionsBuilder};\n","//@flow\nimport {KalturaPlaybackContext} from './response-types/kaltura-playback-context';\nimport {KalturaMetadataListResponse} from './response-types/kaltura-metadata-list-response';\nimport {KalturaMediaEntry} from './response-types/kaltura-media-entry';\nimport {KalturaPlaybackSource} from './response-types/kaltura-playback-source';\nimport {KalturaBumper} from './response-types/kaltura-bumper';\nimport {KalturaDrmPlaybackPluginData} from '../common/response-types/kaltura-drm-playback-plugin-data';\nimport PlaySourceUrlBuilder from './play-source-url-builder';\nimport XmlParser from '../../util/xml-parser';\nimport getLogger from '../../util/logger';\nimport OVPConfiguration from './config';\nimport MediaEntry from '../../entities/media-entry';\nimport Drm from '../../entities/drm';\nimport MediaSource from '../../entities/media-source';\nimport MediaSources from '../../entities/media-sources';\nimport {SupportedStreamFormat, isProgressiveSource} from '../../entities/media-format';\nimport Playlist from '../../entities/playlist';\nimport EntryList from '../../entities/entry-list';\nimport Bumper from '../../entities/bumper';\nimport {KalturaRuleAction} from './response-types/kaltura-rule-action';\nimport {KalturaAccessControlMessage} from '../common/response-types/kaltura-access-control-message';\nimport type {OVPMediaEntryLoaderResponse} from './loaders/media-entry-loader';\nimport {ExternalCaptionsBuilder} from './external-captions-builder';\n\nclass OVPProviderParser {\n static _logger = getLogger('OVPProviderParser');\n\n /**\n * Returns parsed media entry by given OVP response objects\n * @function getMediaEntry\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {any} mediaEntryResponse - The media entry response\n * @returns {MediaEntry} - The media entry\n * @static\n * @public\n */\n static getMediaEntry(ks: string, partnerId: number, uiConfId: ?number, mediaEntryResponse: any): MediaEntry {\n const mediaEntry = new MediaEntry();\n const entry = mediaEntryResponse.entry;\n const playbackContext = mediaEntryResponse.playBackContextResult;\n const metadataList = mediaEntryResponse.metadataListResult;\n const kalturaSources = playbackContext.sources;\n\n mediaEntry.sources = OVPProviderParser._getParsedSources(kalturaSources, ks, partnerId, uiConfId, entry, playbackContext);\n if (OVPConfiguration.get().useApiCaptions && playbackContext.data.playbackCaptions) {\n mediaEntry.sources.captions = ExternalCaptionsBuilder.createConfig(playbackContext.data.playbackCaptions, ks);\n }\n OVPProviderParser._fillBaseData(mediaEntry, entry, metadataList);\n return mediaEntry;\n }\n\n /**\n * Returns the url with KS\n * @function addKsToUrl\n * @param {String} url - The url to add the KS\n * @param {string} ks - The ks\n * @returns {string} - The url with KS\n * @static\n * @public\n */\n static addKsToUrl(url: string, ks: string): string {\n const hasUrlExtension = path => {\n const pathWithoutQuery = path.split('?')[0];\n const pathAfterLastSlash = pathWithoutQuery.replace(/^.*[\\\\/]/, '');\n return pathAfterLastSlash.indexOf('.') !== -1;\n };\n let ksParam;\n if (ks) {\n if (hasUrlExtension(url)) {\n ksParam = url.indexOf('?') === -1 ? '?ks=' : '&ks=';\n } else {\n ksParam = '/ks/';\n }\n return url + ksParam + ks;\n }\n return url;\n }\n\n /**\n * Returns parsed playlist by given OVP response objects\n * @function getPlaylist\n * @param {any} playlistResponse - The playlist response\n * @returns {Playlist} - The playlist\n * @static\n * @public\n */\n static getPlaylist(playlistResponse: any): Playlist {\n const playlist = new Playlist();\n const playlistData = playlistResponse.playlistData;\n const playlistItems = playlistResponse.playlistItems.entries;\n playlist.id = playlistData.id;\n playlist.name = playlistData.name;\n playlist.description = playlistData.description;\n playlist.poster = playlistData.poster;\n playlistItems.forEach((entry: KalturaMediaEntry) => {\n const mediaEntry = new MediaEntry();\n OVPProviderParser._fillBaseData(mediaEntry, entry);\n playlist.items.push(mediaEntry);\n });\n return playlist;\n }\n\n /**\n * Returns parsed entry list by given OVP response objects\n * @function getEntryList\n * @param {any} playlistResponse - response\n * @returns {Playlist} - The entry list\n * @static\n * @public\n */\n static getEntryList(playlistResponse: any): EntryList {\n const entryList = new EntryList();\n const playlistItems = playlistResponse.playlistItems.entries;\n playlistItems.forEach(entry => {\n const mediaEntry = new MediaEntry();\n OVPProviderParser._fillBaseData(mediaEntry, entry);\n entryList.items.push(mediaEntry);\n });\n return entryList;\n }\n\n /**\n * Returns parsed bumper by given OTT response objects.\n * @function getBumper\n * @param {any} assetResponse - The asset response.\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @returns {?Bumper} - The bumper\n * @static\n * @public\n */\n static getBumper(assetResponse: any, ks: string, partnerId: number): ?Bumper {\n const playbackContext = assetResponse.playBackContextResult;\n const bumperData: KalturaBumper = playbackContext.bumperData[0];\n if (bumperData) {\n const bumperSources = bumperData && bumperData.sources;\n const progressiveBumper = bumperSources.find(bumper => isProgressiveSource(bumper.format));\n if (progressiveBumper) {\n const parsedSources = OVPProviderParser._parseProgressiveSources(progressiveBumper, playbackContext, ks, partnerId, 0, bumperData.entryId);\n if (parsedSources[0]) {\n return new Bumper({url: parsedSources[0].url, clickThroughUrl: bumperData.clickThroughUrl});\n }\n }\n }\n }\n\n static _fillBaseData(mediaEntry: MediaEntry, entry: KalturaMediaEntry, metadataList: ?KalturaMetadataListResponse) {\n mediaEntry.poster = entry.poster;\n mediaEntry.id = entry.id;\n mediaEntry.duration = entry.duration;\n mediaEntry.metadata = OVPProviderParser._parseMetadata(metadataList);\n mediaEntry.metadata.description = entry.description || '';\n mediaEntry.metadata.name = entry.name || '';\n mediaEntry.metadata.tags = entry.tags || '';\n mediaEntry.status = entry.status;\n\n mediaEntry.type = OVPProviderParser._getEntryType(entry.entryType, entry.type);\n if (mediaEntry.type === MediaEntry.Type.LIVE) {\n mediaEntry.dvrStatus = entry.dvrStatus;\n }\n\n return mediaEntry;\n }\n\n static _getEntryType(entryTypeEnum: number, typeEnum: number | string): string {\n let type = MediaEntry.Type.UNKNOWN;\n switch (entryTypeEnum) {\n case KalturaMediaEntry.MediaType.IMAGE.value:\n type = MediaEntry.Type.IMAGE;\n break;\n case KalturaMediaEntry.MediaType.AUDIO.value:\n type = MediaEntry.Type.AUDIO;\n break;\n default:\n switch (typeEnum) {\n case KalturaMediaEntry.EntryType.MEDIA_CLIP.value:\n type = MediaEntry.Type.VOD;\n break;\n case KalturaMediaEntry.EntryType.LIVE_STREAM.value:\n case KalturaMediaEntry.EntryType.LIVE_CHANNEL.value:\n type = MediaEntry.Type.LIVE;\n break;\n default:\n type = MediaEntry.Type.UNKNOWN;\n }\n }\n return type;\n }\n\n /**\n * Returns the parsed sources\n * @function _getParsedSources\n * @param {Array} kalturaSources - The kaltura sources\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {Object} entry - The entry\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @return {MediaSources} - A media sources\n * @static\n * @private\n */\n static _getParsedSources(\n kalturaSources: Array,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entry: Object,\n playbackContext: KalturaPlaybackContext\n ): MediaSources {\n const sources = new MediaSources();\n const addAdaptiveSource = (source: KalturaPlaybackSource) => {\n const parsedSource = OVPProviderParser._parseAdaptiveSource(source, playbackContext, ks, partnerId, uiConfId, entry.id);\n if (parsedSource) {\n const sourceFormat = SupportedStreamFormat.get(source.format);\n sources.map(parsedSource, sourceFormat);\n }\n };\n const parseAdaptiveSources = () => {\n kalturaSources.filter(source => !isProgressiveSource(source.format)).forEach(addAdaptiveSource);\n };\n const parseProgressiveSources = () => {\n const progressiveSource = kalturaSources.find(source => {\n //match progressive source with supported protocol(http/s)\n return isProgressiveSource(source.format) && source.getProtocol(OVPProviderParser._getBaseProtocol()) !== '';\n });\n sources.progressive = OVPProviderParser._parseProgressiveSources(progressiveSource, playbackContext, ks, partnerId, uiConfId, entry.id);\n };\n\n const parseExternalMedia = () => {\n const mediaSource = new MediaSource();\n mediaSource.mimetype = 'video/youtube';\n mediaSource.url = entry.referenceId;\n mediaSource.id = entry.id + '_youtube';\n sources.progressive.push(mediaSource);\n };\n\n if (entry.type === KalturaMediaEntry.EntryType.EXTERNAL_MEDIA.value) {\n parseExternalMedia();\n } else if (kalturaSources && kalturaSources.length > 0) {\n parseAdaptiveSources();\n parseProgressiveSources();\n }\n return sources;\n }\n\n /**\n * Returns a parsed adaptive source\n * @function _parseAdaptiveSource\n * @param {KalturaPlaybackSource} kalturaSource - A kaltura source\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {string} entryId - The entry id\n * @returns {?MediaSource} - The parsed adaptive kalturaSource\n * @static\n * @private\n */\n static _parseAdaptiveSource(\n kalturaSource: ?KalturaPlaybackSource,\n playbackContext: KalturaPlaybackContext,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entryId: string\n ): ?MediaSource {\n const mediaSource: MediaSource = new MediaSource();\n if (kalturaSource) {\n let playUrl: string = '';\n const mediaFormat = SupportedStreamFormat.get(kalturaSource.format);\n const protocol = kalturaSource.getProtocol(OVPProviderParser._getBaseProtocol());\n const deliveryProfileId = kalturaSource.deliveryProfileId;\n const format = kalturaSource.format;\n let extension: string = '';\n if (mediaFormat) {\n extension = mediaFormat.pathExt;\n mediaSource.mimetype = mediaFormat.mimeType;\n }\n // in case playbackSource doesn't have flavors we don't need to build the url and we'll use the provided one.\n if (kalturaSource.hasFlavorIds()) {\n if (!extension && playbackContext.flavorAssets && playbackContext.flavorAssets.length > 0) {\n extension = playbackContext.flavorAssets[0].fileExt;\n }\n playUrl = PlaySourceUrlBuilder.build({\n entryId,\n flavorIds: kalturaSource.flavorIds,\n format,\n ks,\n partnerId,\n uiConfId,\n extension,\n protocol\n });\n } else {\n playUrl = OVPProviderParser.addKsToUrl(kalturaSource.url, ks);\n }\n if (!playUrl) {\n const message = `failed to create play url from source, discarding source: (${entryId}_${deliveryProfileId}), ${format}`;\n OVPProviderParser._logger.warn(message);\n return null;\n }\n mediaSource.url = OVPProviderParser._applyRegexAction(playbackContext, playUrl);\n mediaSource.id = entryId + '_' + deliveryProfileId + ',' + format;\n if (kalturaSource.hasDrmData()) {\n const drmParams: Array = [];\n kalturaSource.drm.forEach(drm => {\n drmParams.push(new Drm(drm.licenseURL, KalturaDrmPlaybackPluginData.Scheme[drm.scheme], drm.certificate));\n });\n mediaSource.drmData = drmParams;\n }\n }\n return mediaSource;\n }\n\n /**\n * Returns parsed progressive sources\n * @function _parseProgressiveSources\n * @param {KalturaPlaybackSource} kalturaSource - A kaltura source\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} ks - The ks\n * @param {number} partnerId - The partner ID\n * @param {number} uiConfId - The uiConf ID\n * @param {string} entryId - The entry id\n * @returns {Array} - The parsed progressive kalturaSources\n * @static\n * @private\n */\n static _parseProgressiveSources(\n kalturaSource: ?KalturaPlaybackSource,\n playbackContext: KalturaPlaybackContext,\n ks: string,\n partnerId: number,\n uiConfId: ?number,\n entryId: string\n ): Array {\n const videoSources: Array = [];\n const audioSources: Array = [];\n if (kalturaSource) {\n const protocol = kalturaSource.getProtocol(OVPProviderParser._getBaseProtocol());\n const format = kalturaSource.format;\n const deliveryProfileId = kalturaSource.deliveryProfileId;\n const sourceId = deliveryProfileId + ',' + format;\n playbackContext.flavorAssets.map(flavor => {\n const mediaSource: MediaSource = new MediaSource();\n mediaSource.id = flavor.id + sourceId;\n mediaSource.mimetype = flavor.fileExt === 'mp3' ? 'audio/mp3' : 'video/mp4';\n mediaSource.height = flavor.height;\n mediaSource.width = flavor.width;\n mediaSource.bandwidth = flavor.bitrate * 1024;\n mediaSource.label = flavor.label || flavor.language;\n const playUrl = PlaySourceUrlBuilder.build({\n entryId,\n flavorIds: flavor.id,\n format,\n ks,\n partnerId: partnerId,\n uiConfId: uiConfId,\n extension: flavor.fileExt,\n protocol\n });\n if (playUrl === '') {\n OVPProviderParser._logger.warn(`failed to create play url from source, discarding source: (${entryId}_${deliveryProfileId}), ${format}.`);\n return null;\n } else {\n mediaSource.url = OVPProviderParser._applyRegexAction(playbackContext, playUrl);\n if (flavor.height && flavor.width) {\n videoSources.push(mediaSource);\n } else {\n audioSources.push(mediaSource);\n }\n }\n });\n }\n //If we have only audio flavors return them, otherwise return video flavors\n return audioSources.length && !videoSources.length ? audioSources : videoSources;\n }\n\n /**\n * Ovp metadata parser\n * @function _parseMetaData\n * @param {KalturaMetadataListResponse} metadataList The metadata list\n * @returns {Object} Parsed metadata\n * @static\n * @private\n */\n static _parseMetadata(metadataList: ?KalturaMetadataListResponse): Object {\n const metadata = {};\n if (metadataList && metadataList.metas && metadataList.metas.length > 0) {\n metadataList.metas.forEach(meta => {\n if (meta.xml) {\n let metaXml: Object;\n const domParser: DOMParser = new DOMParser();\n meta.xml = meta.xml.replace(/\\r?\\n|\\r/g, '');\n meta.xml = meta.xml.replace(/>\\s*/g, '>');\n meta.xml = meta.xml.replace(/>\\s*/g, '>');\n metaXml = domParser.parseFromString(meta.xml, 'text/xml');\n const metasObj: Object = XmlParser.xmlToJson(metaXml);\n const metaKeys = Object.keys(metasObj.metadata);\n metaKeys.forEach(key => {\n metadata[key] = metasObj.metadata[key]['#text'];\n });\n }\n });\n }\n return metadata;\n }\n\n /**\n * Returns the base protocol\n * @function _getBaseProtocol\n * @returns {string} - The base protocol\n * @static\n * @private\n */\n static _getBaseProtocol(): string {\n const config = OVPConfiguration.get();\n const protocolRegex = /^https?:/;\n const result = protocolRegex.exec(config.cdnUrl);\n const protocol = result ? result[0] : document.location.protocol;\n if (typeof protocol === 'string') {\n return protocol.slice(0, -1); // remove ':' from the end\n }\n return 'https';\n }\n\n static hasBlockAction(response: OVPMediaEntryLoaderResponse): boolean {\n return response.playBackContextResult.hasBlockAction();\n }\n\n static getBlockAction(response: OVPMediaEntryLoaderResponse): ?KalturaRuleAction {\n return response.playBackContextResult.getBlockAction();\n }\n\n static getErrorMessages(response: OVPMediaEntryLoaderResponse): Array {\n return response.playBackContextResult.getErrorMessages();\n }\n\n /**\n * Applies the request host regex on the url\n * @function _applyRegexAction\n * @param {KalturaPlaybackContext} playbackContext - The playback context\n * @param {string} playUrl - The original url\n * @returns {string} - The request host regex applied url\n * @static\n * @private\n */\n static _applyRegexAction(playbackContext: KalturaPlaybackContext, playUrl: string): string {\n const regexAction = playbackContext.getRequestHostRegexAction();\n if (regexAction) {\n const regex = new RegExp(regexAction.pattern, 'i');\n if (playUrl.match(regex)) {\n return playUrl.replace(regex, regexAction.replacement + '/');\n }\n }\n return playUrl;\n }\n}\n\nexport const addKsToUrl = OVPProviderParser.addKsToUrl;\nexport default OVPProviderParser;\n","//@flow\nimport MultiRequestBuilder from '../../common/multi-request-builder';\nimport OVPConfiguration from '../config';\n\nconst SERVICE_NAME: string = 'multirequest';\n\nexport default class OVPService {\n /**\n * Gets a new instance of MultiRequestBuilder with ovp params\n * @function getMultiRequest\n * @param {string} playerVersion The player version\n * @param {string} ks The ks\n * @param {string} partnerId The partner ID\n * @returns {MultiRequestBuilder} The multi request builder\n * @static\n */\n static getMultiRequest(playerVersion: string, ks: string, partnerId?: number): MultiRequestBuilder {\n const config = OVPConfiguration.get();\n const ovpParams = config.serviceParams;\n Object.assign(ovpParams, {ks: ks, clientTag: 'html5:v' + playerVersion});\n if (partnerId) {\n Object.assign(ovpParams, {partnerId: partnerId});\n }\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const multiReq = new MultiRequestBuilder(headers);\n multiReq.method = 'POST';\n multiReq.service = SERVICE_NAME;\n multiReq.url = multiReq.getUrl(config.serviceUrl);\n multiReq.params = ovpParams;\n return multiReq;\n }\n}\n","//@flow\nconst FIELDS =\n 'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status';\nconst RESPONSE_PROFILE_TYPE = {\n INCLUDE_FIELDS: 1,\n EXCLUDE_FIELDS: 2\n};\nexport class BaseEntryResponseProfile {\n static Type: {[type: string]: number} = RESPONSE_PROFILE_TYPE;\n /**\n * @member - the response profile type\n * @type {number}\n */\n type: number;\n /**\n * @member - Comma separated fields list to be included or excluded\n * @type {string}\n */\n fields: string;\n\n /**\n * @constructor\n * @param {Object} responseProfile -\n */\n constructor(responseProfile: Object = {}) {\n this.type = responseProfile.type || BaseEntryResponseProfile.Type.INCLUDE_FIELDS;\n this.fields = responseProfile.fields || FIELDS;\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\nimport {BaseEntryResponseProfile} from '../request-params/base-entry-response-profile';\n\nconst SERVICE_NAME: string = 'baseEntry';\n\nexport default class OVPBaseEntryService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for baseentry.getPlaybackContext\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {serviceEntryId} serviceEntryId The entry id from the request result (to support loading by referenceId)\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static getPlaybackContext(serviceUrl: string, ks: string, serviceEntryId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'getPlaybackContext';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'baseEntry-getPlaybackContext';\n const contextDataParams = {objectType: 'KalturaContextDataParams', flavorTags: 'all'};\n request.params = {entryId: serviceEntryId, ks: ks, contextDataParams: contextDataParams};\n return request;\n }\n\n /**\n * Creates an instance of RequestBuilder for baseentry.list\n * @function list\n * @param {string} serviceUrl The base URL\n * @param {string} ks The ks\n * @param {string} entryId The entry ID\n * @param {boolean} redirectFromEntryId whether the live entry should continue and play the VOD one after the live stream ends.\n * @param {string} referenceId a Reference id instead of an entry id\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static list(serviceUrl: string, ks: string, entryId: string, redirectFromEntryId: boolean, referenceId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'list';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'list';\n request.params = OVPBaseEntryService.getEntryListReqParams(entryId, ks, redirectFromEntryId, referenceId);\n return request;\n }\n\n /**\n * Gets baseentry.list service params\n * @function getEntryListReqParams\n * @param {string} entryId The entry ID\n * @param {string} ks The ks\n * @param {boolean} redirectFromEntryId whether the live entry should continue and play the VOD one after the live stream ends.\n * @param {string} referenceId a Reference id instead of an entry id\n * @returns {{ks: string, filter: {redirectFromEntryId: string}, responseProfile: {fields: string, type: number}}} The service params object\n * @static\n */\n static getEntryListReqParams(entryId: string, ks: string, redirectFromEntryId: boolean, referenceId: string): any {\n let filterParams = {};\n if (entryId) {\n filterParams = redirectFromEntryId ? {redirectFromEntryId: entryId} : {idEqual: entryId};\n } else if (referenceId) {\n filterParams = {objectType: 'KalturaBaseEntryFilter', referenceIdEqual: referenceId};\n }\n\n return {ks: ks, filter: filterParams, responseProfile: new BaseEntryResponseProfile()};\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\n\nconst SERVICE_NAME: string = 'metadata_metadata';\n\nexport default class OVPMetadataService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for metadata_metadata.list\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {string} entryId The entry ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static list(serviceUrl: string, ks: string, entryId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'list';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'metadata_metadata-list';\n const filter = {objectType: 'KalturaMetadataFilter', objectIdEqual: entryId, metadataObjectTypeEqual: '1'};\n request.params = {filter: filter, ks: ks};\n return request;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMediaEntry} from './kaltura-media-entry';\n\nexport class KalturaBaseEntryListResponse extends ServiceResult {\n /**\n * @member - The total count\n * @type {number}\n */\n totalCount: number;\n /**\n * @member - The entries\n * @type {Array}\n */\n entries: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The json response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.totalCount = responseObj.totalCount;\n if (this.totalCount > 0) {\n this.entries = [];\n responseObj.objects.map(entry => this.entries.push(new KalturaMediaEntry(entry)));\n }\n }\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPBaseEntryService from '../services/base-entry-service';\nimport OVPMetadataService from '../services/meta-data-service';\nimport OVPConfiguration from '../config';\nimport {KalturaPlaybackContext} from '../response-types/kaltura-playback-context';\nimport {KalturaMetadataListResponse} from '../response-types/kaltura-metadata-list-response';\nimport {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';\nimport {KalturaMediaEntry} from '../response-types/kaltura-media-entry';\n\ntype OVPMediaEntryLoaderResponse = {\n entry: KalturaMediaEntry,\n playBackContextResult: KalturaPlaybackContext,\n metadataListResult: KalturaMetadataListResponse\n};\nexport type {OVPMediaEntryLoaderResponse};\n\nexport default class OVPMediaEntryLoader implements ILoader {\n _entryId: string;\n _referenceId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'media';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n * @boolean {boolean} useExternalCaptions - if we should add captions request to the multirequests.\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._entryId = params.entryId;\n this._referenceId = params.referenceId;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n let mediaEntryResponse: KalturaBaseEntryListResponse = new KalturaBaseEntryListResponse(response[0].data);\n this._response.entry = mediaEntryResponse.entries[0];\n this._response.playBackContextResult = new KalturaPlaybackContext(response[1].data);\n this._response.metadataListResult = new KalturaMetadataListResponse(response[2].data);\n }\n\n get response(): OVPMediaEntryLoaderResponse {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, params.entryId, params.redirectFromEntryId, params.referenceId));\n // Use the entry id from the request result to support loading by referenceId\n const serviceEntryId = params.ks === '{1:result:ks}' ? '{2:result:objects:0:id}' : '{1:result:objects:0:id}';\n requests.push(OVPBaseEntryService.getPlaybackContext(config.serviceUrl, params.ks, serviceEntryId));\n requests.push(OVPMetadataService.list(config.serviceUrl, params.ks, serviceEntryId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!(this._entryId || this._referenceId);\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\n\nconst SERVICE_NAME: string = 'session';\n\nexport default class OVPSessionService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for session.startWidgetSession\n * @function anonymousSession\n * @param {string} serviceUrl The service base URL\n * @param {string} widgetId The widget ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static anonymousSession(serviceUrl: string, widgetId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'startWidgetSession';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = 'session-startWidget';\n request.params = {widgetId};\n return request;\n }\n}\n","//@flow\nimport OVPSessionService from '../services/session-service';\nimport OVPConfiguration from '../config';\nimport RequestBuilder from '../../../util/request-builder';\n\nexport default class OVPSessionLoader implements ILoader {\n _widgetId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'session';\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n this._response.ks = response[0].data.ks;\n }\n\n get response(): any {\n return this._response.ks;\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._widgetId = params.widgetId;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPSessionService.anonymousSession(config.serviceUrl, params.widgetId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!this._widgetId;\n }\n}\n","// @flow\nimport DataLoaderManager from '../../common/data-loader-manager';\nimport OVPService from '../services/ovp-service';\n\n/**\n * OTTDataLoaderManager is a class that handles the OVP data loading\n * @param {string} playerVersion - player version\n * @param {string} partnerId - partner id\n * @param {string} ks - ks\n * @param {ProviderNetworkRetryParameters} [networkRetryConfig] - network retry configuration\n */\nexport default class OVPDataLoaderManager extends DataLoaderManager {\n constructor(playerVersion: string, partnerId: number, ks: string = '', networkRetryConfig: ProviderNetworkRetryParameters) {\n super(networkRetryConfig);\n this._multiRequest = OVPService.getMultiRequest(playerVersion, ks, partnerId);\n }\n}\n","//@flow\nimport OVPService from './ovp-service';\nimport RequestBuilder from '../../../util/request-builder';\nimport {BaseEntryResponseProfile} from '../request-params/base-entry-response-profile';\n\nconst SERVICE_NAME: string = 'playlist';\n\nexport default class OVPPlaylistService extends OVPService {\n /**\n * Creates an instance of RequestBuilder for playlist.getPlaybackContext\n * @function getPlaybackContext\n * @param {string} serviceUrl The service base URL\n * @param {string} ks The ks\n * @param {string} playlistId The playlist ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static execute(serviceUrl: string, ks: string, playlistId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'execute';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = `${SERVICE_NAME}-execute`;\n request.params = {\n ks: ks,\n id: playlistId,\n responseProfile: new BaseEntryResponseProfile()\n };\n return request;\n }\n\n /**\n * Creates an instance of RequestBuilder for playlist.list\n * @function list\n * @param {string} serviceUrl The base URL\n * @param {string} ks The ks\n * @param {string} playlistId The playlist ID\n * @returns {RequestBuilder} The request builder\n * @static\n */\n static get(serviceUrl: string, ks: string, playlistId: string): RequestBuilder {\n const headers: Map = new Map();\n headers.set('Content-Type', 'application/json');\n const request = new RequestBuilder(headers);\n request.service = SERVICE_NAME;\n request.action = 'get';\n request.method = 'POST';\n request.url = request.getUrl(serviceUrl);\n request.tag = `${SERVICE_NAME}-get`;\n request.params = {\n ks: ks,\n id: playlistId,\n responseProfile: {\n fields: 'id,name,description,thumbnailUrl',\n type: 1\n }\n };\n return request;\n }\n}\n","//@flow\n\nexport class KalturaPlaylist {\n /**\n * @member - playlist id\n * @type {string}\n */\n id: string;\n /**\n * @member - playlist name\n * @type {string}\n */\n name: string;\n /**\n * @member - playlist description\n * @type {string}\n */\n description: string;\n /**\n * @member - playlist poster image\n * @type {string}\n */\n poster: string;\n\n /**\n * @constructor\n * @param {Object} playlist - The json response\n */\n constructor(playlist: Object) {\n this.id = playlist.id;\n this.name = playlist.name;\n this.description = playlist.description;\n this.poster = playlist.thumbnailUrl;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\nimport {KalturaMediaEntry} from './kaltura-media-entry';\n\nexport class KalturaMediaEntries extends ServiceResult {\n /**\n * @member - The entries\n * @type {Array}\n */\n entries: Array;\n\n /**\n * @constructor\n * @param {Object} responseObj The json response\n */\n constructor(responseObj: Object) {\n super(responseObj);\n if (!this.hasError) {\n this.entries = [];\n responseObj.map(entry => this.entries.push(new KalturaMediaEntry(entry)));\n }\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPPlaylistService from '../services/playlist-service';\nimport OVPConfiguration from '../config';\nimport {KalturaPlaylist} from '../response-types/kaltura-playlist';\nimport {KalturaMediaEntries} from '../response-types/kaltura-media-entries';\n\nexport default class OVPPlaylistLoader implements ILoader {\n _playlistId: string;\n _requests: Array;\n _response: any = {};\n\n static get id(): string {\n return 'playlist';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._playlistId = params.playlistId;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n this._response.playlistData = new KalturaPlaylist(response[0].data);\n this._response.playlistItems = new KalturaMediaEntries(response[1].data);\n }\n\n get response(): any {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n requests.push(OVPPlaylistService.get(config.serviceUrl, params.ks, params.playlistId));\n requests.push(OVPPlaylistService.execute(config.serviceUrl, params.ks, params.playlistId));\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!this._playlistId;\n }\n}\n","//@flow\nimport RequestBuilder from '../../../util/request-builder';\nimport OVPConfiguration from '../config';\nimport OVPBaseEntryService from '../services/base-entry-service';\nimport {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';\n\nexport default class OVPEntryListLoader implements ILoader {\n _entries: Array;\n _requests: Array;\n _response: any = {playlistItems: {entries: []}};\n\n static get id(): string {\n return 'entry_list';\n }\n\n /**\n * @constructor\n * @param {Object} params loader params\n */\n constructor(params: Object) {\n this.requests = this.buildRequests(params);\n this._entries = params.entries;\n }\n\n set requests(requests: Array) {\n this._requests = requests;\n }\n\n get requests(): Array {\n return this._requests;\n }\n\n set response(response: any) {\n let mediaEntryResponse: KalturaBaseEntryListResponse;\n response.forEach(item => {\n mediaEntryResponse = new KalturaBaseEntryListResponse(item.data);\n this._response.playlistItems.entries.push(mediaEntryResponse.entries[0]);\n });\n }\n\n get response(): any {\n return this._response;\n }\n\n /**\n * Builds loader requests\n * @function\n * @param {Object} params Requests parameters\n * @returns {RequestBuilder} The request builder\n * @static\n */\n buildRequests(params: Object): Array {\n const config = OVPConfiguration.get();\n const requests: Array = [];\n params.entries.forEach(entry => {\n requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, entry.entryId || entry, params.redirectFromEntryId, entry.referenceId));\n });\n return requests;\n }\n\n /**\n * Loader validation function\n * @function\n * @returns {boolean} Is valid\n */\n isValid(): boolean {\n return !!(this._entries && this._entries.length);\n }\n}\n","//@flow\nimport getLogger from '../../util/logger';\nimport OVPConfiguration from './config';\nimport OVPProviderParser from './provider-parser';\nimport {KalturaMediaEntry} from './response-types/kaltura-media-entry';\nimport OVPMediaEntryLoader from './loaders/media-entry-loader';\nimport OVPSessionLoader from './loaders/session-loader';\nimport OVPDataLoaderManager from './loaders/data-loader-manager';\nimport OVPPlaylistLoader from './loaders/playlist-loader';\nimport BaseProvider from '../common/base-provider';\nimport MediaEntry from '../../entities/media-entry';\nimport OVPEntryListLoader from './loaders/entry-list-loader';\nimport Error from '../../util/error/error';\n\nexport default class OVPProvider extends BaseProvider {\n _filterOptionsConfig: ProviderFilterOptionsObject = {redirectFromEntryId: true};\n /**\n * @constructor\n * @param {ProviderOptionsObject} options - provider options\n * @param {string} playerVersion - player version\n */\n constructor(options: ProviderOptionsObject, playerVersion: string) {\n super(options, playerVersion);\n this._logger = getLogger('OVPProvider');\n OVPConfiguration.set(options.env);\n this._setFilterOptionsConfig(options.filterOptions);\n this._networkRetryConfig = Object.assign(this._networkRetryConfig, options.networkRetryParameters);\n }\n\n get env() {\n return OVPConfiguration.get();\n }\n\n /**\n * Gets the backend media config.\n * @param {OVPProviderMediaInfoObject} mediaInfo - ovp media info\n * @returns {Promise} - The provider media config\n */\n getMediaConfig(mediaInfo: OVPProviderMediaInfoObject): Promise {\n if (mediaInfo.ks) {\n this.ks = mediaInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const entryId = mediaInfo.entryId;\n const referenceId = mediaInfo.referenceId;\n if (entryId || referenceId) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n const redirectFromEntryId = this._getEntryRedirectFilter(mediaInfo);\n this._dataLoader.add(OVPMediaEntryLoader, {entryId, ks, redirectFromEntryId, referenceId});\n return this._dataLoader.fetchData().then(\n response => {\n try {\n resolve(this._parseDataFromResponse(response));\n } catch (err) {\n reject(err);\n }\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject(new Error(Error.Severity.CRITICAL, Error.Category.PROVIDER, Error.Code.MISSING_MANDATORY_PARAMS, {message: 'missing entry id'}));\n }\n });\n }\n\n doRequest(loaders: Array, ks?: string): Promise {\n let theKs: string = ks || this.ks;\n const dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, theKs, this._networkRetryConfig);\n\n return new Promise((resolve, reject) => {\n if (!theKs) {\n dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n loaders.forEach((loaderRequest: RequestLoader) => {\n dataLoader.add(loaderRequest.loader, loaderRequest.params, theKs || '{1:result:ks}');\n });\n return dataLoader.fetchData().then(\n response => {\n try {\n resolve(response);\n } catch (err) {\n reject(err);\n }\n },\n err => {\n reject(err);\n }\n );\n });\n }\n\n _getEntryRedirectFilter(mediaInfo: Object): boolean {\n return typeof mediaInfo.redirectFromEntryId === 'boolean'\n ? mediaInfo.redirectFromEntryId\n : typeof this._filterOptionsConfig.redirectFromEntryId === 'boolean'\n ? this._filterOptionsConfig.redirectFromEntryId\n : true;\n }\n\n _setFilterOptionsConfig(options?: ProviderFilterOptionsObject): void {\n if (options && typeof options.redirectFromEntryId == 'boolean') {\n this._filterOptionsConfig.redirectFromEntryId = options.redirectFromEntryId;\n }\n }\n\n _parseDataFromResponse(data: Map): ProviderMediaConfigObject {\n this._logger.debug('Data parsing started');\n const mediaConfig: ProviderMediaConfigObject = {\n session: {\n isAnonymous: this._isAnonymous,\n partnerId: this.partnerId\n },\n sources: this._getDefaultSourcesObject(),\n plugins: {}\n };\n\n if (this.uiConfId) {\n mediaConfig.session.uiConfId = this.uiConfId;\n }\n\n if (data) {\n if (data.has(OVPSessionLoader.id)) {\n const sessionLoader = data.get(OVPSessionLoader.id);\n if (sessionLoader && sessionLoader.response) {\n mediaConfig.session.ks = sessionLoader.response;\n if (this.widgetId !== this.defaultWidgetId) {\n this.ks = mediaConfig.session.ks;\n }\n }\n } else {\n mediaConfig.session.ks = this.ks;\n }\n if (data.has(OVPMediaEntryLoader.id)) {\n const mediaLoader = data.get(OVPMediaEntryLoader.id);\n if (mediaLoader && mediaLoader.response) {\n const response = (mediaLoader: OVPMediaEntryLoader).response;\n if (OVPProviderParser.hasBlockAction(response)) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.BLOCK_ACTION, {\n action: OVPProviderParser.getBlockAction(response),\n messages: OVPProviderParser.getErrorMessages(response)\n });\n }\n const mediaEntry = OVPProviderParser.getMediaEntry(this.isAnonymous ? '' : this.ks, this.partnerId, this.uiConfId, response);\n Object.assign(mediaConfig.sources, this._getSourcesObject(mediaEntry));\n this._verifyMediaStatus(mediaEntry);\n this._verifyHasSources(mediaConfig.sources);\n const bumper = OVPProviderParser.getBumper(response, this.isAnonymous ? '' : this.ks, this.partnerId);\n if (bumper) {\n Object.assign(mediaConfig.plugins, {bumper});\n }\n }\n }\n }\n this._logger.debug('Data parsing finished', mediaConfig);\n return mediaConfig;\n }\n\n /**\n * Checks media is ready for playback (not being imported or converted)\n * @param {MediaEntry} mediaEntry - the media entry info\n * @returns {void}\n */\n _verifyMediaStatus(mediaEntry: MediaEntry) {\n if ([KalturaMediaEntry.EntryStatus.IMPORT, KalturaMediaEntry.EntryStatus.PRECONVERT].includes(mediaEntry.status)) {\n throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.MEDIA_STATUS_NOT_READY, {\n messages: `Status of entry id ${mediaEntry.id} is ${mediaEntry.status} and is still being imported or converted`,\n data: {status}\n });\n }\n }\n /**\n * Gets the backend playlist config.\n * @param {ProviderPlaylistInfoObject} playlistInfo - ovp playlist info\n * @returns {Promise} - The provider playlist config\n */\n getPlaylistConfig(playlistInfo: ProviderPlaylistInfoObject): Promise {\n if (playlistInfo.ks) {\n this.ks = playlistInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const playlistId = playlistInfo.playlistId;\n if (playlistId) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n this._dataLoader.add(OVPPlaylistLoader, {playlistId, ks});\n this._dataLoader.fetchData().then(\n response => {\n resolve(this._parsePlaylistDataFromResponse(response));\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject({success: false, data: 'Missing mandatory parameter'});\n }\n });\n }\n\n _parsePlaylistDataFromResponse(data: Map): ProviderPlaylistObject {\n this._logger.debug('Data parsing started');\n const playlistConfig: ProviderPlaylistObject = this._getPlaylistObject();\n if (data && data.has(OVPPlaylistLoader.id)) {\n const playlistLoader = data.get(OVPPlaylistLoader.id);\n if (playlistLoader && playlistLoader.response) {\n const playlist = OVPProviderParser.getPlaylist(playlistLoader.response);\n playlistConfig.id = playlist.id;\n playlistConfig.poster = playlist.poster;\n playlistConfig.metadata.name = playlist.name;\n playlistConfig.metadata.description = playlist.description;\n playlist.items.forEach(i => playlistConfig.items.push({sources: this._getSourcesObject(i)}));\n }\n }\n this._logger.debug('Data parsing finished', playlistConfig);\n return playlistConfig;\n }\n\n /**\n * Gets playlist config from entry list.\n * @param {ProviderEntryListObject} entryListInfo - ovp entry list info\n * @returns {Promise} - The provider playlist config\n */\n getEntryListConfig(entryListInfo: ProviderEntryListObject): Promise {\n if (entryListInfo.ks) {\n this.ks = entryListInfo.ks;\n this._isAnonymous = false;\n }\n if (this.widgetId !== this.defaultWidgetId) {\n this._isAnonymous = false;\n }\n this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);\n return new Promise((resolve, reject) => {\n const entries = entryListInfo.entries;\n if (entries && entries.length) {\n let ks: string = this.ks;\n if (!ks) {\n ks = '{1:result:ks}';\n this._dataLoader.add(OVPSessionLoader, {widgetId: this.widgetId});\n }\n const redirectFromEntryId = this._getEntryRedirectFilter(entryListInfo);\n this._dataLoader.add(OVPEntryListLoader, {entries, ks, redirectFromEntryId});\n this._dataLoader.fetchData().then(\n response => {\n resolve(this._parseEntryListDataFromResponse(response));\n },\n err => {\n reject(err);\n }\n );\n } else {\n reject({success: false, data: 'Missing mandatory parameter'});\n }\n });\n }\n\n _parseEntryListDataFromResponse(data: Map): ProviderPlaylistObject {\n this._logger.debug('Data parsing started');\n const playlistConfig: ProviderPlaylistObject = this._getPlaylistObject();\n if (data && data.has(OVPEntryListLoader.id)) {\n const playlistLoader = data.get(OVPEntryListLoader.id);\n if (playlistLoader && playlistLoader.response) {\n const entryList = OVPProviderParser.getEntryList(playlistLoader.response);\n entryList.items.forEach(i => playlistConfig.items.push({sources: this._getSourcesObject(i)}));\n }\n }\n this._logger.debug('Data parsing finished', playlistConfig);\n return playlistConfig;\n }\n\n _getPlaylistObject(): ProviderPlaylistObject {\n return {\n id: '',\n metadata: {\n name: '',\n description: ''\n },\n poster: '',\n items: []\n };\n }\n\n _getDefaultSourcesObject(): ProviderMediaConfigSourcesObject {\n return {\n hls: [],\n dash: [],\n progressive: [],\n id: '',\n duration: 0,\n type: MediaEntry.Type.UNKNOWN,\n poster: '',\n dvr: false,\n vr: null,\n metadata: {\n name: '',\n description: '',\n tags: ''\n }\n };\n }\n\n _getSourcesObject(mediaEntry: MediaEntry) {\n const sourcesObject: ProviderMediaConfigSourcesObject = this._getDefaultSourcesObject();\n const mediaSources = mediaEntry.sources.toJSON();\n sourcesObject.hls = mediaSources.hls;\n sourcesObject.dash = mediaSources.dash;\n sourcesObject.progressive = mediaSources.progressive;\n sourcesObject.id = mediaEntry.id;\n sourcesObject.duration = mediaEntry.duration;\n sourcesObject.type = mediaEntry.type;\n sourcesObject.dvr = !!mediaEntry.dvrStatus;\n sourcesObject.poster = mediaEntry.poster;\n if (mediaEntry.sources.captions) {\n sourcesObject.captions = mediaEntry.sources.captions;\n }\n if (mediaEntry.metadata && typeof mediaEntry.metadata.tags === 'string' && mediaEntry.metadata.tags.indexOf('360') > -1) {\n sourcesObject.vr = {};\n }\n Object.assign(sourcesObject.metadata, mediaEntry.metadata);\n return sourcesObject;\n }\n}\n","//@flow\nimport ServiceResult from '../../common/base-service-result';\n\nexport class KalturaUIConfResponse extends ServiceResult {\n static Type: {[type: string]: number} = {\n PLAYER: 1,\n CONTRIBUTION_WIZARD: 2,\n SIMPLE_EDITOR: 3,\n ADVANCED_EDITOR: 4,\n PLAYLIST: 5,\n APP_STUDIO: 6,\n KRECORD: 7,\n PLAYER_V3: 8,\n KMC_ACCOUNT: 9,\n KMC_ANALYTICS: 10,\n KMC_CONTENT: 11,\n KMC_DASHBOARD: 12,\n KMC_LOGIN: 13,\n PLAYER_SL: 14,\n CLIENTSIDE_ENCODER: 15,\n KMC_GENERAL: 16,\n KMC_ROLES_AND_PERMISSIONS: 17,\n CLIPPER: 18,\n KSR: 19,\n KUPLOAD: 20,\n WEBCASTING: 21\n };\n\n static CreationMode: {[mode: string]: number} = {\n WIZARD: 2,\n ADVANCED: 3\n };\n\n description: string;\n objTypeAsString: string;\n width: number;\n height: number;\n htmlParams: string;\n swfUrl: string;\n confFilePath: string;\n confFile: string;\n confFileFeatures: string;\n name: string;\n config: string;\n confVars: string;\n useCdn: boolean;\n tags: string;\n swfUrlVersion: string;\n created: Date;\n updated: Date;\n html5Url: string;\n version: string;\n partnerTags: string;\n objType: number;\n creationMode: number;\n\n /**\n * @constructor\n * @param {Object} data The json response\n */\n constructor(data: Object) {\n super(data);\n if (!this.hasError) {\n this.name = data.name;\n this.description = data.description;\n this.objTypeAsString = data.objTypeAsString;\n this.width = data.width;\n this.height = data.height;\n this.htmlParams = data.htmlParams;\n this.swfUrl = data.swfUrl;\n this.confFilePath = data.confFilePath;\n this.confFile = data.confFile;\n this.confFileFeatures = data.confFileFeatures;\n this.config = data.config;\n this.confVars = data.confVars;\n this.useCdn = data.useCdn;\n this.tags = data.tags;\n this.swfUrlVersion = data.swfUrlVersion;\n this.created = new Date(0);\n this.created.setUTCSeconds(data.createdAt);\n this.updated = new Date(0);\n this.updated.setUTCSeconds(data.updatedAt);\n this.html5Url = data.description;\n this.version = data.description;\n this.partnerTags = data.description;\n this.objType = data.description;\n this.creationMode = data.description;\n }\n }\n}\n","// @flow\nimport OVPProvider from './provider';\nimport RequestBuilder from '../../util/request-builder';\nimport * as ResponseTypes from './response-types';\n\ndeclare var __VERSION__: string;\ndeclare var __NAME__: string;\n\nconst NAME = __NAME__ + '-ovp';\nconst VERSION = __VERSION__;\n\nexport {OVPProvider as Provider, NAME, VERSION, RequestBuilder, ResponseTypes};\n"],"sourceRoot":""} \ No newline at end of file