-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dash.protection.debug.js.map
1 lines (1 loc) · 421 KB
/
dash.protection.debug.js.map
1
{"version":3,"sources":["webpack://dashjs/webpack/universalModuleDefinition","webpack://dashjs/webpack/bootstrap","webpack://dashjs/./node_modules/path-browserify/index.js","webpack://dashjs/./node_modules/process/browser.js","webpack://dashjs/./src/core/FactoryMaker.js","webpack://dashjs/./src/core/Utils.js","webpack://dashjs/./src/core/errors/ErrorsBase.js","webpack://dashjs/./src/core/events/EventsBase.js","webpack://dashjs/./src/streaming/constants/Constants.js","webpack://dashjs/./src/streaming/constants/ProtectionConstants.js","webpack://dashjs/./src/streaming/protection/CommonEncryption.js","webpack://dashjs/./src/streaming/protection/Protection.js","webpack://dashjs/./src/streaming/protection/ProtectionEvents.js","webpack://dashjs/./src/streaming/protection/controllers/ProtectionController.js","webpack://dashjs/./src/streaming/protection/controllers/ProtectionKeyController.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemClearKey.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemPlayReady.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemW3CClearKey.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemWidevine.js","webpack://dashjs/./src/streaming/protection/errors/ProtectionErrors.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_01b.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_21Jan2015.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_3Feb2014.js","webpack://dashjs/./src/streaming/protection/servers/ClearKey.js","webpack://dashjs/./src/streaming/protection/servers/DRMToday.js","webpack://dashjs/./src/streaming/protection/servers/PlayReady.js","webpack://dashjs/./src/streaming/protection/servers/Widevine.js","webpack://dashjs/./src/streaming/protection/vo/ClearKeyKeySet.js","webpack://dashjs/./src/streaming/protection/vo/KeyMessage.js","webpack://dashjs/./src/streaming/protection/vo/KeyPair.js","webpack://dashjs/./src/streaming/protection/vo/KeySystemAccess.js","webpack://dashjs/./src/streaming/protection/vo/KeySystemConfiguration.js","webpack://dashjs/./src/streaming/protection/vo/LicenseRequest.js","webpack://dashjs/./src/streaming/protection/vo/LicenseResponse.js","webpack://dashjs/./src/streaming/protection/vo/MediaCapability.js","webpack://dashjs/./src/streaming/protection/vo/NeedKey.js","webpack://dashjs/./src/streaming/vo/DashJSError.js","webpack://dashjs/./src/streaming/vo/metrics/HTTPRequest.js"],"names":["FactoryMaker","instance","singletonContexts","singletonFactories","classFactories","extend","name","childInstance","override","context","getSingletonInstance","className","i","obj","setSingletonInstance","push","deleteSingletonInstances","filter","x","getFactoryByName","factoriesArray","updateFactory","factory","updateClassFactory","getClassFactoryByName","getClassFactory","classConstructor","__dashjs_factory_name","undefined","create","merge","arguments","updateSingletonFactory","getSingletonFactoryByName","getSingletonFactory","getInstance","args","classInstance","extensionObject","extension","apply","parent","prop","hasOwnProperty","getClassName","Utils","dest","source","copy","s","empty","mixin","src","r","Array","l","length","clone","url","params","modifiedUrl","URL","forEach","param","key","value","searchParams","set","href","e","headerStr","headers","headerPairs","trim","split","ilen","headerPair","index","indexOf","substring","dt","Date","getTime","uuid","replace","c","Math","random","floor","toString","string","hash","chr","charCodeAt","originalUrl","targetUrl","original","target","protocol","origin","relativePath","path","relative","pathname","substr","lastIndexOf","startIndexOffset","ErrorsBase","errors","config","publicOnly","err","EventsBase","events","evt","Constants","init","STREAM","VIDEO","AUDIO","TEXT","MUXED","IMAGE","STPP","TTML","VTT","WVTT","ABR_STRATEGY_DYNAMIC","ABR_STRATEGY_BOLA","ABR_STRATEGY_L2A","ABR_STRATEGY_LoLP","ABR_STRATEGY_THROUGHPUT","ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA","ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING","ABR_FETCH_THROUGHPUT_CALCULATION_AAST","LIVE_CATCHUP_MODE_DEFAULT","LIVE_CATCHUP_MODE_LOLP","MOVING_AVERAGE_SLIDING_WINDOW","MOVING_AVERAGE_EWMA","BAD_ARGUMENT_ERROR","MISSING_CONFIG_ERROR","TRACK_SWITCH_MODE_ALWAYS_REPLACE","TRACK_SWITCH_MODE_NEVER_REPLACE","TRACK_SELECTION_MODE_FIRST_TRACK","TRACK_SELECTION_MODE_HIGHEST_BITRATE","TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY","TRACK_SELECTION_MODE_WIDEST_RANGE","TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY","CMCD_MODE_QUERY","CMCD_MODE_HEADER","LOCATION","INITIALIZE","TEXT_SHOWING","TEXT_HIDDEN","CC1","CC3","UTF8","SCHEME_ID_URI","START_TIME","SERVICE_DESCRIPTION_DVB_LL_SCHEME","SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME","XML","ARRAY_BUFFER","DVB_REPORTING_URL","DVB_PROBABILITY","VIDEO_ELEMENT_READY_STATES","HAVE_NOTHING","HAVE_METADATA","HAVE_CURRENT_DATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","FILE_LOADER_TYPES","FETCH","XHR","constants","ProtectionConstants","CLEARKEY_KEYSTEM_STRING","WIDEVINE_KEYSTEM_STRING","PLAYREADY_KEYSTEM_STRING","PLAYREADY_RECOMMENDATION_KEYSTEM_STRING","INITIALIZATION_DATA_TYPE_CENC","INITIALIZATION_DATA_TYPE_KEYIDS","INITIALIZATION_DATA_TYPE_WEBM","LICENSE_SERVER_MANIFEST_CONFIGURATIONS","attributes","prefixes","CommonEncryption","cpArray","retVal","cp","schemeIdUri","toLowerCase","pssh","offset","view","DataView","version","getUint8","getUint32","slice","keySystem","initData","psshList","parsePSSHList","cpData","BASE64","__text","decodeArray","buffer","data","dv","done","byteCursor","size","nextBox","systemID","boxStart","byteLength","val","mediaInfo","licenseServer","info","contentProtection","targetProtectionData","j","ckData","k","attribute","prefix","__prefix","APIS_ProtectionModel_01b","generateKeyRequest","addKey","cancelKeyRequest","needkey","keyerror","keyadded","keymessage","APIS_ProtectionModel_3Feb2014","setMediaKeys","MediaKeys","release","error","message","ready","close","Protection","createProtectionSystem","controller","protectionKeyController","ProtectionKeyController","setConfig","debug","settings","initialize","protectionModel","_getProtectionModel","ProtectionController","eventBus","cmcdModel","customParametersModel","capabilities","setEncryptedMediaSupported","logger","getLogger","errHandler","videoElement","videoModel","getElement","onencrypted","mediaKeys","ProtectionModel_21Jan2015","_getAPI","ProtectionModel_3Feb2014","api","ProtectionModel_01b","warn","apis","Object","keys","dashjs","ProtectionEvents","ProtectionErrors","INTERNAL_KEY_MESSAGE","INTERNAL_KEY_STATUS_CHANGED","KEY_ADDED","KEY_ERROR","KEY_MESSAGE","KEY_SESSION_CLOSED","KEY_SESSION_CREATED","KEY_SESSION_REMOVED","KEY_STATUSES_CHANGED","KEY_SYSTEM_ACCESS_COMPLETE","KEY_SYSTEM_SELECTED","LICENSE_REQUEST_COMPLETE","LICENSE_REQUEST_SENDING","NEED_KEY","PROTECTION_CREATED","PROTECTION_DESTROYED","SERVER_CERTIFICATE_UPDATED","TEARDOWN_COMPLETE","VIDEO_ELEMENT_SELECTED","KEY_SESSION_UPDATED","protectionEvents","NEEDKEY_BEFORE_INITIALIZE_RETRIES","NEEDKEY_BEFORE_INITIALIZE_TIMEOUT","LICENSE_SERVER_REQUEST_RETRIES","LICENSE_SERVER_REQUEST_RETRY_INTERVAL","LICENSE_SERVER_REQUEST_DEFAULT_TIMEOUT","needkeyRetries","pendingKeySystemData","mediaInfoArr","protDataSet","sessionType","robustnessLevel","selectedKeySystem","keySystemSelectionInProgress","licenseXhrRequest","licenseRequestRetryTimeout","setup","on","_onKeyMessage","_onKeyStatusChanged","checkConfig","Error","initializeForMedia","supportedKS","getSupportedKeySystemsFromContentProtection","_selectKeySystem","fromManifest","_selectInitialKeySystem","_initiateWithExistingKeySystem","requestedKeySystems","sort","ksA","ksB","indexA","ks","systemString","priority","indexB","keySystemConfiguration","_getKeySystemConfiguration","configs","protData","keySystemAccess","requestKeySystemAccess","then","event","selectedSystemString","mksa","selectKeySystem","trigger","_getProtDataForKeySystem","serverCertificate","setServerCertificate","ksIdx","current","_loadOrCreateKeySession","DashJSError","KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE","KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE","findIndex","entry","keySystemInfo","isClearKey","clearkeys","kids","TextEncoder","encode","JSON","stringify","sessionId","loadKeySession","createKeySession","initDataForKS","getPSSHForKeySystem","_isKeyIdDuplicate","keyId","_isInitDataDuplicate","KEY_SESSION_CREATED_ERROR_CODE","KEY_SESSION_CREATED_ERROR_MESSAGE","keySystemString","clearMediaInfoArray","cps","sessions","getSessions","getKeyId","currentInitData","getAllInitData","initDataEquals","removeKeySession","sessionToken","closeKeySession","setMediaElement","element","_onNeedKey","off","setSessionType","setRobustnessLevel","level","setProtectionData","stop","_abortLicenseRequest","reset","retryTimeout","clearTimeout","keySystemData","audioCapabilities","videoCapabilities","audioRobustness","videoRobustness","ksSessionType","distinctiveIdentifier","persistentState","media","type","MediaCapability","codec","KeySystemConfiguration","status","keyMessage","messageType","licenseServerModelInstance","getLicenseServerModelInstance","eventData","_sendLicenseRequestCompleteEvent","MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE","MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE","getSessionId","processClearKeyLicenseRequest","keyPairs","updateKeySession","_issueLicenseRequest","licenseServerData","_getLicenseServerUrl","MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE","MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE","reqHeaders","withCredentials","_updateHeaders","httpRequestHeaders","headersFromMessage","getRequestHeadersFromMessage","onLoad","xhr","responseHeaders","parseHttpHeaders","getAllResponseHeaders","licenseResponse","LicenseResponse","responseURL","response","licenseResponseFilters","getLicenseResponseFilters","_applyFilters","licenseMessage","getLicenseMessage","_reportError","onAbort","MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE","MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE","statusText","readyState","onError","reqPayload","getLicenseRequestFromMessage","reqMethod","getHTTPMethod","responseType","getResponseType","timeout","isNaN","httpTimeout","licenseRequest","LicenseRequest","retryAttempts","get","streaming","HTTPRequest","LICENSE","licenseRequestFilters","getLicenseRequestFilters","_doLicenseRequest","request","retriesCount","XMLHttpRequest","cmcd","enabled","cmcdMode","mode","cmcdParams","getQueryParameter","addAditionalQueryParameterToUrl","open","method","setRequestHeader","cmcdHeaders","getHeaderParameters","header","_retryRequest","retryInterval","retryIntervals","setTimeout","onload","ontimeout","onerror","onabort","payload","send","onloadend","onprogress","abort","serverURL","laURL","getLicenseServerUrlFromMediaInfo","schemeIdURI","psshData","getPSSHData","getLicenseServerURLFromInitData","getServerURLFromMessage","errorMsg","getErrorResponse","serverResponse","responseCode","responseText","filters","Promise","resolve","reduce","prev","next","retry","protection","ignoreEmeEncryptedEvent","initDataType","abInitData","ArrayBuffer","isView","String","fromCharCode","Uint8Array","getSupportedKeySystemsFromSegmentPssh","getKeySystems","setKeySystems","keySystems","clearkeyKeySystem","clearkeyW3CKeySystem","KeySystemPlayReady","KeySystemWidevine","KeySystemClearKey","KeySystemW3CClearKey","newKeySystems","getKeySystemBySystemString","initData1","initData2","data1","data2","cpIdx","cencContentProtection","findCencContentProtection","getInitData","cdmData","getCDMData","_getSessionId","_getSessionType","DRMToday","Widevine","PlayReady","ClearKey","getClearKeysFromProtectionData","protectionDataSet","getProtectionData","protectionData","clearkeySet","jsonMsg","parse","clearkeyID","clearkey","KeyPair","ClearKeyKeySet","parseInitDataFromContentProtection","cencDefaultKid","cencDefaultKidToBase64Representation","kid","btoa","match","map","a","parseInt","join","PRCDMData","messageFormat","msg","xmlDoc","parser","DOMParser","detectPlayreadyMessageFormat","dataview","Uint16Array","parseFromString","headerNameList","getElementsByTagName","headerValueList","childNodes","nodeValue","Content","Challenge","decode","numRecords","getUint16","recordType","recordLength","recordData","record","laurl","luiurl","PSSHBoxType","playreadySystemID","uint8arraydecodedPROHeader","PROSize","PSSHSize","PSSHBoxBuffer","PSSHBox","PSSHData","pro","prheader","setUint32","setPlayReadyMessageFormat","format","_cdmData","customData","cdmDataBytes","MEDIA_KEYERR_CODE","MEDIA_KEYERR_UNKNOWN_CODE","MEDIA_KEYERR_CLIENT_CODE","MEDIA_KEYERR_SERVICE_CODE","MEDIA_KEYERR_OUTPUT_CODE","MEDIA_KEYERR_HARDWARECHANGE_CODE","MEDIA_KEYERR_DOMAIN_CODE","MEDIA_KEY_MESSAGE_ERROR_CODE","SERVER_CERTIFICATE_UPDATED_ERROR_CODE","KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE","MEDIA_KEYERR_UNKNOWN_MESSAGE","MEDIA_KEYERR_CLIENT_MESSAGE","MEDIA_KEYERR_SERVICE_MESSAGE","MEDIA_KEYERR_OUTPUT_MESSAGE","MEDIA_KEYERR_HARDWARECHANGE_MESSAGE","MEDIA_KEYERR_DOMAIN_MESSAGE","MEDIA_KEY_MESSAGE_ERROR_MESSAGE","SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE","KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE","protectionErrors","pendingSessions","moreSessionsAllowed","eventHandler","createEventHandler","removeEventListeners","concat","ksConfigurations","reject","ve","document","createElement","found","supportedAudio","supportedVideo","configIdx","videos","videoIdx","canPlayType","contentType","ksConfig","KeySystemAccess","errorMessage","mediaElement","addEventListener","ksInfo","newSession","getExpirationTime","NaN","getSessionType","keyID","handleEvent","NeedKey","findSessionByID","code","errorCode","systemCode","shift","KeyMessage","defaultURL","sessionArray","len","removeEventListener","SYSTEM_STRING_PRIORITY","numSessions","session","removeSession","closed","_closeKeySessionInternal","getUsable","_requestKeySystemAccessInternal","idx","navigator","requestMediaKeySystemAccess","protDataSystemStringPriority","systemStringPriority","currentKeySystem","systemStringsToApply","_checkAccessForKeySystem","mediaKeySystemAccess","configuration","getConfiguration","_checkAccessForSystemStrings","createMediaKeys","mkeys","createSession","createSessionToken","dataType","generateRequest","toJWK","update","load","success","remove","token","splice","parseKeyStatus","keyStatuses","keyStatus","expiration","getKeyStatuses","usable","audios","audioIdx","window","isTypeSupported","ksAccess","ksConfiguration","boundDoSetKeys","doSetKeys","bind","keySession","errorStr","destinationURL","keypair","keyid","license","keySystemStr","soap","uintToString","arrayBuffer","encodedString","decodedString","decodeURIComponent","escape","parseServerResponse","stringResponse","envelope","getElementsByTagNameNS","body","fault","parseErrorResponse","faultstring","statusCode","idStart","idEnd","detail","exception","node","firstChild","errorString","call","numKeys","jwk","kty","alg","jwkString","buf","bView","sessionTypes","initDataTypes","robustness","tcpid","actualurl","range","trequest","tresponse","responsecode","interval","trace","_stream","_tfinish","_mediaduration","_quality","_responseHeaders","_serviceLocation","_fileLoaderType","HTTPRequestTrace","d","b","GET","HEAD","MPD_TYPE","XLINK_EXPANSION_TYPE","INIT_SEGMENT_TYPE","INDEX_SEGMENT_TYPE","MEDIA_SEGMENT_TYPE","BITSTREAM_SWITCHING_SEGMENT_TYPE","MSS_FRAGMENT_INFO_SEGMENT_TYPE","DVB_REPORTING_TYPE","OTHER_TYPE"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAM;AAChB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,8BAA8B;AAClE;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,oBAAoB;AAC9B;AACA;;AAEA;AACA,UAAU,UAAU;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,sBAAsB;AACrD;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,QAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC7SA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;;;;;;;;;;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;IACM8F,e;AACF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACI,yBAAYzd,SAAZ,EAAuB2hB,eAAvB,EAAwC;AAAA;;AACpC,OAAK3hB,SAAL,GAAiBA,SAAjB;AACA,OAAK2hB,eAAL,GAAuBA,eAAvB;AACH,C;;AAGUlE,8EAAf,E;;;;;;;;;;;;;;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;IACM9P,sB;AACF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,gCAAYX,iBAAZ,EAA+BC,iBAA/B,EAAkDI,qBAAlD,EAAyEC,eAAzE,EAA0F+W,YAA1F,EAAwG;AAAA;;AACpG,OAAKC,aAAL,GAAqB,CAAE,MAAF,CAArB;;AACA,MAAItX,iBAAiB,IAAIA,iBAAiB,CAAChW,MAA3C,EAAmD;AAC/C,SAAKgW,iBAAL,GAAyBA,iBAAzB;AACH;;AACD,MAAIC,iBAAiB,IAAIA,iBAAiB,CAACjW,MAA3C,EAAmD;AAC/C,SAAKiW,iBAAL,GAAyBA,iBAAzB;AACH;;AACD,OAAKI,qBAAL,GAA6BA,qBAA7B;AACA,OAAKC,eAAL,GAAuBA,eAAvB;AACA,OAAK+W,YAAL,GAAoBA,YAApB;AACH,C;;AAGU1W,qFAAf,E;;;;;;;;;;;;;;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;IACMjC,e;AACF;AACJ;AACA;AACA;AACA;AACA;AACI,yBAAY8P,WAAZ,EAAyBgH,UAAzB,EAAqC;AAAA;;AACjC,OAAKhH,WAAL,GAAmBA,WAAnB;AACA,OAAKgH,UAAL,GAAkBA,UAAlB;AACH,C;;AAGU9W,8EAAf,E;;;;;;;;;;;;;;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;IACM2Q,O;AACF;AACJ;AACA;AACA;AACA;AACI,iBAAYne,QAAZ,EAAsB8U,YAAtB,EAAoC;AAAA;;AAChC,OAAK9U,QAAL,GAAgBA,QAAhB;AACA,OAAK8U,YAAL,GAAoBA,YAApB;AACH,C;;AAGUqJ,sEAAf,E;;;;;;;;;;;;;;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;IACMrU,W,GACF,qBAAYuU,IAAZ,EAAkB3b,OAAlB,EAA2BlC,IAA3B,EAAiC;AAAA;;AAC7B,OAAK6d,IAAL,GAAYA,IAAI,IAAI,IAApB;AACA,OAAK3b,OAAL,GAAeA,OAAO,IAAI,IAA1B;AACA,OAAKlC,IAAL,GAAYA,IAAI,IAAI,IAApB;AACH,C;;AAGUsJ,0EAAf,E;;;;;;;;;;;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;IACMwH,W;AACF;AACJ;AACA;AACI,uBAAc;AAAA;;AACV;AACR;AACA;AACA;AACQ,OAAKiT,KAAL,GAAa,IAAb;AACA;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACQ,OAAKhX,IAAL,GAAY,IAAZ;AACA;AACR;AACA;AACA;;AACQ,OAAKtW,GAAL,GAAW,IAAX;AACA;AACR;AACA;AACA;;AACQ,OAAKutB,SAAL,GAAiB,IAAjB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,KAAL,GAAa,IAAb;AACA;AACR;AACA;AACA;;AACQ,OAAKC,QAAL,GAAgB,IAAhB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,SAAL,GAAiB,IAAjB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,YAAL,GAAoB,IAApB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,QAAL,GAAgB,IAAhB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,KAAL,GAAa,EAAb;AAEA;AACR;AACA;AACA;;AACQ,OAAKC,OAAL,GAAe,IAAf;AACA;AACR;AACA;AACA;;AACQ,OAAKC,QAAL,GAAgB,IAAhB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,cAAL,GAAsB,IAAtB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,QAAL,GAAgB,IAAhB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,gBAAL,GAAwB,IAAxB;AACA;AACR;AACA;AACA;;AACQ,OAAKC,gBAAL,GAAwB,IAAxB;AACA;AACR;AACA;;AACQ,OAAKC,eAAL,GAAuB,IAAvB;AACH,C;AAGL;AACA;AACA;AACA;;;IACMC,gB;AACF;AACJ;AACA;AACI,4BAAc;AAAA;;AACV;AACR;AACA;AACA;AACQ,OAAK9uB,CAAL,GAAS,IAAT;AACA;AACR;AACA;AACA;;AACQ,OAAK+uB,CAAL,GAAS,IAAT;AACA;AACR;AACA;AACA;;AACQ,OAAKC,CAAL,GAAS,EAAT;AACH,C;;AAGLlU,WAAW,CAACmU,GAAZ,GAAkB,KAAlB;AACAnU,WAAW,CAACoU,IAAZ,GAAmB,MAAnB;AACApU,WAAW,CAACqU,QAAZ,GAAuB,KAAvB;AACArU,WAAW,CAACsU,oBAAZ,GAAmC,gBAAnC;AACAtU,WAAW,CAACuU,iBAAZ,GAAgC,uBAAhC;AACAvU,WAAW,CAACwU,kBAAZ,GAAiC,cAAjC;AACAxU,WAAW,CAACyU,kBAAZ,GAAiC,cAAjC;AACAzU,WAAW,CAAC0U,gCAAZ,GAA+C,2BAA/C;AACA1U,WAAW,CAAC2U,8BAAZ,GAA6C,qBAA7C;AACA3U,WAAW,CAAC4U,kBAAZ,GAAiC,cAAjC;AACA5U,WAAW,CAACC,OAAZ,GAAsB,SAAtB;AACAD,WAAW,CAAC6U,UAAZ,GAAyB,OAAzB","file":"dash.protection.debug.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[\"dashjs\"] = factory();\n\telse\n\t\troot[\"dashjs\"] = 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 = \"/dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/streaming/protection/Protection.js\");\n","// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @module FactoryMaker\n * @ignore\n */\nconst FactoryMaker = (function () {\n\n let instance;\n let singletonContexts = [];\n const singletonFactories = {};\n const classFactories = {};\n\n function extend(name, childInstance, override, context) {\n if (!context[name] && childInstance) {\n context[name] = {\n instance: childInstance,\n override: override\n };\n }\n }\n\n /**\n * Use this method from your extended object. this.factory is injected into your object.\n * this.factory.getSingletonInstance(this.context, 'VideoModel')\n * will return the video model for use in the extended object.\n *\n * @param {Object} context - injected into extended object as this.context\n * @param {string} className - string name found in all dash.js objects\n * with name __dashjs_factory_name Will be at the bottom. Will be the same as the object's name.\n * @returns {*} Context aware instance of specified singleton name.\n * @memberof module:FactoryMaker\n * @instance\n */\n function getSingletonInstance(context, className) {\n for (const i in singletonContexts) {\n const obj = singletonContexts[i];\n if (obj.context === context && obj.name === className) {\n return obj.instance;\n }\n }\n return null;\n }\n\n /**\n * Use this method to add an singleton instance to the system. Useful for unit testing to mock objects etc.\n *\n * @param {Object} context\n * @param {string} className\n * @param {Object} instance\n * @memberof module:FactoryMaker\n * @instance\n */\n function setSingletonInstance(context, className, instance) {\n for (const i in singletonContexts) {\n const obj = singletonContexts[i];\n if (obj.context === context && obj.name === className) {\n singletonContexts[i].instance = instance;\n return;\n }\n }\n singletonContexts.push({\n name: className,\n context: context,\n instance: instance\n });\n }\n\n /**\n * Use this method to remove all singleton instances associated with a particular context.\n *\n * @param {Object} context\n * @memberof module:FactoryMaker\n * @instance\n */\n function deleteSingletonInstances(context) {\n singletonContexts = singletonContexts.filter(x => x.context !== context);\n }\n\n /*------------------------------------------------------------------------------------------*/\n\n // Factories storage Management\n\n /*------------------------------------------------------------------------------------------*/\n\n function getFactoryByName(name, factoriesArray) {\n return factoriesArray[name];\n }\n\n function updateFactory(name, factory, factoriesArray) {\n if (name in factoriesArray) {\n factoriesArray[name] = factory;\n }\n }\n\n /*------------------------------------------------------------------------------------------*/\n\n // Class Factories Management\n\n /*------------------------------------------------------------------------------------------*/\n\n function updateClassFactory(name, factory) {\n updateFactory(name, factory, classFactories);\n }\n\n function getClassFactoryByName(name) {\n return getFactoryByName(name, classFactories);\n }\n\n function getClassFactory(classConstructor) {\n let factory = getFactoryByName(classConstructor.__dashjs_factory_name, classFactories);\n\n if (!factory) {\n factory = function (context) {\n if (context === undefined) {\n context = {};\n }\n return {\n create: function () {\n return merge(classConstructor, context, arguments);\n }\n };\n };\n\n classFactories[classConstructor.__dashjs_factory_name] = factory; // store factory\n }\n return factory;\n }\n\n /*------------------------------------------------------------------------------------------*/\n\n // Singleton Factory MAangement\n\n /*------------------------------------------------------------------------------------------*/\n\n function updateSingletonFactory(name, factory) {\n updateFactory(name, factory, singletonFactories);\n }\n\n function getSingletonFactoryByName(name) {\n return getFactoryByName(name, singletonFactories);\n }\n\n function getSingletonFactory(classConstructor) {\n let factory = getFactoryByName(classConstructor.__dashjs_factory_name, singletonFactories);\n if (!factory) {\n factory = function (context) {\n let instance;\n if (context === undefined) {\n context = {};\n }\n return {\n getInstance: function () {\n // If we don't have an instance yet check for one on the context\n if (!instance) {\n instance = getSingletonInstance(context, classConstructor.__dashjs_factory_name);\n }\n // If there's no instance on the context then create one\n if (!instance) {\n instance = merge(classConstructor, context, arguments);\n singletonContexts.push({\n name: classConstructor.__dashjs_factory_name,\n context: context,\n instance: instance\n });\n }\n return instance;\n }\n };\n };\n singletonFactories[classConstructor.__dashjs_factory_name] = factory; // store factory\n }\n\n return factory;\n }\n\n function merge(classConstructor, context, args) {\n\n let classInstance;\n const className = classConstructor.__dashjs_factory_name;\n const extensionObject = context[className];\n\n if (extensionObject) {\n\n let extension = extensionObject.instance;\n\n if (extensionObject.override) { //Override public methods in parent but keep parent.\n\n classInstance = classConstructor.apply({context}, args);\n extension = extension.apply({\n context,\n factory: instance,\n parent: classInstance\n }, args);\n\n for (const prop in extension) {\n if (classInstance.hasOwnProperty(prop)) {\n classInstance[prop] = extension[prop];\n }\n }\n\n } else { //replace parent object completely with new object. Same as dijon.\n\n return extension.apply({\n context,\n factory: instance\n }, args);\n\n }\n } else {\n // Create new instance of the class\n classInstance = classConstructor.apply({context}, args);\n }\n\n // Add getClassName function to class instance prototype (used by Debug)\n classInstance.getClassName = function () {return className;};\n\n return classInstance;\n }\n\n instance = {\n extend: extend,\n getSingletonInstance: getSingletonInstance,\n setSingletonInstance: setSingletonInstance,\n deleteSingletonInstances: deleteSingletonInstances,\n getSingletonFactory: getSingletonFactory,\n getSingletonFactoryByName: getSingletonFactoryByName,\n updateSingletonFactory: updateSingletonFactory,\n getClassFactory: getClassFactory,\n getClassFactoryByName: getClassFactoryByName,\n updateClassFactory: updateClassFactory\n };\n\n return instance;\n\n}());\n\nexport default FactoryMaker;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\nimport path from 'path-browserify'\n\nclass Utils {\n static mixin(dest, source, copy) {\n let s;\n let empty = {};\n if (dest) {\n for (let name in source) {\n if (source.hasOwnProperty(name)) {\n s = source[name];\n if (!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {\n if (typeof dest[name] === 'object' && dest[name] !== null) {\n dest[name] = Utils.mixin(dest[name], s, copy);\n } else {\n dest[name] = copy(s);\n }\n }\n }\n }\n }\n return dest;\n }\n\n static clone(src) {\n if (!src || typeof src !== 'object') {\n return src; // anything\n }\n let r;\n if (src instanceof Array) {\n // array\n r = [];\n for (let i = 0, l = src.length; i < l; ++i) {\n if (i in src) {\n r.push(Utils.clone(src[i]));\n }\n }\n } else {\n r = {};\n }\n return Utils.mixin(r, src, Utils.clone);\n }\n\n static addAditionalQueryParameterToUrl(url, params) {\n try {\n if (!params || params.length === 0) {\n return url;\n }\n\n let modifiedUrl = new URL(url);\n\n params.forEach((param) => {\n if (param.key && param.value) {\n modifiedUrl.searchParams.set(param.key, param.value);\n }\n });\n\n return modifiedUrl.href;\n\n\n } catch (e) {\n return url;\n }\n }\n\n static parseHttpHeaders(headerStr) {\n let headers = {};\n if (!headerStr) {\n return headers;\n }\n\n // Trim headerStr to fix a MS Edge bug with xhr.getAllResponseHeaders method\n // which send a string starting with a \"\\n\" character\n let headerPairs = headerStr.trim().split('\\u000d\\u000a');\n for (let i = 0, ilen = headerPairs.length; i < ilen; i++) {\n let headerPair = headerPairs[i];\n let index = headerPair.indexOf('\\u003a\\u0020');\n if (index > 0) {\n headers[headerPair.substring(0, index)] = headerPair.substring(index + 2);\n }\n }\n return headers;\n }\n\n static generateUuid() {\n let dt = new Date().getTime();\n const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (dt + Math.random() * 16) % 16 | 0;\n dt = Math.floor(dt / 16);\n return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n return uuid;\n }\n\n static generateHashCode(string) {\n let hash = 0;\n\n if (string.length === 0) {\n return hash;\n }\n\n for (let i = 0; i < string.length; i++) {\n const chr = string.charCodeAt(i);\n hash = ((hash << 5) - hash) + chr;\n hash |= 0;\n }\n return hash;\n }\n\n /**\n * Compares both urls and returns a relative url (target relative to original)\n * @param {string} original\n * @param {string} target\n * @return {string|*}\n */\n static getRelativeUrl(originalUrl, targetUrl) {\n try {\n const original = new URL(originalUrl);\n const target = new URL(targetUrl);\n\n // Unify the protocol to compare the origins\n original.protocol = target.protocol;\n if (original.origin !== target.origin) {\n return targetUrl;\n }\n\n // Use the relative path implementation of the path library. We need to cut off the actual filename in the end to get the relative path\n let relativePath = path.relative(original.pathname.substr(0, original.pathname.lastIndexOf('/')), target.pathname.substr(0, target.pathname.lastIndexOf('/')));\n\n // In case the relative path is empty (both path are equal) return the filename only. Otherwise add a slash in front of the filename\n const startIndexOffset = relativePath.length === 0 ? 1 : 0;\n relativePath += target.pathname.substr(target.pathname.lastIndexOf('/') + startIndexOffset, target.pathname.length - 1);\n\n // Build the other candidate, e.g. the 'host relative' path that starts with \"/\", and return the shortest of the two candidates.\n if (target.pathname.length < relativePath.length) {\n return target.pathname;\n }\n return relativePath;\n } catch (e) {\n return targetUrl\n }\n }\n}\n\nexport default Utils;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @class\n * @ignore\n */\nclass ErrorsBase {\n extend (errors, config) {\n if (!errors) return;\n\n let override = config ? config.override : false;\n let publicOnly = config ? config.publicOnly : false;\n\n\n for (const err in errors) {\n if (!errors.hasOwnProperty(err) || (this[err] && !override)) continue;\n if (publicOnly && errors[err].indexOf('public_') === -1) continue;\n this[err] = errors[err];\n\n }\n }\n}\n\nexport default ErrorsBase;","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @class\n * @ignore\n */\nclass EventsBase {\n extend (events, config) {\n if (!events) return;\n\n let override = config ? config.override : false;\n let publicOnly = config ? config.publicOnly : false;\n\n\n for (const evt in events) {\n if (!events.hasOwnProperty(evt) || (this[evt] && !override)) continue;\n if (publicOnly && events[evt].indexOf('public_') === -1) continue;\n this[evt] = events[evt];\n\n }\n }\n}\n\nexport default EventsBase;","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Constants declaration\n * @class\n * @ignore\n * @hideconstructor\n */\nclass Constants {\n\n init() {\n /**\n * @constant {string} STREAM Stream media type. Mainly used to report metrics relative to the full stream\n * @memberof Constants#\n * @static\n */\n this.STREAM = 'stream';\n\n /**\n * @constant {string} VIDEO Video media type\n * @memberof Constants#\n * @static\n */\n this.VIDEO = 'video';\n\n /**\n * @constant {string} AUDIO Audio media type\n * @memberof Constants#\n * @static\n */\n this.AUDIO = 'audio';\n\n /**\n * @constant {string} TEXT Text media type\n * @memberof Constants#\n * @static\n */\n this.TEXT = 'text';\n\n /**\n * @constant {string} MUXED Muxed (video/audio in the same chunk) media type\n * @memberof Constants#\n * @static\n */\n this.MUXED = 'muxed';\n\n /**\n * @constant {string} IMAGE Image media type\n * @memberof Constants#\n * @static\n */\n this.IMAGE = 'image';\n\n /**\n * @constant {string} STPP STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n this.STPP = 'stpp';\n\n /**\n * @constant {string} TTML STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n this.TTML = 'ttml';\n\n /**\n * @constant {string} VTT STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n this.VTT = 'vtt';\n\n /**\n * @constant {string} WVTT STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n this.WVTT = 'wvtt';\n\n /**\n * @constant {string} ABR_STRATEGY_DYNAMIC Dynamic Adaptive bitrate algorithm\n * @memberof Constants#\n * @static\n */\n this.ABR_STRATEGY_DYNAMIC = 'abrDynamic';\n\n /**\n * @constant {string} ABR_STRATEGY_BOLA Adaptive bitrate algorithm based on Bola (buffer level)\n * @memberof Constants#\n * @static\n */\n this.ABR_STRATEGY_BOLA = 'abrBola';\n\n /**\n * @constant {string} ABR_STRATEGY_L2A Adaptive bitrate algorithm based on L2A (online learning)\n * @memberof Constants#\n * @static\n */\n this.ABR_STRATEGY_L2A = 'abrL2A';\n\n /**\n * @constant {string} ABR_STRATEGY_LoLP Adaptive bitrate algorithm based on LoL+\n * @memberof Constants#\n * @static\n */\n this.ABR_STRATEGY_LoLP = 'abrLoLP';\n\n /**\n * @constant {string} ABR_STRATEGY_THROUGHPUT Adaptive bitrate algorithm based on throughput\n * @memberof Constants#\n * @static\n */\n this.ABR_STRATEGY_THROUGHPUT = 'abrThroughput';\n\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALUCUALTION_DOWNLOADED_DATA Throughput calculation based on downloaded data array\n * @memberof Constants#\n * @static\n */\n this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA = 'abrFetchThroughputCalculationDownloadedData';\n\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING = 'abrFetchThroughputCalculationMoofParsing';\n\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_AAST Throughput calculation based on adjusted availability start time in low latency mode\n * @memberof Constants#\n * @static\n */\n this.ABR_FETCH_THROUGHPUT_CALCULATION_AAST = 'abrFetchThroughputCalculationAAST';\n\n /**\n * @constant {string} LIVE_CATCHUP_MODE_DEFAULT Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n this.LIVE_CATCHUP_MODE_DEFAULT = 'liveCatchupModeDefault';\n\n /**\n * @constant {string} LIVE_CATCHUP_MODE_LOLP Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n this.LIVE_CATCHUP_MODE_LOLP = 'liveCatchupModeLoLP';\n\n /**\n * @constant {string} MOVING_AVERAGE_SLIDING_WINDOW Moving average sliding window\n * @memberof Constants#\n * @static\n */\n this.MOVING_AVERAGE_SLIDING_WINDOW = 'slidingWindow';\n\n /**\n * @constant {string} EWMA Exponential moving average\n * @memberof Constants#\n * @static\n */\n this.MOVING_AVERAGE_EWMA = 'ewma';\n\n /**\n * @constant {string} BAD_ARGUMENT_ERROR Invalid Arguments type of error\n * @memberof Constants#\n * @static\n */\n this.BAD_ARGUMENT_ERROR = 'Invalid Arguments';\n\n /**\n * @constant {string} MISSING_CONFIG_ERROR Missing configuration parameters type of error\n * @memberof Constants#\n * @static\n */\n this.MISSING_CONFIG_ERROR = 'Missing config parameter(s)';\n\n /**\n * @constant {string} TRACK_SWITCH_MODE_ALWAYS_REPLACE used to clear the buffered data (prior to current playback position) after track switch. Default for audio\n * @memberof Constants#\n * @static\n */\n this.TRACK_SWITCH_MODE_ALWAYS_REPLACE = 'alwaysReplace';\n\n /**\n * @constant {string} TRACK_SWITCH_MODE_NEVER_REPLACE used to forbid clearing the buffered data (prior to current playback position) after track switch. Defers to fastSwitchEnabled for placement of new data. Default for video\n * @memberof Constants#\n * @static\n */\n this.TRACK_SWITCH_MODE_NEVER_REPLACE = 'neverReplace';\n\n /**\n * @constant {string} TRACK_SELECTION_MODE_FIRST_TRACK makes the player select the first track found in the manifest.\n * @memberof Constants#\n * @static\n */\n this.TRACK_SELECTION_MODE_FIRST_TRACK = 'firstTrack';\n\n /**\n * @constant {string} TRACK_SELECTION_MODE_HIGHEST_BITRATE makes the player select the track with a highest bitrate. This mode is a default mode.\n * @memberof Constants#\n * @static\n */\n this.TRACK_SELECTION_MODE_HIGHEST_BITRATE = 'highestBitrate';\n\n /**\n * @constant {string} TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY makes the player select the track with the lowest bitrate per pixel average.\n * @memberof Constants#\n * @static\n */\n this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY = 'highestEfficiency';\n\n /**\n * @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with a widest range of bitrates.\n * @memberof Constants#\n * @static\n */\n this.TRACK_SELECTION_MODE_WIDEST_RANGE = 'widestRange';\n\n /**\n * @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with the highest selectionPriority as defined in the manifest\n * @memberof Constants#\n * @static\n */\n this.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY = 'highestSelectionPriority';\n\n /**\n * @constant {string} CMCD_MODE_QUERY specifies to attach CMCD metrics as query parameters.\n * @memberof Constants#\n * @static\n */\n this.CMCD_MODE_QUERY = 'query';\n\n /**\n * @constant {string} CMCD_MODE_HEADER specifies to attach CMCD metrics as HTTP headers.\n * @memberof Constants#\n * @static\n */\n this.CMCD_MODE_HEADER = 'header';\n\n\n this.LOCATION = 'Location';\n this.INITIALIZE = 'initialize';\n this.TEXT_SHOWING = 'showing';\n this.TEXT_HIDDEN = 'hidden';\n this.CC1 = 'CC1';\n this.CC3 = 'CC3';\n this.UTF8 = 'utf-8';\n this.SCHEME_ID_URI = 'schemeIdUri';\n this.START_TIME = 'starttime';\n this.SERVICE_DESCRIPTION_DVB_LL_SCHEME = 'urn:dvb:dash:lowlatency:scope:2019';\n this.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME = 'urn:dvb:dash:lowlatency:critical:2019';\n this.XML = 'XML';\n this.ARRAY_BUFFER = 'ArrayBuffer';\n this.DVB_REPORTING_URL = 'dvb:reportingUrl';\n this.DVB_PROBABILITY = 'dvb:probability';\n this.VIDEO_ELEMENT_READY_STATES = {\n HAVE_NOTHING: 0,\n HAVE_METADATA: 1,\n HAVE_CURRENT_DATA: 2,\n HAVE_FUTURE_DATA: 3,\n HAVE_ENOUGH_DATA: 4\n };\n this.FILE_LOADER_TYPES = {\n FETCH: 'fetch_loader',\n XHR: 'xhr_loader'\n }\n }\n\n constructor() {\n this.init();\n }\n}\n\nconst constants = new Constants();\nexport default constants;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Protection Constants declaration\n * @class\n * @ignore\n */\nclass ProtectionConstants {\n\n init () {\n this.CLEARKEY_KEYSTEM_STRING = 'org.w3.clearkey';\n this.WIDEVINE_KEYSTEM_STRING = 'com.widevine.alpha';\n this.PLAYREADY_KEYSTEM_STRING = 'com.microsoft.playready';\n this.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING = 'com.microsoft.playready.recommendation';\n this.INITIALIZATION_DATA_TYPE_CENC = 'cenc';\n this.INITIALIZATION_DATA_TYPE_KEYIDS = 'keyids'\n this.INITIALIZATION_DATA_TYPE_WEBM = 'webm'\n }\n\n constructor () {\n this.init();\n }\n}\n\nlet constants = new ProtectionConstants();\nexport default constants;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nconst LICENSE_SERVER_MANIFEST_CONFIGURATIONS = {\n attributes: ['Laurl', 'laurl'],\n prefixes: ['clearkey', 'dashif']\n};\n\n/**\n * @class\n * @ignore\n */\nclass CommonEncryption {\n /**\n * Find and return the ContentProtection element in the given array\n * that indicates support for MPEG Common Encryption\n *\n * @param {Array} cpArray array of content protection elements\n * @returns {Object|null} the Common Encryption content protection element or\n * null if one was not found\n */\n static findCencContentProtection(cpArray) {\n let retVal = null;\n for (let i = 0; i < cpArray.length; ++i) {\n let cp = cpArray[i];\n if (cp.schemeIdUri.toLowerCase() === 'urn:mpeg:dash:mp4protection:2011' &&\n (cp.value.toLowerCase() === 'cenc' || cp.value.toLowerCase() === 'cbcs'))\n retVal = cp;\n }\n return retVal;\n }\n\n /**\n * Returns just the data portion of a single PSSH\n *\n * @param {ArrayBuffer} pssh - the PSSH\n * @return {ArrayBuffer} data portion of the PSSH\n */\n static getPSSHData(pssh) {\n let offset = 8; // Box size and type fields\n let view = new DataView(pssh);\n\n // Read version\n let version = view.getUint8(offset);\n\n offset += 20; // Version (1), flags (3), system ID (16)\n\n if (version > 0) {\n offset += 4 + (16 * view.getUint32(offset)); // Key ID count (4) and All key IDs (16*count)\n }\n\n offset += 4; // Data size\n return pssh.slice(offset);\n }\n\n /**\n * Returns the PSSH associated with the given key system from the concatenated\n * list of PSSH boxes in the given initData\n *\n * @param {KeySystem} keySystem the desired\n * key system\n * @param {ArrayBuffer} initData 'cenc' initialization data. Concatenated list of PSSH.\n * @returns {ArrayBuffer|null} The PSSH box data corresponding to the given key system, null if not found\n * or null if a valid association could not be found.\n */\n static getPSSHForKeySystem(keySystem, initData) {\n let psshList = CommonEncryption.parsePSSHList(initData);\n if (keySystem && psshList.hasOwnProperty(keySystem.uuid.toLowerCase())) {\n return psshList[keySystem.uuid.toLowerCase()];\n }\n return null;\n }\n\n /**\n * Parse a standard common encryption PSSH which contains a simple\n * base64-encoding of the init data\n *\n * @param {Object} cpData the ContentProtection element\n * @param {BASE64} BASE64 reference\n * @returns {ArrayBuffer|null} the init data or null if not found\n */\n static parseInitDataFromContentProtection(cpData, BASE64) {\n if ('pssh' in cpData) {\n\n // Remove whitespaces and newlines from pssh text\n cpData.pssh.__text = cpData.pssh.__text.replace(/\\r?\\n|\\r/g, '').replace(/\\s+/g, '');\n\n return BASE64.decodeArray(cpData.pssh.__text).buffer;\n }\n return null;\n }\n\n /**\n * Parses list of PSSH boxes into keysystem-specific PSSH data\n *\n * @param {ArrayBuffer} data - the concatenated list of PSSH boxes as provided by\n * CDM as initialization data when CommonEncryption content is detected\n * @returns {Object|Array} an object that has a property named according to each of\n * the detected key system UUIDs (e.g. 00000000-0000-0000-0000-0000000000)\n * and a ArrayBuffer (the entire PSSH box) as the property value\n */\n static parsePSSHList(data) {\n\n if (data === null || data === undefined)\n return [];\n\n let dv = new DataView(data.buffer || data); // data.buffer first for Uint8Array support\n let done = false;\n let pssh = {};\n\n // TODO: Need to check every data read for end of buffer\n let byteCursor = 0;\n while (!done) {\n\n let size,\n nextBox,\n version,\n systemID;\n let boxStart = byteCursor;\n\n if (byteCursor >= dv.buffer.byteLength)\n break;\n\n /* Box size */\n size = dv.getUint32(byteCursor);\n nextBox = byteCursor + size;\n byteCursor += 4;\n\n /* Verify PSSH */\n if (dv.getUint32(byteCursor) !== 0x70737368) {\n byteCursor = nextBox;\n continue;\n }\n byteCursor += 4;\n\n /* Version must be 0 or 1 */\n version = dv.getUint8(byteCursor);\n if (version !== 0 && version !== 1) {\n byteCursor = nextBox;\n continue;\n }\n byteCursor++;\n\n byteCursor += 3; /* skip flags */\n\n // 16-byte UUID/SystemID\n systemID = '';\n let i, val;\n for (i = 0; i < 4; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += (val.length === 1) ? '0' + val : val;\n }\n byteCursor += 4;\n systemID += '-';\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += (val.length === 1) ? '0' + val : val;\n }\n byteCursor += 2;\n systemID += '-';\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += (val.length === 1) ? '0' + val : val;\n }\n byteCursor += 2;\n systemID += '-';\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += (val.length === 1) ? '0' + val : val;\n }\n byteCursor += 2;\n systemID += '-';\n for (i = 0; i < 6; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += (val.length === 1) ? '0' + val : val;\n }\n byteCursor += 6;\n\n systemID = systemID.toLowerCase();\n\n /* PSSH Data Size */\n byteCursor += 4;\n\n /* PSSH Data */\n pssh[systemID] = dv.buffer.slice(boxStart, nextBox);\n byteCursor = nextBox;\n }\n\n return pssh;\n }\n\n static getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri) {\n try {\n\n if (!mediaInfo || mediaInfo.length === 0) {\n return null;\n }\n\n let i = 0;\n let licenseServer = null;\n\n while (i < mediaInfo.length && !licenseServer) {\n const info = mediaInfo[i];\n\n if (info && info.contentProtection && info.contentProtection.length > 0) {\n const targetProtectionData = info.contentProtection.filter((cp) => {\n return cp.schemeIdUri && cp.schemeIdUri === schemeIdUri;\n });\n\n if (targetProtectionData && targetProtectionData.length > 0) {\n let j = 0;\n while (j < targetProtectionData.length && !licenseServer) {\n const ckData = targetProtectionData[j];\n let k = 0;\n while (k < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes.length && !licenseServer) {\n let l = 0;\n const attribute = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes[k];\n while (l < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes.length && !licenseServer) {\n const prefix = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes[l];\n if (ckData[attribute] && ckData[attribute].__prefix && ckData[attribute].__prefix === prefix && ckData[attribute].__text) {\n licenseServer = ckData[attribute].__text;\n }\n l += 1;\n }\n k += 1;\n }\n j += 1;\n }\n }\n }\n i += 1;\n }\n return licenseServer;\n } catch (e) {\n return null;\n }\n }\n}\n\nexport default CommonEncryption;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\nimport ProtectionController from './controllers/ProtectionController';\nimport ProtectionKeyController from './controllers/ProtectionKeyController';\nimport ProtectionEvents from './ProtectionEvents';\nimport ProtectionErrors from './errors/ProtectionErrors';\nimport ProtectionModel_21Jan2015 from './models/ProtectionModel_21Jan2015';\nimport ProtectionModel_3Feb2014 from './models/ProtectionModel_3Feb2014';\nimport ProtectionModel_01b from './models/ProtectionModel_01b';\n\nconst APIS_ProtectionModel_01b = [\n // Un-prefixed as per spec\n {\n // Video Element\n generateKeyRequest: 'generateKeyRequest',\n addKey: 'addKey',\n cancelKeyRequest: 'cancelKeyRequest',\n\n // Events\n needkey: 'needkey',\n keyerror: 'keyerror',\n keyadded: 'keyadded',\n keymessage: 'keymessage'\n },\n // Webkit-prefixed (early Chrome versions and Chrome with EME disabled in chrome://flags)\n {\n // Video Element\n generateKeyRequest: 'webkitGenerateKeyRequest',\n addKey: 'webkitAddKey',\n cancelKeyRequest: 'webkitCancelKeyRequest',\n\n // Events\n needkey: 'webkitneedkey',\n keyerror: 'webkitkeyerror',\n keyadded: 'webkitkeyadded',\n keymessage: 'webkitkeymessage'\n }\n];\n\nconst APIS_ProtectionModel_3Feb2014 = [\n // Un-prefixed as per spec\n // Chrome 38-39 (and some earlier versions) with chrome://flags -- Enable Encrypted Media Extensions\n {\n // Video Element\n setMediaKeys: 'setMediaKeys',\n // MediaKeys\n MediaKeys: 'MediaKeys',\n // MediaKeySession\n release: 'close',\n\n // Events\n needkey: 'needkey',\n error: 'keyerror',\n message: 'keymessage',\n ready: 'keyadded',\n close: 'keyclose'\n },\n // MS-prefixed (IE11, Windows 8.1)\n {\n // Video Element\n setMediaKeys: 'msSetMediaKeys',\n // MediaKeys\n MediaKeys: 'MSMediaKeys',\n // MediaKeySession\n release: 'close',\n // Events\n needkey: 'msneedkey',\n error: 'mskeyerror',\n message: 'mskeymessage',\n ready: 'mskeyadded',\n close: 'mskeyclose'\n }\n];\n\nfunction Protection() {\n let instance;\n const context = this.context;\n\n /**\n * Create a ProtectionController and associated ProtectionModel for use with\n * a single piece of content.\n *\n * @param {Object} config\n * @return {ProtectionController} protection controller\n *\n */\n function createProtectionSystem(config) {\n let controller = null;\n\n const protectionKeyController = ProtectionKeyController(context).getInstance();\n protectionKeyController.setConfig({ debug: config.debug, BASE64: config.BASE64, settings: config.settings });\n protectionKeyController.initialize();\n\n let protectionModel = _getProtectionModel(config);\n\n if (!controller && protectionModel) {//TODO add ability to set external controller if still needed at all?\n controller = ProtectionController(context).create({\n protectionModel: protectionModel,\n protectionKeyController: protectionKeyController,\n eventBus: config.eventBus,\n debug: config.debug,\n events: config.events,\n BASE64: config.BASE64,\n constants: config.constants,\n cmcdModel: config.cmcdModel,\n customParametersModel : config.customParametersModel,\n settings: config.settings\n });\n config.capabilities.setEncryptedMediaSupported(true);\n }\n return controller;\n }\n\n function _getProtectionModel(config) {\n const debug = config.debug;\n const logger = debug.getLogger(instance);\n const eventBus = config.eventBus;\n const errHandler = config.errHandler;\n const videoElement = config.videoModel ? config.videoModel.getElement() : null;\n\n if ((!videoElement || videoElement.onencrypted !== undefined) &&\n (!videoElement || videoElement.mediaKeys !== undefined)) {\n logger.info('EME detected on this user agent! (ProtectionModel_21Jan2015)');\n return ProtectionModel_21Jan2015(context).create({ debug: debug, eventBus: eventBus, events: config.events });\n } else if (_getAPI(videoElement, APIS_ProtectionModel_3Feb2014)) {\n logger.info('EME detected on this user agent! (ProtectionModel_3Feb2014)');\n return ProtectionModel_3Feb2014(context).create({ debug: debug, eventBus: eventBus, events: config.events, api: _getAPI(videoElement, APIS_ProtectionModel_3Feb2014) });\n } else if (_getAPI(videoElement, APIS_ProtectionModel_01b)) {\n logger.info('EME detected on this user agent! (ProtectionModel_01b)');\n return ProtectionModel_01b(context).create({ debug: debug, eventBus: eventBus, errHandler: errHandler, events: config.events, api: _getAPI(videoElement, APIS_ProtectionModel_01b) });\n } else {\n logger.warn('No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!');\n return null;\n }\n }\n\n function _getAPI(videoElement, apis) {\n for (let i = 0; i < apis.length; i++) {\n const api = apis[i];\n // detect if api is supported by browser\n // check only first function in api -> should be fine\n if (typeof videoElement[api[Object.keys(api)[0]]] !== 'function') {\n continue;\n }\n\n return api;\n }\n\n return null;\n }\n\n instance = {\n createProtectionSystem\n };\n\n return instance;\n}\n\nProtection.__dashjs_factory_name = 'Protection';\nconst factory = dashjs.FactoryMaker.getClassFactory(Protection); /* jshint ignore:line */\nfactory.events = ProtectionEvents;\nfactory.errors = ProtectionErrors;\ndashjs.FactoryMaker.updateClassFactory(Protection.__dashjs_factory_name, factory); /* jshint ignore:line */\nexport default factory;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\nimport EventsBase from '../../core/events/EventsBase';\n/**\n * @class\n */\nclass ProtectionEvents extends EventsBase {\n /**\n * @description Public facing external events to be used when including protection package.\n * All public events will be aggregated into the MediaPlayerEvents Class and can be accessed\n * via MediaPlayer.events. public_ is the prefix that we use to move event names to MediaPlayerEvents.\n */\n constructor () {\n super();\n\n /**\n * Event ID for events delivered when the protection set receives\n * a key message from the CDM\n *\n * @ignore\n */\n this.INTERNAL_KEY_MESSAGE = 'internalKeyMessage';\n\n /**\n * Event ID for events delivered when the status of one decryption keys has changed\n * @ignore\n */\n this.INTERNAL_KEY_STATUS_CHANGED = 'internalkeyStatusChanged';\n\n /**\n * Event ID for events delivered when a new key has been added\n *\n * @constant\n * @deprecated The latest versions of the EME specification no longer\n * use this event. {@MediaPlayer.models.protectionModel.eventList.KEY_STATUSES_CHANGED}\n * is preferred.\n * @event ProtectionEvents#KEY_ADDED\n */\n this.KEY_ADDED = 'public_keyAdded';\n /**\n * Event ID for events delivered when an error is encountered by the CDM\n * while processing a license server response message\n * @event ProtectionEvents#KEY_ERROR\n */\n this.KEY_ERROR = 'public_keyError';\n\n /**\n * Event ID for events delivered when the protection set receives\n * a key message from the CDM\n * @event ProtectionEvents#KEY_MESSAGE\n */\n this.KEY_MESSAGE = 'public_keyMessage';\n\n /**\n * Event ID for events delivered when a key session close\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_CLOSED\n */\n this.KEY_SESSION_CLOSED = 'public_keySessionClosed';\n\n /**\n * Event ID for events delivered when a new key sessions creation\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_CREATED\n */\n this.KEY_SESSION_CREATED = 'public_keySessionCreated';\n\n /**\n * Event ID for events delivered when a key session removal\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_REMOVED\n */\n this.KEY_SESSION_REMOVED = 'public_keySessionRemoved';\n\n /**\n * Event ID for events delivered when the status of one or more\n * decryption keys has changed\n * @event ProtectionEvents#KEY_STATUSES_CHANGED\n */\n this.KEY_STATUSES_CHANGED = 'public_keyStatusesChanged';\n\n /**\n * Event ID for events delivered when a key system access procedure\n * has completed\n * @ignore\n */\n this.KEY_SYSTEM_ACCESS_COMPLETE = 'public_keySystemAccessComplete';\n\n /**\n * Event ID for events delivered when a key system selection procedure\n * completes\n * @event ProtectionEvents#KEY_SYSTEM_SELECTED\n */\n this.KEY_SYSTEM_SELECTED = 'public_keySystemSelected';\n\n /**\n * Event ID for events delivered when a license request procedure\n * has completed\n * @event ProtectionEvents#LICENSE_REQUEST_COMPLETE\n */\n this.LICENSE_REQUEST_COMPLETE = 'public_licenseRequestComplete';\n\n /**\n * Sending a license rquest\n * @event ProtectionEvents#LICENSE_REQUEST_SENDING\n */\n this.LICENSE_REQUEST_SENDING = 'public_licenseRequestSending';\n\n /**\n * Event ID for needkey/encrypted events\n * @ignore\n */\n this.NEED_KEY = 'needkey';\n\n /**\n * Event ID for events delivered when the Protection system is detected and created.\n * @event ProtectionEvents#PROTECTION_CREATED\n */\n this.PROTECTION_CREATED = 'public_protectioncreated';\n\n /**\n * Event ID for events delivered when the Protection system is destroyed.\n * @event ProtectionEvents#PROTECTION_DESTROYED\n */\n this.PROTECTION_DESTROYED = 'public_protectiondestroyed';\n\n /**\n * Event ID for events delivered when a new server certificate has\n * been delivered to the CDM\n * @ignore\n */\n this.SERVER_CERTIFICATE_UPDATED = 'serverCertificateUpdated';\n\n /**\n * Event ID for events delivered when the process of shutting down\n * a protection set has completed\n * @ignore\n */\n this.TEARDOWN_COMPLETE = 'protectionTeardownComplete';\n\n /**\n * Event ID for events delivered when a HTMLMediaElement has been\n * associated with the protection set\n * @ignore\n */\n this.VIDEO_ELEMENT_SELECTED = 'videoElementSelected';\n\n /**\n * Triggered when the key session has been updated successfully\n * @ignore\n */\n this.KEY_SESSION_UPDATED = 'public_keySessionUpdated';\n }\n}\n\nlet protectionEvents = new ProtectionEvents();\nexport default protectionEvents;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport CommonEncryption from '../CommonEncryption';\nimport MediaCapability from '../vo/MediaCapability';\nimport KeySystemConfiguration from '../vo/KeySystemConfiguration';\nimport ProtectionErrors from '../errors/ProtectionErrors';\nimport DashJSError from '../../vo/DashJSError';\nimport LicenseRequest from '../vo/LicenseRequest';\nimport LicenseResponse from '../vo/LicenseResponse';\nimport {HTTPRequest} from '../../vo/metrics/HTTPRequest';\nimport Utils from '../../../core/Utils';\nimport Constants from '../../constants/Constants';\nimport FactoryMaker from '../../../core/FactoryMaker';\n\nconst NEEDKEY_BEFORE_INITIALIZE_RETRIES = 5;\nconst NEEDKEY_BEFORE_INITIALIZE_TIMEOUT = 500;\n\nconst LICENSE_SERVER_REQUEST_RETRIES = 3;\nconst LICENSE_SERVER_REQUEST_RETRY_INTERVAL = 1000;\nconst LICENSE_SERVER_REQUEST_DEFAULT_TIMEOUT = 8000;\n\n/**\n * @module ProtectionController\n * @description Provides access to media protection information and functionality. Each\n * ProtectionController manages a single {@link MediaPlayer.models.ProtectionModel}\n * which encapsulates a set of protection information (EME APIs, selected key system,\n * key sessions). The APIs of ProtectionController mostly align with the latest EME\n * APIs. Key system selection is mostly automated when combined with app-overrideable\n * functionality provided in {@link ProtectionKeyController}.\n * @todo ProtectionController does almost all of its tasks automatically after init() is\n * called. Applications might want more control over this process and want to go through\n * each step manually (key system selection, session creation, session maintenance).\n * This module can be accessed using the MediaPlayer API getProtectionController()\n * @param {Object} config\n */\n\nfunction ProtectionController(config) {\n\n config = config || {};\n const protectionKeyController = config.protectionKeyController;\n let protectionModel = config.protectionModel;\n const eventBus = config.eventBus;\n const events = config.events;\n const debug = config.debug;\n const BASE64 = config.BASE64;\n const constants = config.constants;\n let needkeyRetries = [];\n const cmcdModel = config.cmcdModel;\n const settings = config.settings;\n const customParametersModel = config.customParametersModel;\n\n let instance,\n logger,\n pendingKeySystemData,\n mediaInfoArr,\n protDataSet,\n sessionType,\n robustnessLevel,\n selectedKeySystem,\n keySystemSelectionInProgress,\n licenseXhrRequest,\n licenseRequestRetryTimeout;\n\n function setup() {\n logger = debug.getLogger(instance);\n pendingKeySystemData = [];\n mediaInfoArr = [];\n sessionType = 'temporary';\n robustnessLevel = '';\n licenseXhrRequest = null;\n licenseRequestRetryTimeout = null;\n eventBus.on(events.INTERNAL_KEY_MESSAGE, _onKeyMessage, instance);\n eventBus.on(events.INTERNAL_KEY_STATUS_CHANGED, _onKeyStatusChanged, instance);\n }\n\n function checkConfig() {\n if (!eventBus || !eventBus.hasOwnProperty('on') || !protectionKeyController || !protectionKeyController.hasOwnProperty('getSupportedKeySystemsFromContentProtection')) {\n throw new Error('Missing config parameter(s)');\n }\n }\n\n /**\n * Initialize this protection system for a given media type.\n *\n * @param {StreamInfo} [mediaInfo] Media information\n * @memberof module:ProtectionController\n * @instance\n */\n function initializeForMedia(mediaInfo) {\n // Not checking here if a session for similar KS/KID combination is already created\n // because still don't know which keysystem will be selected.\n // Once Keysystem is selected and before creating the session, we will do that check\n // so we create the strictly necessary DRM sessions\n if (!mediaInfo) {\n throw new Error('mediaInfo can not be null or undefined');\n }\n\n checkConfig();\n\n mediaInfoArr.push(mediaInfo);\n\n // ContentProtection elements are specified at the AdaptationSet level, so the CP for audio\n // and video will be the same. Just use one valid MediaInfo object\n let supportedKS = protectionKeyController.getSupportedKeySystemsFromContentProtection(mediaInfo.contentProtection, protDataSet, sessionType);\n\n if (supportedKS && supportedKS.length > 0) {\n _selectKeySystem(supportedKS, true);\n }\n }\n\n /**\n * Selects a key system if we dont have any one yet. Otherwise we use the existing key system and trigger a new license request if the initdata has changed\n * @param {array} supportedKS\n * @param {boolean} fromManifest\n * @private\n */\n function _selectKeySystem(supportedKS, fromManifest) {\n\n // We are in the process of selecting a key system, so just save the data which might be coming from additional AdaptationSets.\n if (keySystemSelectionInProgress) {\n pendingKeySystemData.push(supportedKS);\n }\n\n // First time, so we need to select a key system\n else if (!selectedKeySystem) {\n _selectInitialKeySystem(supportedKS, fromManifest);\n }\n\n // We already selected a key system. We only need to trigger a new license exchange if the init data has changed\n else if (selectedKeySystem) {\n _initiateWithExistingKeySystem(supportedKS);\n }\n }\n\n /**\n * We do not have a key system yet. Select one\n * @param {array} supportedKS\n * @param {boolean} fromManifest\n * @private\n */\n function _selectInitialKeySystem(supportedKS, fromManifest) {\n keySystemSelectionInProgress = true;\n const requestedKeySystems = [];\n\n // Reorder key systems according to priority order provided in protectionData\n supportedKS = supportedKS.sort((ksA, ksB) => {\n let indexA = (protDataSet && protDataSet[ksA.ks.systemString] && protDataSet[ksA.ks.systemString].priority >= 0) ? protDataSet[ksA.ks.systemString].priority : supportedKS.length;\n let indexB = (protDataSet && protDataSet[ksB.ks.systemString] && protDataSet[ksB.ks.systemString].priority >= 0) ? protDataSet[ksB.ks.systemString].priority : supportedKS.length;\n return indexA - indexB;\n });\n\n pendingKeySystemData.push(supportedKS);\n\n // Add all key systems to our request list since we have yet to select a key system\n for (let i = 0; i < supportedKS.length; i++) {\n const keySystemConfiguration = _getKeySystemConfiguration(supportedKS[i]);\n requestedKeySystems.push({\n ks: supportedKS[i].ks,\n configs: [keySystemConfiguration],\n protData: supportedKS[i].protData\n });\n }\n\n let keySystemAccess;\n\n protectionModel.requestKeySystemAccess(requestedKeySystems)\n .then((event) => {\n keySystemAccess = event.data;\n let selectedSystemString = keySystemAccess.mksa && keySystemAccess.mksa.selectedSystemString ? keySystemAccess.mksa.selectedSystemString : keySystemAccess.keySystem.systemString;\n logger.info('DRM: KeySystem Access Granted for system string (' + selectedSystemString + ')! Selecting key system...');\n return protectionModel.selectKeySystem(keySystemAccess);\n })\n .then((keySystem) => {\n selectedKeySystem = keySystem;\n keySystemSelectionInProgress = false;\n\n if (!protectionModel) {\n return;\n }\n\n eventBus.trigger(events.KEY_SYSTEM_SELECTED, { data: keySystemAccess });\n\n // Set server certificate from protData\n const protData = _getProtDataForKeySystem(selectedKeySystem);\n if (protData && protData.serverCertificate && protData.serverCertificate.length > 0) {\n protectionModel.setServerCertificate(BASE64.decodeArray(protData.serverCertificate).buffer);\n }\n\n // Create key sessions for the different AdaptationSets\n let ksIdx;\n for (let i = 0; i < pendingKeySystemData.length; i++) {\n for (ksIdx = 0; ksIdx < pendingKeySystemData[i].length; ksIdx++) {\n if (selectedKeySystem === pendingKeySystemData[i][ksIdx].ks) {\n const current = pendingKeySystemData[i][ksIdx]\n _loadOrCreateKeySession(current)\n break;\n }\n }\n }\n })\n .catch((event) => {\n selectedKeySystem = null;\n keySystemSelectionInProgress = false;\n if (!fromManifest) {\n eventBus.trigger(events.KEY_SYSTEM_SELECTED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE, ProtectionErrors.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE + 'Error selecting key system! -- ' + event.error)\n });\n }\n })\n }\n\n /**\n * If we have already selected a keysytem we only need to create a new key session and issue a new license request if the init data has changed.\n * @param {array} supportedKS\n * @private\n */\n function _initiateWithExistingKeySystem(supportedKS) {\n const ksIdx = supportedKS.findIndex((entry) => {\n return entry.ks === selectedKeySystem;\n });\n\n const current = supportedKS[ksIdx];\n if (ksIdx === -1 || !current.initData) {\n return;\n }\n\n _loadOrCreateKeySession(current);\n }\n\n /**\n * Loads an existing key session if we already have a session id. Otherwise we create a new key session\n * @param {object} keySystemInfo\n * @private\n */\n function _loadOrCreateKeySession(keySystemInfo) {\n // Clearkey\n if (protectionKeyController.isClearKey(selectedKeySystem)) {\n // For Clearkey: if parameters for generating init data was provided by the user, use them for generating\n // initData and overwrite possible initData indicated in encrypted event (EME)\n if (keySystemInfo.protData && keySystemInfo.protData.hasOwnProperty('clearkeys') && Object.keys(keySystemInfo.protData.clearkeys).length !== 0) {\n const initData = { kids: Object.keys(keySystemInfo.protData.clearkeys) };\n keySystemInfo.initData = new TextEncoder().encode(JSON.stringify(initData));\n }\n }\n\n // Reuse existing KeySession\n if (keySystemInfo.sessionId) {\n // Load MediaKeySession with sessionId\n loadKeySession(keySystemInfo);\n }\n\n // Create a new KeySession\n else if (keySystemInfo.initData !== null) {\n // Create new MediaKeySession with initData\n createKeySession(keySystemInfo);\n }\n }\n\n /**\n * Loads a key session with the given session ID from persistent storage. This essentially creates a new key session\n *\n * @param {object} ksInfo\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionCreated\n * @ignore\n */\n function loadKeySession(keySystemInfo) {\n checkConfig();\n protectionModel.loadKeySession(keySystemInfo);\n }\n\n /**\n * Create a new key session associated with the given initialization data from the MPD or from the PSSH box in the media\n * For the latest version of the EME a request is generated. Once this request is ready we get notified via the INTERNAL_KEY_MESSAGE event\n * @param {ArrayBuffer} initData the initialization data\n * @param {Uint8Array} cdmData the custom data to provide to licenser\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionCreated\n * @ignore\n */\n function createKeySession(keySystemInfo) {\n const initDataForKS = CommonEncryption.getPSSHForKeySystem(selectedKeySystem, keySystemInfo ? keySystemInfo.initData : null);\n\n if (initDataForKS) {\n\n // Check for duplicate key id\n if (_isKeyIdDuplicate(keySystemInfo.keyId)) {\n return;\n }\n\n // Check for duplicate initData\n if (_isInitDataDuplicate(initDataForKS)) {\n return;\n }\n\n try {\n keySystemInfo.initData = initDataForKS;\n protectionModel.createKeySession(keySystemInfo);\n } catch (error) {\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE, ProtectionErrors.KEY_SESSION_CREATED_ERROR_MESSAGE + error.message)\n });\n }\n } else if (keySystemInfo && keySystemInfo.initData) {\n protectionModel.createKeySession(keySystemInfo);\n } else {\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE, ProtectionErrors.KEY_SESSION_CREATED_ERROR_MESSAGE + 'Selected key system is ' + (selectedKeySystem ? selectedKeySystem.systemString : null) + '. needkey/encrypted event contains no initData corresponding to that key system!')\n });\n }\n }\n\n /**\n * Returns the protectionData for a specific keysystem as specified by the application.\n * @param {object} keySystem\n * @return {object | null}\n * @private\n */\n function _getProtDataForKeySystem(keySystem) {\n if (keySystem) {\n const keySystemString = keySystem.systemString;\n\n if (protDataSet) {\n return (keySystemString in protDataSet) ? protDataSet[keySystemString] : null;\n }\n }\n return null;\n }\n\n /**\n * Removes all entries from the mediaInfoArr\n */\n function clearMediaInfoArray() {\n mediaInfoArr = [];\n }\n\n /**\n * Returns a set of supported key systems and CENC initialization data\n * from the given array of ContentProtection elements. Only\n * key systems that are supported by this player will be returned.\n * Key systems are returned in priority order (highest first).\n *\n * @param {Array.<Object>} cps - array of content protection elements parsed\n * from the manifest\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n * @ignore\n */\n function getSupportedKeySystemsFromContentProtection(cps) {\n checkConfig();\n return protectionKeyController.getSupportedKeySystemsFromContentProtection(cps, protDataSet, sessionType);\n }\n\n /**\n * Checks if a session has already created for the provided key id\n * @param {string} keyId\n * @return {boolean}\n * @private\n */\n function _isKeyIdDuplicate(keyId) {\n\n if (!keyId) {\n return false;\n }\n\n try {\n const sessions = protectionModel.getSessions();\n for (let i = 0; i < sessions.length; i++) {\n if (sessions[i].getKeyId() === keyId) {\n return true;\n }\n }\n return false;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Checks if the provided init data is equal to one of the existing init data values\n * @param {any} initDataForKS\n * @return {boolean}\n * @private\n */\n function _isInitDataDuplicate(initDataForKS) {\n\n if (!initDataForKS) {\n return false;\n }\n\n try {\n const currentInitData = protectionModel.getAllInitData();\n for (let i = 0; i < currentInitData.length; i++) {\n if (protectionKeyController.initDataEquals(initDataForKS, currentInitData[i])) {\n logger.debug('DRM: Ignoring initData because we have already seen it!');\n return true;\n }\n }\n\n return false;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Removes the given key session from persistent storage and closes the session\n * as if {@link ProtectionController#closeKeySession}\n * was called\n *\n * @param {SessionToken} sessionToken the session\n * token\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionRemoved\n * @fires ProtectionController#KeySessionClosed\n * @ignore\n */\n function removeKeySession(sessionToken) {\n checkConfig();\n protectionModel.removeKeySession(sessionToken);\n }\n\n /**\n * Closes the key session and releases all associated decryption keys. These\n * keys will no longer be available for decrypting media\n *\n * @param {SessionToken} sessionToken the session\n * token\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionClosed\n * @ignore\n */\n function closeKeySession(sessionToken) {\n checkConfig();\n protectionModel.closeKeySession(sessionToken);\n }\n\n /**\n * Sets a server certificate for use by the CDM when signing key messages\n * intended for a particular license server. This will fire\n * an error event if a key system has not yet been selected.\n *\n * @param {ArrayBuffer} serverCertificate a CDM-specific license server\n * certificate\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#ServerCertificateUpdated\n */\n function setServerCertificate(serverCertificate) {\n checkConfig();\n protectionModel.setServerCertificate(serverCertificate);\n }\n\n /**\n * Associate this protection system with the given HTMLMediaElement. This\n * causes the system to register for needkey/encrypted events from the given\n * element and provides a destination for setting of MediaKeys\n *\n * @param {HTMLMediaElement} element the media element to which the protection\n * system should be associated\n * @memberof module:ProtectionController\n * @instance\n */\n function setMediaElement(element) {\n checkConfig();\n if (element) {\n protectionModel.setMediaElement(element);\n eventBus.on(events.NEED_KEY, _onNeedKey, instance);\n } else if (element === null) {\n protectionModel.setMediaElement(element);\n eventBus.off(events.NEED_KEY, _onNeedKey, instance);\n }\n }\n\n /**\n * Sets the session type to use when creating key sessions. Either \"temporary\" or\n * \"persistent-license\". Default is \"temporary\".\n *\n * @param {string} value the session type\n * @memberof module:ProtectionController\n * @instance\n */\n function setSessionType(value) {\n sessionType = value;\n }\n\n /**\n * Sets the robustness level for video and audio capabilities. Optional to remove Chrome warnings.\n * Possible values are SW_SECURE_CRYPTO, SW_SECURE_DECODE, HW_SECURE_CRYPTO, HW_SECURE_CRYPTO, HW_SECURE_DECODE, HW_SECURE_ALL.\n *\n * @param {string} level the robustness level\n * @memberof module:ProtectionController\n * @instance\n */\n function setRobustnessLevel(level) {\n robustnessLevel = level;\n }\n\n /**\n * Attach KeySystem-specific data to use for license acquisition with EME\n *\n * @param {Object} data an object containing property names corresponding to\n * key system name strings (e.g. \"org.w3.clearkey\") and associated values\n * being instances of {@link ProtectionData}\n * @memberof module:ProtectionController\n * @instance\n * @ignore\n */\n function setProtectionData(data) {\n protDataSet = data;\n protectionKeyController.setProtectionData(data);\n }\n\n /**\n * Stop method is called when current playback is stopped/resetted.\n *\n * @memberof module:ProtectionController\n * @instance\n */\n function stop() {\n _abortLicenseRequest();\n if (protectionModel) {\n protectionModel.stop();\n }\n }\n\n /**\n * Destroys all protection data associated with this protection set. This includes\n * deleting all key sessions. In the case of persistent key sessions, the sessions\n * will simply be unloaded and not deleted. Additionally, if this protection set is\n * associated with a HTMLMediaElement, it will be detached from that element.\n *\n * @memberof module:ProtectionController\n * @instance\n * @ignore\n */\n function reset() {\n eventBus.off(events.INTERNAL_KEY_MESSAGE, _onKeyMessage, instance);\n eventBus.off(events.INTERNAL_KEY_STATUS_CHANGED, _onKeyStatusChanged, instance);\n\n checkConfig();\n\n _abortLicenseRequest();\n\n setMediaElement(null);\n\n selectedKeySystem = null;\n keySystemSelectionInProgress = false;\n\n if (protectionModel) {\n protectionModel.reset();\n protectionModel = null;\n }\n\n needkeyRetries.forEach(retryTimeout => clearTimeout(retryTimeout));\n needkeyRetries = [];\n\n mediaInfoArr = [];\n pendingKeySystemData = [];\n }\n\n /**\n * Returns an object corresponding to the EME MediaKeySystemConfiguration dictionary\n * @param {object} keySystem\n * @return {KeySystemConfiguration}\n * @private\n */\n function _getKeySystemConfiguration(keySystemData) {\n const protData = keySystemData.protData;\n const audioCapabilities = [];\n const videoCapabilities = [];\n const audioRobustness = (protData && protData.audioRobustness && protData.audioRobustness.length > 0) ? protData.audioRobustness : robustnessLevel;\n const videoRobustness = (protData && protData.videoRobustness && protData.videoRobustness.length > 0) ? protData.videoRobustness : robustnessLevel;\n const ksSessionType = keySystemData.sessionType;\n const distinctiveIdentifier = (protData && protData.distinctiveIdentifier) ? protData.distinctiveIdentifier : 'optional';\n const persistentState = (protData && protData.persistentState) ? protData.persistentState : (ksSessionType === 'temporary') ? 'optional' : 'required';\n\n mediaInfoArr.forEach((media) => {\n if (media.type === constants.AUDIO) {\n audioCapabilities.push(new MediaCapability(media.codec, audioRobustness));\n } else if (media.type === constants.VIDEO) {\n videoCapabilities.push(new MediaCapability(media.codec, videoRobustness));\n }\n });\n\n return new KeySystemConfiguration(\n audioCapabilities, videoCapabilities, distinctiveIdentifier,\n persistentState,\n [ksSessionType]);\n }\n\n /**\n * Event handler for when the status of the key has changed\n * @param {object} e\n * @private\n */\n function _onKeyStatusChanged(e) {\n if (e.error) {\n eventBus.trigger(events.KEY_STATUSES_CHANGED, { data: null, error: e.error });\n } else {\n logger.debug('DRM: key status = ' + e.status);\n }\n }\n\n /**\n * Event handler for the key message event. Once we have a key message we can issue a license request\n * @param {object} e\n * @private\n */\n function _onKeyMessage(e) {\n logger.debug('DRM: onKeyMessage');\n\n // Dispatch event to applications indicating we received a key message\n const keyMessage = e.data;\n eventBus.trigger(events.KEY_MESSAGE, { data: keyMessage });\n const messageType = (keyMessage.messageType) ? keyMessage.messageType : 'license-request';\n const message = keyMessage.message;\n const sessionToken = keyMessage.sessionToken;\n const protData = _getProtDataForKeySystem(selectedKeySystem);\n const licenseServerModelInstance = protectionKeyController.getLicenseServerModelInstance(selectedKeySystem, protData, messageType);\n const eventData = { sessionToken: sessionToken, messageType: messageType };\n\n // Ensure message from CDM is not empty\n if (!message || message.byteLength === 0) {\n _sendLicenseRequestCompleteEvent(eventData, new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE, ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE));\n return;\n }\n\n // Message not destined for license server\n if (!licenseServerModelInstance) {\n logger.debug('DRM: License server request not required for this message (type = ' + e.data.messageType + '). Session ID = ' + sessionToken.getSessionId());\n _sendLicenseRequestCompleteEvent(eventData);\n return;\n }\n\n // Perform any special handling for ClearKey\n if (protectionKeyController.isClearKey(selectedKeySystem)) {\n const clearkeys = protectionKeyController.processClearKeyLicenseRequest(selectedKeySystem, protData, message);\n if (clearkeys && clearkeys.keyPairs && clearkeys.keyPairs.length > 0) {\n logger.debug('DRM: ClearKey license request handled by application!');\n _sendLicenseRequestCompleteEvent(eventData);\n protectionModel.updateKeySession(sessionToken, clearkeys);\n return;\n }\n }\n\n // In all other cases we have to make a license request\n _issueLicenseRequest(keyMessage, licenseServerModelInstance, protData);\n }\n\n /**\n * Notify other classes that the license request was completed\n * @param {object} data\n * @param {object} error\n * @private\n */\n function _sendLicenseRequestCompleteEvent(data, error) {\n eventBus.trigger(events.LICENSE_REQUEST_COMPLETE, { data: data, error: error });\n }\n\n /**\n * Start issuing a license request\n * @param {object} keyMessage\n * @param {object} licenseServerData\n * @param {object} protData\n * @private\n */\n function _issueLicenseRequest(keyMessage, licenseServerData, protData) {\n const sessionToken = keyMessage.sessionToken;\n const messageType = (keyMessage.messageType) ? keyMessage.messageType : 'license-request';\n const eventData = { sessionToken: sessionToken, messageType: messageType };\n const keySystemString = selectedKeySystem ? selectedKeySystem.systemString : null;\n\n // Determine license server URL\n let url = _getLicenseServerUrl(protData, messageType, sessionToken, keyMessage, licenseServerData);\n\n // Ensure valid license server URL\n if (!url) {\n _sendLicenseRequestCompleteEvent(eventData, new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE, ProtectionErrors.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));\n return;\n }\n\n // Set optional XMLHttpRequest headers from protection data and message\n const reqHeaders = {};\n let withCredentials = false;\n if (protData) {\n _updateHeaders(reqHeaders, protData.httpRequestHeaders);\n }\n const message = keyMessage.message;\n const headersFromMessage = selectedKeySystem.getRequestHeadersFromMessage(message);\n _updateHeaders(reqHeaders, headersFromMessage);\n\n Object.keys(reqHeaders).forEach((key) => {\n if ('authorization' === key.toLowerCase()) {\n withCredentials = true;\n }\n });\n\n // Overwrite withCredentials property from protData if present\n if (protData && typeof protData.withCredentials == 'boolean') {\n withCredentials = protData.withCredentials;\n }\n\n const onLoad = function (xhr) {\n if (!protectionModel) {\n return;\n }\n\n if (xhr.status >= 200 && xhr.status <= 299) {\n const responseHeaders = Utils.parseHttpHeaders(xhr.getAllResponseHeaders ? xhr.getAllResponseHeaders() : null);\n let licenseResponse = new LicenseResponse(xhr.responseURL, responseHeaders, xhr.response);\n const licenseResponseFilters = customParametersModel.getLicenseResponseFilters();\n _applyFilters(licenseResponseFilters, licenseResponse)\n .then(() => {\n const licenseMessage = licenseServerData.getLicenseMessage(licenseResponse.data, keySystemString, messageType);\n if (licenseMessage !== null) {\n _sendLicenseRequestCompleteEvent(eventData);\n protectionModel.updateKeySession(sessionToken, licenseMessage);\n } else {\n _reportError(xhr, eventData, keySystemString, messageType, licenseServerData);\n }\n });\n } else {\n _reportError(xhr, eventData, keySystemString, messageType, licenseServerData);\n }\n };\n\n const onAbort = function (xhr) {\n _sendLicenseRequestCompleteEvent(eventData, new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,\n ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + ' update, XHR aborted. status is \"' +\n xhr.statusText + '\" (' + xhr.status + '), readyState is ' + xhr.readyState));\n };\n\n const onError = function (xhr) {\n _sendLicenseRequestCompleteEvent(eventData, new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,\n ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + ' update, XHR error. status is \"' +\n xhr.statusText + '\" (' + xhr.status + '), readyState is ' + xhr.readyState));\n };\n\n const reqPayload = selectedKeySystem.getLicenseRequestFromMessage(message);\n const reqMethod = licenseServerData.getHTTPMethod(messageType);\n const responseType = licenseServerData.getResponseType(keySystemString, messageType);\n const timeout = protData && !isNaN(protData.httpTimeout) ? protData.httpTimeout : LICENSE_SERVER_REQUEST_DEFAULT_TIMEOUT;\n const sessionId = sessionToken.getSessionId() || null;\n\n let licenseRequest = new LicenseRequest(url, reqMethod, responseType, reqHeaders, withCredentials, messageType, sessionId, reqPayload);\n const retryAttempts = !isNaN(settings.get().streaming.retryAttempts[HTTPRequest.LICENSE]) ? settings.get().streaming.retryAttempts[HTTPRequest.LICENSE] : LICENSE_SERVER_REQUEST_RETRIES;\n const licenseRequestFilters = customParametersModel.getLicenseRequestFilters();\n _applyFilters(licenseRequestFilters, licenseRequest)\n .then(() => {\n _doLicenseRequest(licenseRequest, retryAttempts, timeout, onLoad, onAbort, onError);\n });\n }\n\n /**\n * Implement license requests with a retry mechanism to avoid temporary network issues to affect playback experience\n * @param {object} request\n * @param {number} retriesCount\n * @param {number} timeout\n * @param {function} onLoad\n * @param {function} onAbort\n * @param {function} onError\n * @private\n */\n function _doLicenseRequest(request, retriesCount, timeout, onLoad, onAbort, onError) {\n const xhr = new XMLHttpRequest();\n\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n const cmcdMode = settings.get().streaming.cmcd.mode;\n if (cmcdMode === Constants.CMCD_MODE_QUERY) {\n const cmcdParams = cmcdModel.getQueryParameter({\n url: request.url,\n type: HTTPRequest.LICENSE\n });\n\n if (cmcdParams) {\n request.url = Utils.addAditionalQueryParameterToUrl(request.url, [cmcdParams]);\n }\n }\n }\n\n xhr.open(request.method, request.url, true);\n xhr.responseType = request.responseType;\n xhr.withCredentials = request.withCredentials;\n if (timeout > 0) {\n xhr.timeout = timeout;\n }\n for (const key in request.headers) {\n xhr.setRequestHeader(key, request.headers[key]);\n }\n\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n const cmcdMode = settings.get().streaming.cmcd.mode;\n if (cmcdMode === Constants.CMCD_MODE_HEADER) {\n const cmcdHeaders = cmcdModel.getHeaderParameters({\n url: request.url,\n type: HTTPRequest.LICENSE\n });\n\n if (cmcdHeaders) {\n for (const header in cmcdHeaders) {\n let value = cmcdHeaders[header];\n if (value) {\n xhr.setRequestHeader(header, value);\n }\n }\n }\n }\n }\n\n const _retryRequest = function () {\n // fail silently and retry\n retriesCount--;\n const retryInterval = !isNaN(settings.get().streaming.retryIntervals[HTTPRequest.LICENSE]) ? settings.get().streaming.retryIntervals[HTTPRequest.LICENSE] : LICENSE_SERVER_REQUEST_RETRY_INTERVAL;\n licenseRequestRetryTimeout = setTimeout(function () {\n _doLicenseRequest(request, retriesCount, timeout, onLoad, onAbort, onError);\n }, retryInterval);\n };\n\n xhr.onload = function () {\n licenseXhrRequest = null;\n if (this.status >= 200 && this.status <= 299 || retriesCount <= 0) {\n onLoad(this);\n } else {\n logger.warn('License request failed (' + this.status + '). Retrying it... Pending retries: ' + retriesCount);\n _retryRequest();\n }\n };\n\n xhr.ontimeout = xhr.onerror = function () {\n licenseXhrRequest = null;\n if (retriesCount <= 0) {\n onError(this);\n } else {\n logger.warn('License request network request failed . Retrying it... Pending retries: ' + retriesCount);\n _retryRequest();\n }\n };\n\n xhr.onabort = function () {\n onAbort(this);\n };\n\n // deprecated, to be removed\n eventBus.trigger(events.LICENSE_REQUEST_SENDING, {\n url: request.url,\n headers: request.headers,\n payload: request.data,\n sessionId: request.sessionId\n });\n\n licenseXhrRequest = xhr;\n xhr.send(request.data);\n }\n\n /**\n * Aborts license request\n * @private\n */\n function _abortLicenseRequest() {\n if (licenseXhrRequest) {\n licenseXhrRequest.onloadend = licenseXhrRequest.onerror = licenseXhrRequest.onprogress = undefined; //Ignore events from aborted requests.\n licenseXhrRequest.abort();\n licenseXhrRequest = null;\n }\n\n if (licenseRequestRetryTimeout) {\n clearTimeout(licenseRequestRetryTimeout);\n licenseRequestRetryTimeout = null;\n }\n }\n\n /**\n * Returns the url of the license server\n * @param {object} protData\n * @param {string} messageType\n * @param {object} sessionToken\n * @param {object} keyMessage\n * @param {object} licenseServerData\n * @return {*}\n * @private\n */\n function _getLicenseServerUrl(protData, messageType, sessionToken, keyMessage, licenseServerData) {\n let url = null;\n const message = keyMessage.message;\n\n // Check if the url is defined by the application\n if (protData && protData.serverURL) {\n const serverURL = protData.serverURL;\n if (typeof serverURL === 'string' && serverURL !== '') {\n url = serverURL;\n } else if (typeof serverURL === 'object' && serverURL.hasOwnProperty(messageType)) {\n url = serverURL[messageType];\n }\n }\n\n // This is the old way of providing the url\n else if (protData && protData.laURL && protData.laURL !== '') {\n url = protData.laURL;\n }\n\n // No url provided by the app. Check the manifest and the pssh\n else {\n // Check for url defined in the manifest\n url = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfoArr, selectedKeySystem.schemeIdURI);\n\n // In case we are not using Clearky we can still get a url from the pssh.\n if (!url && !protectionKeyController.isClearKey(selectedKeySystem)) {\n const psshData = CommonEncryption.getPSSHData(sessionToken.initData);\n url = selectedKeySystem.getLicenseServerURLFromInitData(psshData);\n\n // Still no url, check the keymessage\n if (!url) {\n url = keyMessage.laURL;\n }\n }\n }\n // Possibly update or override the URL based on the message\n url = licenseServerData.getServerURLFromMessage(url, message, messageType);\n\n return url;\n }\n\n /**\n * Add new headers to the existing ones\n * @param {array} reqHeaders\n * @param {object} headers\n * @private\n */\n function _updateHeaders(reqHeaders, headers) {\n if (headers) {\n for (const key in headers) {\n reqHeaders[key] = headers[key];\n }\n }\n }\n\n /**\n * Reports an error that might have occured during the license request\n * @param {object} xhr\n * @param {object} eventData\n * @param {string} keySystemString\n * @param {string} messageType\n * @param {object} licenseServerData\n * @private\n */\n function _reportError(xhr, eventData, keySystemString, messageType, licenseServerData) {\n let errorMsg = 'NONE';\n let data = null;\n\n if (xhr.response) {\n errorMsg = licenseServerData.getErrorResponse(xhr.response, keySystemString, messageType);\n data = {\n serverResponse: xhr.response || null,\n responseCode: xhr.status || null,\n responseText: xhr.statusText || null\n }\n }\n\n _sendLicenseRequestCompleteEvent(eventData, new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,\n ProtectionErrors.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + ' update, XHR complete. status is \"' +\n xhr.statusText + '\" (' + xhr.status + '), readyState is ' + xhr.readyState + '. Response is ' + errorMsg,\n data\n ));\n }\n\n /**\n * Applies custom filters defined by the application\n * @param {array} filters\n * @param {object} param\n * @return {Promise<void>|*}\n * @private\n */\n function _applyFilters(filters, param) {\n if (!filters) return Promise.resolve();\n return filters.reduce((prev, next) => {\n return prev.then(() => {\n return next(param);\n });\n }, Promise.resolve());\n }\n\n /**\n * Event handler for \"needkey\" and \"encrypted\" events\n * @param {object} event\n * @param {number} retry\n */\n function _onNeedKey(event, retry) {\n if (!settings.get().streaming.protection.ignoreEmeEncryptedEvent) {\n logger.debug('DRM: onNeedKey');\n\n // Ignore non-cenc initData\n if (event.key.initDataType !== 'cenc') {\n logger.warn('DRM: Only \\'cenc\\' initData is supported! Ignoring initData of type: ' + event.key.initDataType);\n return;\n }\n\n if (mediaInfoArr.length === 0) {\n logger.warn('DRM: onNeedKey called before initializeForMedia, wait until initialized');\n retry = typeof retry === 'undefined' ? 1 : retry + 1;\n if (retry < NEEDKEY_BEFORE_INITIALIZE_RETRIES) {\n needkeyRetries.push(setTimeout(() => {\n _onNeedKey(event, retry);\n }, NEEDKEY_BEFORE_INITIALIZE_TIMEOUT));\n return;\n }\n }\n\n // Some browsers return initData as Uint8Array (IE), some as ArrayBuffer (Chrome).\n // Convert to ArrayBuffer\n let abInitData = event.key.initData;\n if (ArrayBuffer.isView(abInitData)) {\n abInitData = abInitData.buffer;\n }\n\n // If key system has already been selected and initData already seen, then do nothing\n if (selectedKeySystem) {\n const initDataForKS = CommonEncryption.getPSSHForKeySystem(selectedKeySystem, abInitData);\n if (initDataForKS) {\n // Check for duplicate initData\n if (_isInitDataDuplicate(initDataForKS)) {\n return;\n }\n }\n }\n\n logger.debug('DRM: initData:', String.fromCharCode.apply(null, new Uint8Array(abInitData)));\n\n const supportedKS = protectionKeyController.getSupportedKeySystemsFromSegmentPssh(abInitData, protDataSet, sessionType);\n if (supportedKS.length === 0) {\n logger.debug('DRM: Received needkey event with initData, but we don\\'t support any of the key systems!');\n return;\n }\n\n _selectKeySystem(supportedKS, false);\n }\n }\n\n /**\n * Returns all available key systems\n * @return {array}\n */\n function getKeySystems() {\n return protectionKeyController ? protectionKeyController.getKeySystems() : [];\n }\n\n /**\n * Sets all available key systems\n * @param {array} keySystems\n */\n function setKeySystems(keySystems) {\n if (protectionKeyController) {\n protectionKeyController.setKeySystems(keySystems);\n }\n }\n\n instance = {\n initializeForMedia,\n clearMediaInfoArray,\n createKeySession,\n loadKeySession,\n removeKeySession,\n closeKeySession,\n setServerCertificate,\n setMediaElement,\n setSessionType,\n setRobustnessLevel,\n setProtectionData,\n getSupportedKeySystemsFromContentProtection,\n getKeySystems,\n setKeySystems,\n stop,\n reset\n };\n\n setup();\n return instance;\n}\n\nProtectionController.__dashjs_factory_name = 'ProtectionController';\nexport default FactoryMaker.getClassFactory(ProtectionController); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\nimport CommonEncryption from './../CommonEncryption';\nimport KeySystemClearKey from './../drm/KeySystemClearKey';\nimport KeySystemW3CClearKey from './../drm/KeySystemW3CClearKey';\nimport KeySystemWidevine from './../drm/KeySystemWidevine';\nimport KeySystemPlayReady from './../drm/KeySystemPlayReady';\nimport DRMToday from './../servers/DRMToday';\nimport PlayReady from './../servers/PlayReady';\nimport Widevine from './../servers/Widevine';\nimport ClearKey from './../servers/ClearKey';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\n/**\n * @module ProtectionKeyController\n * @ignore\n * @description Media protection key system functionality that can be modified/overridden by applications\n */\nfunction ProtectionKeyController() {\n\n let context = this.context;\n\n let instance,\n debug,\n logger,\n keySystems,\n BASE64,\n settings,\n clearkeyKeySystem,\n clearkeyW3CKeySystem;\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.debug) {\n debug = config.debug;\n logger = debug.getLogger(instance);\n }\n\n if (config.BASE64) {\n BASE64 = config.BASE64;\n }\n\n if(config.settings) {\n settings = config.settings\n }\n }\n\n function initialize() {\n keySystems = [];\n\n let keySystem;\n\n // PlayReady\n keySystem = KeySystemPlayReady(context).getInstance({BASE64: BASE64, settings: settings});\n keySystems.push(keySystem);\n\n // Widevine\n keySystem = KeySystemWidevine(context).getInstance({BASE64: BASE64});\n keySystems.push(keySystem);\n\n // ClearKey\n keySystem = KeySystemClearKey(context).getInstance({BASE64: BASE64});\n keySystems.push(keySystem);\n clearkeyKeySystem = keySystem;\n\n // W3C ClearKey\n keySystem = KeySystemW3CClearKey(context).getInstance({BASE64: BASE64, debug: debug});\n keySystems.push(keySystem);\n clearkeyW3CKeySystem = keySystem;\n }\n\n /**\n * Returns a prioritized list of key systems supported\n * by this player (not necessarily those supported by the\n * user agent)\n *\n * @returns {Array.<KeySystem>} a prioritized\n * list of key systems\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function getKeySystems() {\n return keySystems;\n }\n\n /**\n * Sets the prioritized list of key systems to be supported\n * by this player.\n *\n * @param {Array.<KeySystem>} newKeySystems the new prioritized\n * list of key systems\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function setKeySystems(newKeySystems) {\n keySystems = newKeySystems;\n }\n\n /**\n * Returns the key system associated with the given key system string\n * name (i.e. 'org.w3.clearkey')\n *\n * @param {string} systemString the system string\n * @returns {KeySystem|null} the key system\n * or null if no supported key system is associated with the given key\n * system string\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function getKeySystemBySystemString(systemString) {\n for (let i = 0; i < keySystems.length; i++) {\n if (keySystems[i].systemString === systemString) {\n return keySystems[i];\n }\n }\n return null;\n }\n\n /**\n * Determines whether the given key system is ClearKey. This is\n * necessary because the EME spec defines ClearKey and its method\n * for providing keys to the key session; and this method has changed\n * between the various API versions. Our EME-specific ProtectionModels\n * must know if the system is ClearKey so that it can format the keys\n * according to the particular spec version.\n *\n * @param {Object} keySystem the key\n * @returns {boolean} true if this is the ClearKey key system, false\n * otherwise\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function isClearKey(keySystem) {\n return (keySystem === clearkeyKeySystem || keySystem === clearkeyW3CKeySystem);\n }\n\n /**\n * Check equality of initData array buffers.\n *\n * @param {ArrayBuffer} initData1 - first initData\n * @param {ArrayBuffer} initData2 - second initData\n * @returns {boolean} true if the initData arrays are equal in size and\n * contents, false otherwise\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function initDataEquals(initData1, initData2) {\n if (initData1.byteLength === initData2.byteLength) {\n let data1 = new Uint8Array(initData1);\n let data2 = new Uint8Array(initData2);\n\n for (let j = 0; j < data1.length; j++) {\n if (data1[j] !== data2[j]) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Returns a set of supported key systems and CENC initialization data\n * from the given array of ContentProtection elements. Only\n * key systems that are supported by this player will be returned.\n * Key systems are returned in priority order (highest first).\n *\n * @param {Array.<Object>} cps - array of content protection elements parsed\n * from the manifest\n * @param {ProtectionData} protDataSet user specified protection data - license server url etc\n * supported by the content\n * @param {string} default session type\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function getSupportedKeySystemsFromContentProtection(cps, protDataSet, sessionType) {\n let cp, ks, ksIdx, cpIdx;\n let supportedKS = [];\n\n if (cps) {\n const cencContentProtection = CommonEncryption.findCencContentProtection(cps);\n for (ksIdx = 0; ksIdx < keySystems.length; ++ksIdx) {\n ks = keySystems[ksIdx];\n\n // Get protection data that applies for current key system\n const protData = _getProtDataForKeySystem(ks.systemString, protDataSet);\n\n for (cpIdx = 0; cpIdx < cps.length; ++cpIdx) {\n cp = cps[cpIdx];\n if (cp.schemeIdUri.toLowerCase() === ks.schemeIdURI) {\n // Look for DRM-specific ContentProtection\n let initData = ks.getInitData(cp, cencContentProtection);\n\n supportedKS.push({\n ks: keySystems[ksIdx],\n keyId: cp.keyId,\n initData: initData,\n protData: protData,\n cdmData: ks.getCDMData(protData ? protData.cdmData : null),\n sessionId: _getSessionId(protData, cp),\n sessionType: _getSessionType(protData, sessionType)\n });\n }\n }\n }\n }\n return supportedKS;\n }\n\n /**\n * Returns key systems supported by this player for the given PSSH\n * initializationData. Key systems are returned in priority order\n * (highest priority first)\n *\n * @param {ArrayBuffer} initData Concatenated PSSH data for all DRMs\n * supported by the content\n * @param {ProtectionData} protDataSet user specified protection data - license server url etc\n * supported by the content\n * @param {string} default session type\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function getSupportedKeySystemsFromSegmentPssh(initData, protDataSet, sessionType) {\n let supportedKS = [];\n let pssh = CommonEncryption.parsePSSHList(initData);\n let ks, keySystemString;\n\n for (let ksIdx = 0; ksIdx < keySystems.length; ++ksIdx) {\n ks = keySystems[ksIdx];\n keySystemString = ks.systemString;\n\n // Get protection data that applies for current key system\n const protData = _getProtDataForKeySystem(keySystemString, protDataSet);\n\n if (ks.uuid in pssh) {\n supportedKS.push({\n ks: ks,\n initData: pssh[ks.uuid],\n protData: protData,\n cdmData: ks.getCDMData(protData ? protData.cdmData : null),\n sessionId: _getSessionId(protData),\n sessionType: _getSessionType(protData, sessionType)\n });\n }\n }\n return supportedKS;\n }\n\n /**\n * Returns the license server implementation data that should be used for this request.\n *\n * @param {KeySystem} keySystem the key system\n * associated with this license request\n * @param {ProtectionData} protData protection data to use for the\n * request\n * @param {string} [messageType=\"license-request\"] the message type associated with this\n * request. Supported message types can be found\n * {@link https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType|here}.\n * @returns {LicenseServer|null} the license server\n * implementation that should be used for this request or null if the player should not\n * pass messages of the given type to a license server\n * @memberof module:ProtectionKeyController\n * @instance\n *\n */\n function getLicenseServerModelInstance(keySystem, protData, messageType) {\n\n // Our default server implementations do not do anything with \"license-release\" or\n // \"individualization-request\" messages, so we just send a success event\n if (messageType === 'license-release' || messageType === 'individualization-request') {\n return null;\n }\n\n let licenseServerData = null;\n if (protData && protData.hasOwnProperty('drmtoday')) {\n licenseServerData = DRMToday(context).getInstance({BASE64: BASE64});\n } else if (keySystem.systemString === ProtectionConstants.WIDEVINE_KEYSTEM_STRING) {\n licenseServerData = Widevine(context).getInstance();\n } else if (keySystem.systemString === ProtectionConstants.PLAYREADY_KEYSTEM_STRING) {\n licenseServerData = PlayReady(context).getInstance();\n } else if (keySystem.systemString === ProtectionConstants.CLEARKEY_KEYSTEM_STRING) {\n licenseServerData = ClearKey(context).getInstance();\n }\n\n return licenseServerData;\n }\n\n /**\n * Allows application-specific retrieval of ClearKey keys.\n *\n * @param {KeySystem} clearkeyKeySystem They exact ClearKey System to be used\n * @param {ProtectionData} protData protection data to use for the\n * request\n * @param {ArrayBuffer} message the key message from the CDM\n * @return {ClearKeyKeySet|null} the clear keys associated with\n * the request or null if no keys can be returned by this function\n * @memberof module:ProtectionKeyController\n * @instance\n */\n function processClearKeyLicenseRequest(clearkeyKeySystem, protData, message) {\n try {\n return clearkeyKeySystem.getClearKeysFromProtectionData(protData, message);\n } catch (error) {\n logger.error('Failed to retrieve clearkeys from ProtectionData');\n return null;\n }\n }\n\n function setProtectionData(protectionDataSet) {\n var getProtectionData = function (keySystemString) {\n var protData = null;\n if (protectionDataSet) {\n protData = (keySystemString in protectionDataSet) ? protectionDataSet[keySystemString] : null;\n }\n return protData;\n };\n\n for (var i = 0; i < keySystems.length; i++) {\n var keySystem = keySystems[i];\n if (keySystem.hasOwnProperty('init')) {\n keySystem.init(getProtectionData(keySystem.systemString));\n }\n }\n }\n\n function _getProtDataForKeySystem(systemString, protDataSet) {\n if (!protDataSet) return null;\n return (systemString in protDataSet) ? protDataSet[systemString] : null;\n }\n\n function _getSessionId(protData, cp) {\n // Get sessionId from protectionData or from manifest (ContentProtection)\n if (protData && protData.sessionId) {\n return protData.sessionId;\n } else if (cp && cp.sessionId) {\n return cp.sessionId;\n }\n return null;\n }\n\n function _getSessionType(protData, sessionType) {\n return (protData && protData.sessionType) ? protData.sessionType : sessionType;\n }\n\n instance = {\n initialize,\n setProtectionData,\n isClearKey,\n initDataEquals,\n getKeySystems,\n setKeySystems,\n getKeySystemBySystemString,\n getSupportedKeySystemsFromContentProtection,\n getSupportedKeySystemsFromSegmentPssh,\n getLicenseServerModelInstance,\n processClearKeyLicenseRequest,\n setConfig\n };\n\n return instance;\n}\n\nProtectionKeyController.__dashjs_factory_name = 'ProtectionKeyController';\nexport default dashjs.FactoryMaker.getSingletonFactory(ProtectionKeyController); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport KeyPair from '../vo/KeyPair';\nimport ClearKeyKeySet from '../vo/ClearKeyKeySet';\nimport CommonEncryption from '../CommonEncryption';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nconst uuid = 'e2719d58-a985-b3c9-781a-b030af78d30e';\nconst systemString = ProtectionConstants.CLEARKEY_KEYSTEM_STRING;\nconst schemeIdURI = 'urn:uuid:' + uuid;\n\nfunction KeySystemClearKey(config) {\n\n config = config || {};\n let instance;\n const BASE64 = config.BASE64;\n\n /**\n * Returns desired clearkeys (as specified in the CDM message) from protection data\n *\n * @param {ProtectionData} protectionData the protection data\n * @param {ArrayBuffer} message the ClearKey CDM message\n * @returns {ClearKeyKeySet} the key set or null if none found\n * @throws {Error} if a keyID specified in the CDM message was not found in the\n * protection data\n * @memberof KeySystemClearKey\n */\n function getClearKeysFromProtectionData(protectionData, message) {\n let clearkeySet = null;\n if (protectionData) {\n // ClearKey is the only system that does not require a license server URL, so we\n // handle it here when keys are specified in protection data\n const jsonMsg = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));\n const keyPairs = [];\n for (let i = 0; i < jsonMsg.kids.length; i++) {\n const clearkeyID = jsonMsg.kids[i];\n const clearkey = (protectionData.clearkeys && protectionData.clearkeys.hasOwnProperty(clearkeyID)) ? protectionData.clearkeys[clearkeyID] : null;\n if (!clearkey) {\n throw new Error('DRM: ClearKey keyID (' + clearkeyID + ') is not known!');\n }\n // KeyIDs from CDM are not base64 padded. Keys may or may not be padded\n keyPairs.push(new KeyPair(clearkeyID, clearkey));\n }\n clearkeySet = new ClearKeyKeySet(keyPairs);\n }\n return clearkeySet;\n }\n\n function getInitData(cp, cencContentProtection) {\n try {\n let initData = CommonEncryption.parseInitDataFromContentProtection(cp, BASE64);\n\n if (!initData && cencContentProtection) {\n const cencDefaultKid = cencDefaultKidToBase64Representation(cencContentProtection['cenc:default_KID']);\n const data = {kids: [cencDefaultKid]};\n initData = new TextEncoder().encode(JSON.stringify(data));\n }\n\n return initData;\n } catch (e) {\n return null;\n }\n }\n\n function cencDefaultKidToBase64Representation(cencDefaultKid) {\n try {\n let kid = cencDefaultKid.replace(/-/g, '');\n kid = btoa(kid.match(/\\w{2}/g).map((a) => {\n return String.fromCharCode(parseInt(a, 16));\n }).join(''));\n return kid.replace(/=/g, '');\n } catch (e) {\n return null;\n }\n }\n\n function getRequestHeadersFromMessage(/*message*/) {\n // Set content type to application/json by default\n return {\n 'Content-Type': 'application/json'\n };\n }\n\n function getLicenseRequestFromMessage(message) {\n return JSON.stringify(JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message))));\n }\n\n function getLicenseServerURLFromInitData(/*initData*/) {\n return null;\n }\n\n function getCDMData(/*cdmData*/) {\n return null;\n }\n\n instance = {\n uuid,\n schemeIdURI,\n systemString,\n getInitData,\n getRequestHeadersFromMessage,\n getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData,\n getCDMData,\n getClearKeysFromProtectionData\n };\n\n return instance;\n}\n\nKeySystemClearKey.__dashjs_factory_name = 'KeySystemClearKey';\nexport default dashjs.FactoryMaker.getSingletonFactory(KeySystemClearKey); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Microsoft PlayReady DRM\n *\n * @class\n * @implements KeySystem\n */\nimport CommonEncryption from '../CommonEncryption';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nconst uuid = '9a04f079-9840-4286-ab92-e65be0885f95';\nconst systemString = ProtectionConstants.PLAYREADY_KEYSTEM_STRING;\nconst schemeIdURI = 'urn:uuid:' + uuid;\nconst PRCDMData = '<PlayReadyCDMData type=\"LicenseAcquisition\"><LicenseAcquisition version=\"1.0\" Proactive=\"false\"><CustomData encoding=\"base64encoded\">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>';\n\nfunction KeySystemPlayReady(config) {\n\n config = config || {};\n let instance;\n let messageFormat = 'utf-16';\n const BASE64 = config.BASE64;\n const settings = config.settings;\n\n function checkConfig() {\n if (!BASE64 || !BASE64.hasOwnProperty('decodeArray') || !BASE64.hasOwnProperty('decodeArray') ) {\n throw new Error('Missing config parameter(s)');\n }\n }\n\n function getRequestHeadersFromMessage(message) {\n let msg,\n xmlDoc;\n const headers = {};\n const parser = new DOMParser();\n\n if (settings && settings.get().streaming.protection.detectPlayreadyMessageFormat) {\n // If message format configured/defaulted to utf-16 AND number of bytes is odd, assume 'unwrapped' raw CDM message.\n if (messageFormat === 'utf-16' && message && message.byteLength % 2 === 1) {\n headers['Content-Type'] = 'text/xml; charset=utf-8';\n return headers;\n }\n }\n\n const dataview = (messageFormat === 'utf-16') ? new Uint16Array(message) : new Uint8Array(message);\n\n msg = String.fromCharCode.apply(null, dataview);\n xmlDoc = parser.parseFromString(msg, 'application/xml');\n\n const headerNameList = xmlDoc.getElementsByTagName('name');\n const headerValueList = xmlDoc.getElementsByTagName('value');\n for (let i = 0; i < headerNameList.length; i++) {\n headers[headerNameList[i].childNodes[0].nodeValue] = headerValueList[i].childNodes[0].nodeValue;\n }\n // Some versions of the PlayReady CDM return 'Content' instead of 'Content-Type'.\n // this is NOT w3c conform and license servers may reject the request!\n // -> rename it to proper w3c definition!\n if (headers.hasOwnProperty('Content')) {\n headers['Content-Type'] = headers.Content;\n delete headers.Content;\n }\n // Set Content-Type header by default if not provided in the the CDM message (<PlayReadyKeyMessage/>)\n // or if the message contains directly the challenge itself (Ex: LG SmartTVs)\n if (!headers.hasOwnProperty('Content-Type')) {\n headers['Content-Type'] = 'text/xml; charset=utf-8';\n }\n return headers;\n }\n\n function getLicenseRequestFromMessage(message) {\n let licenseRequest = null;\n const parser = new DOMParser();\n\n if (settings && settings.get().streaming.protection.detectPlayreadyMessageFormat) {\n // If message format configured/defaulted to utf-16 AND number of bytes is odd, assume 'unwrapped' raw CDM message.\n if (messageFormat === 'utf-16' && message && message.byteLength % 2 === 1) {\n return message;\n }\n }\n\n const dataview = (messageFormat === 'utf-16') ? new Uint16Array(message) : new Uint8Array(message);\n\n checkConfig();\n const msg = String.fromCharCode.apply(null, dataview);\n const xmlDoc = parser.parseFromString(msg, 'application/xml');\n\n if (xmlDoc.getElementsByTagName('PlayReadyKeyMessage')[0]) {\n const Challenge = xmlDoc.getElementsByTagName('Challenge')[0].childNodes[0].nodeValue;\n if (Challenge) {\n licenseRequest = BASE64.decode(Challenge);\n }\n } else {\n // The message from CDM is not a wrapped message as on IE11 and Edge,\n // thus it contains direclty the challenge itself\n // (note that the xmlDoc at this point may be unreadable since it may have been interpreted as UTF-16)\n return message;\n }\n\n return licenseRequest;\n }\n\n function getLicenseServerURLFromInitData(initData) {\n if (initData) {\n const data = new DataView(initData);\n const numRecords = data.getUint16(4, true);\n let offset = 6;\n const parser = new DOMParser();\n\n for (let i = 0; i < numRecords; i++) {\n // Parse the PlayReady Record header\n const recordType = data.getUint16(offset, true);\n offset += 2;\n const recordLength = data.getUint16(offset, true);\n offset += 2;\n if (recordType !== 0x0001) {\n offset += recordLength;\n continue;\n }\n\n const recordData = initData.slice(offset, offset + recordLength);\n const record = String.fromCharCode.apply(null, new Uint16Array(recordData));\n const xmlDoc = parser.parseFromString(record, 'application/xml');\n\n // First try <LA_URL>\n if (xmlDoc.getElementsByTagName('LA_URL')[0]) {\n const laurl = xmlDoc.getElementsByTagName('LA_URL')[0].childNodes[0].nodeValue;\n if (laurl) {\n return laurl;\n }\n }\n\n // Optionally, try <LUI_URL>\n if (xmlDoc.getElementsByTagName('LUI_URL')[0]) {\n const luiurl = xmlDoc.getElementsByTagName('LUI_URL')[0].childNodes[0].nodeValue;\n if (luiurl) {\n return luiurl;\n }\n }\n }\n }\n\n return null;\n }\n\n function getInitData(cpData) {\n // * desc@ getInitData\n // * generate PSSH data from PROHeader defined in MPD file\n // * PSSH format:\n // * size (4)\n // * box type(PSSH) (8)\n // * Protection SystemID (16)\n // * protection system data size (4) - length of decoded PROHeader\n // * decoded PROHeader data from MPD file\n const PSSHBoxType = new Uint8Array([0x70, 0x73, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00]); //'PSSH' 8 bytes\n const playreadySystemID = new Uint8Array([0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95]);\n\n let byteCursor = 0;\n let uint8arraydecodedPROHeader = null;\n\n let PROSize,\n PSSHSize,\n PSSHBoxBuffer,\n PSSHBox,\n PSSHData;\n\n checkConfig();\n if (!cpData) {\n return null;\n }\n // Handle common encryption PSSH\n if ('pssh' in cpData) {\n return CommonEncryption.parseInitDataFromContentProtection(cpData, BASE64);\n }\n // Handle native MS PlayReady ContentProtection elements\n if ('pro' in cpData) {\n uint8arraydecodedPROHeader = BASE64.decodeArray(cpData.pro.__text);\n }\n else if ('prheader' in cpData) {\n uint8arraydecodedPROHeader = BASE64.decodeArray(cpData.prheader.__text);\n }\n else {\n return null;\n }\n\n PROSize = uint8arraydecodedPROHeader.length;\n PSSHSize = 0x4 + PSSHBoxType.length + playreadySystemID.length + 0x4 + PROSize;\n\n PSSHBoxBuffer = new ArrayBuffer(PSSHSize);\n\n PSSHBox = new Uint8Array(PSSHBoxBuffer);\n PSSHData = new DataView(PSSHBoxBuffer);\n\n PSSHData.setUint32(byteCursor, PSSHSize);\n byteCursor += 0x4;\n\n PSSHBox.set(PSSHBoxType, byteCursor);\n byteCursor += PSSHBoxType.length;\n\n PSSHBox.set(playreadySystemID, byteCursor);\n byteCursor += playreadySystemID.length;\n\n PSSHData.setUint32(byteCursor, PROSize);\n byteCursor += 0x4;\n\n PSSHBox.set(uint8arraydecodedPROHeader, byteCursor);\n byteCursor += PROSize;\n\n return PSSHBox.buffer;\n }\n\n /**\n * It seems that some PlayReady implementations return their XML-based CDM\n * messages using UTF16, while others return them as UTF8. Use this function\n * to modify the message format to expect when parsing CDM messages.\n *\n * @param {string} format the expected message format. Either \"utf-8\" or \"utf-16\".\n * @throws {Error} Specified message format is not one of \"utf8\" or \"utf16\"\n */\n function setPlayReadyMessageFormat(format) {\n if (format !== 'utf-8' && format !== 'utf-16') {\n throw new Error('Specified message format is not one of \"utf-8\" or \"utf-16\"');\n }\n messageFormat = format;\n }\n\n /**\n * Get Playready Custom data\n */\n function getCDMData(_cdmData) {\n let customData,\n cdmData,\n cdmDataBytes,\n i;\n\n checkConfig();\n if (!_cdmData) return null;\n\n // Convert custom data into multibyte string\n customData = [];\n for (i = 0; i < _cdmData.length; ++i) {\n customData.push(_cdmData.charCodeAt(i));\n customData.push(0);\n }\n customData = String.fromCharCode.apply(null, customData);\n\n // Encode in Base 64 the custom data string\n customData = BASE64.encode(customData);\n\n // Initialize CDM data with Base 64 encoded custom data\n // (see https://msdn.microsoft.com/en-us/library/dn457361.aspx)\n cdmData = PRCDMData.replace('%CUSTOMDATA%', customData);\n\n // Convert CDM data into multibyte characters\n cdmDataBytes = [];\n for (i = 0; i < cdmData.length; ++i) {\n cdmDataBytes.push(cdmData.charCodeAt(i));\n cdmDataBytes.push(0);\n }\n\n return new Uint8Array(cdmDataBytes).buffer;\n }\n\n instance = {\n uuid,\n schemeIdURI,\n systemString,\n getInitData,\n getRequestHeadersFromMessage,\n getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData,\n getCDMData,\n setPlayReadyMessageFormat\n };\n\n return instance;\n}\n\nKeySystemPlayReady.__dashjs_factory_name = 'KeySystemPlayReady';\nexport default dashjs.FactoryMaker.getSingletonFactory(KeySystemPlayReady); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport KeyPair from '../vo/KeyPair';\nimport ClearKeyKeySet from '../vo/ClearKeyKeySet';\nimport CommonEncryption from '../CommonEncryption';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nconst uuid = '1077efec-c0b2-4d02-ace3-3c1e52e2fb4b';\nconst systemString = ProtectionConstants.CLEARKEY_KEYSTEM_STRING;\nconst schemeIdURI = 'urn:uuid:' + uuid;\n\nfunction KeySystemW3CClearKey(config) {\n let instance;\n const BASE64 = config.BASE64;\n const logger = config.debug.getLogger(instance);\n /**\n * Returns desired clearkeys (as specified in the CDM message) from protection data\n *\n * @param {ProtectionDataSet} protectionData the protection data\n * @param {ArrayBuffer} message the ClearKey CDM message\n * @returns {ClearKeyKeySet} the key set or null if none found\n * @throws {Error} if a keyID specified in the CDM message was not found in the\n * protection data\n * @memberof KeySystemClearKey\n */\n function getClearKeysFromProtectionData(protectionData, message) {\n let clearkeySet = null;\n if (protectionData) {\n // ClearKey is the only system that does not require a license server URL, so we\n // handle it here when keys are specified in protection data\n const jsonMsg = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));\n const keyPairs = [];\n for (let i = 0; i < jsonMsg.kids.length; i++) {\n const clearkeyID = jsonMsg.kids[i];\n const clearkey = (protectionData.clearkeys && protectionData.clearkeys.hasOwnProperty(clearkeyID)) ? protectionData.clearkeys[clearkeyID] : null;\n if (!clearkey) {\n throw new Error('DRM: ClearKey keyID (' + clearkeyID + ') is not known!');\n }\n // KeyIDs from CDM are not base64 padded. Keys may or may not be padded\n keyPairs.push(new KeyPair(clearkeyID, clearkey));\n }\n clearkeySet = new ClearKeyKeySet(keyPairs);\n\n logger.warn('ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4');\n }\n return clearkeySet;\n }\n\n function getInitData(cp) {\n return CommonEncryption.parseInitDataFromContentProtection(cp, BASE64);\n }\n\n function getRequestHeadersFromMessage(/*message*/) {\n return null;\n }\n\n function getLicenseRequestFromMessage(message) {\n return new Uint8Array(message);\n }\n\n function getLicenseServerURLFromInitData(/*initData*/) {\n return null;\n }\n\n function getCDMData(/*cdmData*/) {\n return null;\n }\n\n instance = {\n uuid: uuid,\n schemeIdURI: schemeIdURI,\n systemString: systemString,\n getInitData: getInitData,\n getRequestHeadersFromMessage: getRequestHeadersFromMessage,\n getLicenseRequestFromMessage: getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData: getLicenseServerURLFromInitData,\n getCDMData: getCDMData,\n getClearKeysFromProtectionData: getClearKeysFromProtectionData\n };\n\n return instance;\n}\n\nKeySystemW3CClearKey.__dashjs_factory_name = 'KeySystemW3CClearKey';\nexport default dashjs.FactoryMaker.getSingletonFactory(KeySystemW3CClearKey); /* jshint ignore:line */\n\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Google Widevine DRM\n *\n * @class\n * @implements MediaPlayer.dependencies.protection.KeySystem\n */\n\nimport CommonEncryption from '../CommonEncryption';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nconst uuid = 'edef8ba9-79d6-4ace-a3c8-27dcd51d21ed';\nconst systemString = ProtectionConstants.WIDEVINE_KEYSTEM_STRING;\nconst schemeIdURI = 'urn:uuid:' + uuid;\n\nfunction KeySystemWidevine(config) {\n\n config = config || {};\n let instance;\n const BASE64 = config.BASE64;\n\n function getInitData(cp) {\n return CommonEncryption.parseInitDataFromContentProtection(cp, BASE64);\n }\n\n function getRequestHeadersFromMessage( /*message*/ ) {\n return null;\n }\n\n function getLicenseRequestFromMessage(message) {\n return new Uint8Array(message);\n }\n\n function getLicenseServerURLFromInitData( /*initData*/ ) {\n return null;\n }\n\n function getCDMData(/*cdmData*/) {\n return null;\n }\n\n instance = {\n uuid,\n schemeIdURI,\n systemString,\n getInitData,\n getRequestHeadersFromMessage,\n getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData,\n getCDMData\n };\n\n return instance;\n}\n\nKeySystemWidevine.__dashjs_factory_name = 'KeySystemWidevine';\nexport default dashjs.FactoryMaker.getSingletonFactory(KeySystemWidevine); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\nimport ErrorsBase from '../../../core/errors/ErrorsBase';\n\n/**\n * @class\n */\nclass ProtectionErrors extends ErrorsBase {\n constructor() {\n super();\n\n /**\n * Generid key Error code\n */\n this.MEDIA_KEYERR_CODE = 100;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_UNKNOWN_CODE = 101;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_CLIENT_CODE = 102;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_SERVICE_CODE = 103;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_OUTPUT_CODE = 104;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_HARDWARECHANGE_CODE = 105;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n this.MEDIA_KEYERR_DOMAIN_CODE = 106;\n\n /**\n * Error code returned when an error occured in keymessage event for ProtectionModel_01b\n */\n this.MEDIA_KEY_MESSAGE_ERROR_CODE = 107;\n /**\n * Error code returned when challenge is invalid in keymessage event (event triggered by CDM)\n */\n this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE = 108;\n /**\n * Error code returned when License server certificate has not been successfully updated\n */\n this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE = 109;\n /**\n * Error code returned when license validity has expired\n */\n this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE = 110;\n /**\n * Error code returned when no licenser url is defined\n */\n this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE = 111;\n /**\n * Error code returned when key system access is denied\n */\n this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE = 112;\n /**\n * Error code returned when key session has not been successfully created\n */\n this.KEY_SESSION_CREATED_ERROR_CODE = 113;\n /**\n * Error code returned when license request failed after a keymessage event has been triggered\n */\n this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE = 114;\n\n this.MEDIA_KEYERR_UNKNOWN_MESSAGE = 'An unspecified error occurred. This value is used for errors that don\\'t match any of the other codes.';\n this.MEDIA_KEYERR_CLIENT_MESSAGE = 'The Key System could not be installed or updated.';\n this.MEDIA_KEYERR_SERVICE_MESSAGE = 'The message passed into update indicated an error from the license service.';\n this.MEDIA_KEYERR_OUTPUT_MESSAGE = 'There is no available output device with the required characteristics for the content protection system.';\n this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE = 'A hardware configuration change caused a content protection error.';\n this.MEDIA_KEYERR_DOMAIN_MESSAGE = 'An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.';\n this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE = 'Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!';\n this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE = 'DRM: Empty key message from CDM';\n this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE = 'Error updating server certificate -- ';\n this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE = 'DRM: KeyStatusChange error! -- License has expired';\n this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE = 'DRM: No license server URL specified!';\n this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE = 'DRM: KeySystem Access Denied! -- ';\n this.KEY_SESSION_CREATED_ERROR_MESSAGE = 'DRM: unable to create session! --';\n this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE = 'DRM: licenser error! --';\n }\n}\n\nlet protectionErrors = new ProtectionErrors();\nexport default protectionErrors;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Initial implementation of EME\n *\n * Implemented by Google Chrome prior to v36\n *\n * @implements ProtectionModel\n * @class\n */\nimport ProtectionKeyController from '../controllers/ProtectionKeyController';\nimport NeedKey from '../vo/NeedKey';\nimport DashJSError from '../../vo/DashJSError';\nimport KeyMessage from '../vo/KeyMessage';\nimport KeySystemConfiguration from '../vo/KeySystemConfiguration';\nimport KeySystemAccess from '../vo/KeySystemAccess';\nimport ProtectionErrors from '../errors/ProtectionErrors';\n\nfunction ProtectionModel_01b(config) {\n\n config = config || {};\n const context = this.context;\n const eventBus = config.eventBus;//Need to pass in here so we can use same instance since this is optional module\n const events = config.events;\n const debug = config.debug;\n const api = config.api;\n const errHandler = config.errHandler;\n\n let instance,\n logger,\n videoElement,\n keySystem,\n protectionKeyController,\n\n // With this version of the EME APIs, sessionIds are not assigned to\n // sessions until the first key message is received. We are assuming\n // that in the case of multiple sessions, key messages will be received\n // in the order that generateKeyRequest() is called.\n // Holding spot for newly-created sessions until we determine whether or\n // not the CDM supports sessionIds\n pendingSessions,\n\n // List of sessions that have been initialized. Only the first position will\n // be used in the case that the CDM does not support sessionIds\n sessions,\n\n // Not all CDMs support the notion of sessionIds. Without sessionIds\n // there is no way for us to differentiate between sessions, therefore\n // we must only allow a single session. Once we receive the first key\n // message we can set this flag to determine if more sessions are allowed\n moreSessionsAllowed,\n\n // This is our main event handler for all desired HTMLMediaElement events\n // related to EME. These events are translated into our API-independent\n // versions of the same events\n eventHandler;\n\n function setup() {\n logger = debug.getLogger(instance);\n videoElement = null;\n keySystem = null;\n pendingSessions = [];\n sessions = [];\n protectionKeyController = ProtectionKeyController(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n if (videoElement) {\n removeEventListeners();\n }\n for (let i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n\n function getAllInitData() {\n const retVal = [];\n for (let i = 0; i < pendingSessions.length; i++) {\n retVal.push(pendingSessions[i].initData);\n }\n for (let i = 0; i < sessions.length; i++) {\n retVal.push(sessions[i].initData);\n }\n return retVal;\n }\n\n function getSessions() {\n return sessions.concat(pendingSessions);\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise((resolve, reject) => {\n let ve = videoElement;\n if (!ve) { // Must have a video element to do this capability tests\n ve = document.createElement('video');\n }\n\n // Try key systems in order, first one with supported key system configuration\n // is used\n let found = false;\n for (let ksIdx = 0; ksIdx < ksConfigurations.length; ksIdx++) {\n const systemString = ksConfigurations[ksIdx].ks.systemString;\n const configs = ksConfigurations[ksIdx].configs;\n let supportedAudio = null;\n let supportedVideo = null;\n\n // Try key system configs in order, first one with supported audio/video\n // is used\n for (let configIdx = 0; configIdx < configs.length; configIdx++) {\n //let audios = configs[configIdx].audioCapabilities;\n const videos = configs[configIdx].videoCapabilities;\n // Look for supported video container/codecs\n if (videos && videos.length !== 0) {\n supportedVideo = []; // Indicates that we have a requested video config\n for (let videoIdx = 0; videoIdx < videos.length; videoIdx++) {\n if (ve.canPlayType(videos[videoIdx].contentType, systemString) !== '') {\n supportedVideo.push(videos[videoIdx]);\n }\n }\n }\n\n // No supported audio or video in this configuration OR we have\n // requested audio or video configuration that is not supported\n if ((!supportedAudio && !supportedVideo) ||\n (supportedAudio && supportedAudio.length === 0) ||\n (supportedVideo && supportedVideo.length === 0)) {\n continue;\n }\n\n // This configuration is supported\n found = true;\n const ksConfig = new KeySystemConfiguration(supportedAudio, supportedVideo);\n const ks = protectionKeyController.getKeySystemBySystemString(systemString);\n const keySystemAccess = new KeySystemAccess(ks, ksConfig)\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, { data: keySystemAccess });\n resolve({ data: keySystemAccess });\n break;\n }\n }\n if (!found) {\n const errorMessage = 'Key system access denied! -- No valid audio/video content configurations detected!';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, { error: errorMessage });\n reject({ error: errorMessage });\n }\n })\n\n }\n\n function selectKeySystem(keySystemAccess) {\n keySystem = keySystemAccess.keySystem;\n return Promise.resolve(keySystem);\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement) {\n return;\n }\n\n // Replacing the previous element\n if (videoElement) {\n removeEventListeners();\n\n // Close any open sessions - avoids memory leak on LG webOS 2016/2017 TVs\n for (var i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n sessions = [];\n }\n\n videoElement = mediaElement;\n\n // Only if we are not detaching from the existing element\n if (videoElement) {\n videoElement.addEventListener(api.keyerror, eventHandler);\n videoElement.addEventListener(api.needkey, eventHandler);\n videoElement.addEventListener(api.keymessage, eventHandler);\n videoElement.addEventListener(api.keyadded, eventHandler);\n eventBus.trigger(events.VIDEO_ELEMENT_SELECTED);\n }\n }\n\n function createKeySession(ksInfo) {\n if (!keySystem) {\n throw new Error('Can not create sessions until you have selected a key system');\n }\n\n // Determine if creating a new session is allowed\n if (moreSessionsAllowed || sessions.length === 0) {\n const newSession = { // Implements SessionToken\n sessionId: null,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n\n getKeyId: function () {\n return this.keyId;\n },\n\n getSessionId: function () {\n return this.sessionId;\n },\n\n getExpirationTime: function () {\n return NaN;\n },\n\n getSessionType: function () {\n return 'temporary';\n }\n };\n pendingSessions.push(newSession);\n\n // Send our request to the CDM\n videoElement[api.generateKeyRequest](keySystem.systemString, new Uint8Array(ksInfo.initData));\n\n return newSession;\n\n } else {\n throw new Error('Multiple sessions not allowed!');\n }\n\n }\n\n function updateKeySession(sessionToken, message) {\n const sessionId = sessionToken.sessionId;\n if (!protectionKeyController.isClearKey(keySystem)) {\n // Send our request to the CDM\n videoElement[api.addKey](keySystem.systemString,\n new Uint8Array(message), new Uint8Array(sessionToken.initData), sessionId);\n } else {\n // For clearkey, message is a ClearKeyKeySet\n for (let i = 0; i < message.keyPairs.length; i++) {\n videoElement[api.addKey](keySystem.systemString,\n message.keyPairs[i].key, message.keyPairs[i].keyID, sessionId);\n }\n }\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n }\n\n function closeKeySession(sessionToken) {\n // Send our request to the CDM\n try {\n videoElement[api.cancelKeyRequest](keySystem.systemString, sessionToken.sessionId);\n } catch (error) {\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: null,\n error: 'Error closing session (' + sessionToken.sessionId + ') ' + error.message\n });\n }\n }\n\n function setServerCertificate(/*serverCertificate*/) { /* Not supported */\n }\n\n function loadKeySession(/*ksInfo*/) { /* Not supported */\n }\n\n function removeKeySession(/*sessionToken*/) { /* Not supported */\n }\n\n function createEventHandler() {\n return {\n handleEvent: function (event) {\n let sessionToken = null;\n switch (event.type) {\n case api.needkey:\n let initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, { key: new NeedKey(initData, 'cenc') });\n break;\n\n case api.keyerror:\n sessionToken = findSessionByID(sessions, event.sessionId);\n if (!sessionToken) {\n sessionToken = findSessionByID(pendingSessions, event.sessionId);\n }\n\n if (sessionToken) {\n let code = ProtectionErrors.MEDIA_KEYERR_CODE;\n let msg = '';\n switch (event.errorCode.code) {\n case 1:\n code = ProtectionErrors.MEDIA_KEYERR_UNKNOWN_CODE;\n msg += 'MEDIA_KEYERR_UNKNOWN - ' + ProtectionErrors.MEDIA_KEYERR_UNKNOWN_MESSAGE;\n break;\n case 2:\n code = ProtectionErrors.MEDIA_KEYERR_CLIENT_CODE;\n msg += 'MEDIA_KEYERR_CLIENT - ' + ProtectionErrors.MEDIA_KEYERR_CLIENT_MESSAGE;\n break;\n case 3:\n code = ProtectionErrors.MEDIA_KEYERR_SERVICE_CODE;\n msg += 'MEDIA_KEYERR_SERVICE - ' + ProtectionErrors.MEDIA_KEYERR_SERVICE_MESSAGE;\n break;\n case 4:\n code = ProtectionErrors.MEDIA_KEYERR_OUTPUT_CODE;\n msg += 'MEDIA_KEYERR_OUTPUT - ' + ProtectionErrors.MEDIA_KEYERR_OUTPUT_MESSAGE;\n break;\n case 5:\n code = ProtectionErrors.MEDIA_KEYERR_HARDWARECHANGE_CODE;\n msg += 'MEDIA_KEYERR_HARDWARECHANGE - ' + ProtectionErrors.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;\n break;\n case 6:\n code = ProtectionErrors.MEDIA_KEYERR_DOMAIN_CODE;\n msg += 'MEDIA_KEYERR_DOMAIN - ' + ProtectionErrors.MEDIA_KEYERR_DOMAIN_MESSAGE;\n break;\n }\n msg += ' System Code = ' + event.systemCode;\n // TODO: Build error string based on key error\n eventBus.trigger(events.KEY_ERROR, { error: new DashJSError(code, msg, sessionToken) });\n } else {\n logger.error('No session token found for key error');\n }\n break;\n\n case api.keyadded:\n sessionToken = findSessionByID(sessions, event.sessionId);\n if (!sessionToken) {\n sessionToken = findSessionByID(pendingSessions, event.sessionId);\n }\n\n if (sessionToken) {\n logger.debug('DRM: Key added.');\n eventBus.trigger(events.KEY_ADDED, { data: sessionToken });//TODO not sure anything is using sessionToken? why there?\n } else {\n logger.debug('No session token found for key added');\n }\n break;\n\n case api.keymessage:\n // If this CDM does not support session IDs, we will be limited\n // to a single session\n moreSessionsAllowed = (event.sessionId !== null) && (event.sessionId !== undefined);\n\n // SessionIDs supported\n if (moreSessionsAllowed) {\n // Attempt to find an uninitialized token with this sessionId\n sessionToken = findSessionByID(sessions, event.sessionId);\n if (!sessionToken && pendingSessions.length > 0) {\n\n // This is the first message for our latest session, so set the\n // sessionId and add it to our list\n sessionToken = pendingSessions.shift();\n sessions.push(sessionToken);\n sessionToken.sessionId = event.sessionId;\n\n eventBus.trigger(events.KEY_SESSION_CREATED, { data: sessionToken });\n }\n } else if (pendingSessions.length > 0) { // SessionIDs not supported\n sessionToken = pendingSessions.shift();\n sessions.push(sessionToken);\n\n if (pendingSessions.length !== 0) {\n errHandler.error(new DashJSError(ProtectionErrors.MEDIA_KEY_MESSAGE_ERROR_CODE, ProtectionErrors.MEDIA_KEY_MESSAGE_ERROR_MESSAGE));\n }\n }\n\n if (sessionToken) {\n let message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message;\n\n // For ClearKey, the spec mandates that you pass this message to the\n // addKey method, so we always save it to the token since there is no\n // way to tell which key system is in use\n sessionToken.keyMessage = message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, { data: new KeyMessage(sessionToken, message, event.defaultURL) });\n\n } else {\n logger.warn('No session token found for key message');\n }\n break;\n }\n }\n };\n }\n\n\n /**\n * Helper function to retrieve the stored session token based on a given\n * sessionId value\n *\n * @param {Array} sessionArray - the array of sessions to search\n * @param {*} sessionId - the sessionId to search for\n * @returns {*} the session token with the given sessionId\n */\n function findSessionByID(sessionArray, sessionId) {\n if (!sessionId || !sessionArray) {\n return null;\n } else {\n const len = sessionArray.length;\n for (let i = 0; i < len; i++) {\n if (sessionArray[i].sessionId == sessionId) {\n return sessionArray[i];\n }\n }\n return null;\n }\n }\n\n function removeEventListeners() {\n videoElement.removeEventListener(api.keyerror, eventHandler);\n videoElement.removeEventListener(api.needkey, eventHandler);\n videoElement.removeEventListener(api.keymessage, eventHandler);\n videoElement.removeEventListener(api.keyadded, eventHandler);\n }\n\n instance = {\n getAllInitData,\n getSessions,\n requestKeySystemAccess,\n selectKeySystem,\n setMediaElement,\n createKeySession,\n updateKeySession,\n closeKeySession,\n setServerCertificate,\n loadKeySession,\n removeKeySession,\n stop: reset,\n reset\n };\n\n setup();\n\n return instance;\n}\n\nProtectionModel_01b.__dashjs_factory_name = 'ProtectionModel_01b';\nexport default dashjs.FactoryMaker.getClassFactory(ProtectionModel_01b); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Most recent EME implementation\n *\n * Implemented by Google Chrome v36+ (Windows, OSX, Linux)\n *\n * @implements ProtectionModel\n * @class\n */\nimport ProtectionKeyController from '../controllers/ProtectionKeyController';\nimport NeedKey from '../vo/NeedKey';\nimport ProtectionErrors from '../errors/ProtectionErrors';\nimport DashJSError from '../../vo/DashJSError';\nimport KeyMessage from '../vo/KeyMessage';\nimport KeySystemAccess from '../vo/KeySystemAccess';\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nconst SYSTEM_STRING_PRIORITY = {};\nSYSTEM_STRING_PRIORITY[ProtectionConstants.PLAYREADY_KEYSTEM_STRING] = [ProtectionConstants.PLAYREADY_KEYSTEM_STRING, ProtectionConstants.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING];\nSYSTEM_STRING_PRIORITY[ProtectionConstants.WIDEVINE_KEYSTEM_STRING] = [ProtectionConstants.WIDEVINE_KEYSTEM_STRING];\nSYSTEM_STRING_PRIORITY[ProtectionConstants.CLEARKEY_KEYSTEM_STRING] = [ProtectionConstants.CLEARKEY_KEYSTEM_STRING];\n\nfunction ProtectionModel_21Jan2015(config) {\n\n config = config || {};\n const context = this.context;\n const eventBus = config.eventBus;//Need to pass in here so we can use same instance since this is optional module\n const events = config.events;\n const debug = config.debug;\n\n let instance,\n logger,\n keySystem,\n videoElement,\n mediaKeys,\n sessions,\n eventHandler,\n protectionKeyController;\n\n function setup() {\n logger = debug.getLogger(instance);\n keySystem = null;\n videoElement = null;\n mediaKeys = null;\n sessions = [];\n protectionKeyController = ProtectionKeyController(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n const numSessions = sessions.length;\n let session;\n\n if (numSessions !== 0) {\n // Called when we are done closing a session. Success or fail\n const done = function (session) {\n removeSession(session);\n if (sessions.length === 0) {\n if (videoElement) {\n videoElement.removeEventListener('encrypted', eventHandler);\n videoElement.setMediaKeys(null).then(function () {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n });\n } else {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n }\n };\n for (let i = 0; i < numSessions; i++) {\n session = sessions[i];\n (function (s) {\n // Override closed promise resolver\n session.session.closed.then(function () {\n done(s);\n });\n // Close the session and handle errors, otherwise promise\n // resolver above will be called\n _closeKeySessionInternal(session).catch(function () {\n done(s);\n });\n\n })(session);\n }\n } else {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n }\n\n function stop() {\n // Close and remove not usable sessions\n let session;\n for (let i = 0; i < sessions.length; i++) {\n session = sessions[i];\n if (!session.getUsable()) {\n _closeKeySessionInternal(session).catch(function () {\n removeSession(session);\n });\n }\n }\n }\n\n function getAllInitData() {\n const retVal = [];\n for (let i = 0; i < sessions.length; i++) {\n if (sessions[i].initData) {\n retVal.push(sessions[i].initData);\n }\n }\n return retVal;\n }\n\n function getSessions() {\n return sessions;\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise((resolve, reject) => {\n _requestKeySystemAccessInternal(ksConfigurations, 0, resolve, reject);\n })\n }\n\n /**\n * Initializes access to a key system. Once we found a valid configuration we get a mediaKeySystemAccess object\n * @param ksConfigurations\n * @param idx\n * @param resolve\n * @param reject\n * @private\n */\n function _requestKeySystemAccessInternal(ksConfigurations, idx, resolve, reject) {\n\n // In case requestMediaKeySystemAccess is not available we can not proceed and dispatch an error\n if (navigator.requestMediaKeySystemAccess === undefined ||\n typeof navigator.requestMediaKeySystemAccess !== 'function') {\n const msg = 'Insecure origins are not allowed';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {error: msg});\n reject({error: msg});\n return;\n }\n\n // If a systemStringPriority is defined by the application we use these values. Otherwise we use the default system string\n // This is useful for DRM systems such as Playready for which multiple system strings are possible for instance com.microsoft.playready and com.microsoft.playready.recommendation\n const protDataSystemStringPriority = ksConfigurations[idx].protData && ksConfigurations[idx].protData.systemStringPriority ? ksConfigurations[idx].protData.systemStringPriority : null;\n const configs = ksConfigurations[idx].configs;\n const currentKeySystem = ksConfigurations[idx].ks;\n let systemString = currentKeySystem.systemString;\n\n // Use the default values in case no values are provided by the application\n const systemStringsToApply = protDataSystemStringPriority ? protDataSystemStringPriority : SYSTEM_STRING_PRIORITY[systemString] ? SYSTEM_STRING_PRIORITY[systemString] : [systemString];\n\n // Check all the available system strings and the available configurations for support\n _checkAccessForKeySystem(systemStringsToApply, configs)\n .then((mediaKeySystemAccess) => {\n const configuration = (typeof mediaKeySystemAccess.getConfiguration === 'function') ?\n mediaKeySystemAccess.getConfiguration() : null;\n const keySystemAccess = new KeySystemAccess(currentKeySystem, configuration);\n\n keySystemAccess.mksa = mediaKeySystemAccess;\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {data: keySystemAccess});\n resolve({data: keySystemAccess});\n })\n .catch((e) => {\n if (idx + 1 < ksConfigurations.length) {\n _requestKeySystemAccessInternal(ksConfigurations, idx + 1, resolve, reject);\n } else {\n const errorMessage = 'Key system access denied! ';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {error: errorMessage + e.message});\n reject({error: errorMessage + e.message});\n }\n })\n }\n\n /**\n * For a specific key system: Iterate over the possible system strings and resolve once a valid configuration was found\n * @param {array} systemStringsToApply\n * @param {object} configs\n * @return {Promise}\n * @private\n */\n function _checkAccessForKeySystem(systemStringsToApply, configs) {\n return new Promise((resolve, reject) => {\n _checkAccessForSystemStrings(systemStringsToApply, configs, 0, resolve, reject);\n })\n }\n\n /**\n * Recursively iterate over the possible system strings until a supported configuration is found or we ran out of options\n * @param {array} systemStringsToApply\n * @param {object} configs\n * @param {number} idx\n * @param {function} resolve\n * @param {function} reject\n * @private\n */\n function _checkAccessForSystemStrings(systemStringsToApply, configs, idx, resolve, reject) {\n const systemString = systemStringsToApply[idx];\n\n logger.debug(`Requesting key system access for system string ${systemString}`);\n\n navigator.requestMediaKeySystemAccess(systemString, configs)\n .then((mediaKeySystemAccess) => {\n mediaKeySystemAccess.selectedSystemString = systemString;\n resolve(mediaKeySystemAccess);\n })\n .catch((e) => {\n if (idx + 1 < systemStringsToApply.length) {\n _checkAccessForSystemStrings(systemStringsToApply, configs, idx + 1, resolve, reject);\n } else {\n reject(e);\n }\n });\n }\n\n /**\n * Selects a key system by creating the mediaKeys and adding them to the video element\n * @param keySystemAccess\n * @return {Promise<unknown>}\n */\n function selectKeySystem(keySystemAccess) {\n return new Promise((resolve, reject) => {\n keySystemAccess.mksa.createMediaKeys()\n .then((mkeys) => {\n keySystem = keySystemAccess.keySystem;\n mediaKeys = mkeys;\n if (videoElement) {\n return videoElement.setMediaKeys(mediaKeys)\n } else {\n return Promise.resolve();\n }\n })\n .then(() => {\n resolve(keySystem);\n })\n .catch(function () {\n reject({error: 'Error selecting keys system (' + keySystemAccess.keySystem.systemString + ')! Could not create MediaKeys -- TODO'});\n });\n })\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement)\n return;\n\n // Replacing the previous element\n if (videoElement) {\n videoElement.removeEventListener('encrypted', eventHandler);\n if (videoElement.setMediaKeys) {\n videoElement.setMediaKeys(null);\n }\n }\n\n videoElement = mediaElement;\n\n // Only if we are not detaching from the existing element\n if (videoElement) {\n videoElement.addEventListener('encrypted', eventHandler);\n if (videoElement.setMediaKeys && mediaKeys) {\n videoElement.setMediaKeys(mediaKeys);\n }\n }\n }\n\n function setServerCertificate(serverCertificate) {\n if (!keySystem || !mediaKeys) {\n throw new Error('Can not set server certificate until you have selected a key system');\n }\n mediaKeys.setServerCertificate(serverCertificate).then(function () {\n logger.info('DRM: License server certificate successfully updated.');\n eventBus.trigger(events.SERVER_CERTIFICATE_UPDATED);\n }).catch(function (error) {\n eventBus.trigger(events.SERVER_CERTIFICATE_UPDATED, {error: new DashJSError(ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_CODE, ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE + error.name)});\n });\n }\n\n /**\n * Create a key session, a session token and initialize a request by calling generateRequest\n * @param ksInfo\n */\n function createKeySession(ksInfo) {\n if (!keySystem || !mediaKeys) {\n throw new Error('Can not create sessions until you have selected a key system');\n }\n\n const session = mediaKeys.createSession(ksInfo.sessionType);\n const sessionToken = createSessionToken(session, ksInfo);\n\n\n // The \"keyids\" type is used for Clearkey when keys are provided directly in the protection data and a request to a license server is not needed\n const dataType = keySystem.systemString === ProtectionConstants.CLEARKEY_KEYSTEM_STRING && (ksInfo.initData || (ksInfo.protData && ksInfo.protData.clearkeys)) ? ProtectionConstants.INITIALIZATION_DATA_TYPE_KEYIDS : ProtectionConstants.INITIALIZATION_DATA_TYPE_CENC;\n\n session.generateRequest(dataType, ksInfo.initData).then(function () {\n logger.debug('DRM: Session created. SessionID = ' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, {data: sessionToken});\n }).catch(function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE, ProtectionErrors.KEY_SESSION_CREATED_ERROR_MESSAGE + 'Error generating key request -- ' + error.name)\n });\n });\n }\n\n function updateKeySession(sessionToken, message) {\n const session = sessionToken.session;\n\n // Send our request to the key session\n if (protectionKeyController.isClearKey(keySystem)) {\n message = message.toJWK();\n }\n session.update(message)\n .then(() => {\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n })\n .catch(function (error) {\n eventBus.trigger(events.KEY_ERROR, {error: new DashJSError(ProtectionErrors.MEDIA_KEYERR_CODE, 'Error sending update() message! ' + error.name, sessionToken)});\n });\n }\n\n function loadKeySession(ksInfo) {\n if (!keySystem || !mediaKeys) {\n throw new Error('Can not load sessions until you have selected a key system');\n }\n\n const sessionId = ksInfo.sessionId;\n\n // Check if session Id is not already loaded or loading\n for (let i = 0; i < sessions.length; i++) {\n if (sessionId === sessions[i].sessionId) {\n logger.warn('DRM: Ignoring session ID because we have already seen it!');\n return;\n }\n }\n\n const session = mediaKeys.createSession(ksInfo.sessionType);\n const sessionToken = createSessionToken(session, ksInfo);\n\n // Load persisted session data into our newly created session object\n session.load(sessionId).then(function (success) {\n if (success) {\n logger.debug('DRM: Session loaded. SessionID = ' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, {data: sessionToken});\n } else {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE, ProtectionErrors.KEY_SESSION_CREATED_ERROR_MESSAGE + 'Could not load session! Invalid Session ID (' + sessionId + ')')\n });\n }\n }).catch(function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new DashJSError(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE, ProtectionErrors.KEY_SESSION_CREATED_ERROR_MESSAGE + 'Could not load session (' + sessionId + ')! ' + error.name)\n });\n });\n }\n\n function removeKeySession(sessionToken) {\n const session = sessionToken.session;\n\n session.remove().then(function () {\n logger.debug('DRM: Session removed. SessionID = ' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_REMOVED, {data: sessionToken.getSessionId()});\n }, function (error) {\n eventBus.trigger(events.KEY_SESSION_REMOVED, {\n data: null,\n error: 'Error removing session (' + sessionToken.getSessionId() + '). ' + error.name\n });\n\n });\n }\n\n function closeKeySession(sessionToken) {\n // Send our request to the key session\n _closeKeySessionInternal(sessionToken).catch(function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: null,\n error: 'Error closing session (' + sessionToken.getSessionId() + ') ' + error.name\n });\n });\n }\n\n function _closeKeySessionInternal(sessionToken) {\n const session = sessionToken.session;\n\n // Remove event listeners\n session.removeEventListener('keystatuseschange', sessionToken);\n session.removeEventListener('message', sessionToken);\n\n // Send our request to the key session\n return session.close();\n }\n\n // This is our main event handler for all desired HTMLMediaElement events\n // related to EME. These events are translated into our API-independent\n // versions of the same events\n function createEventHandler() {\n return {\n handleEvent: function (event) {\n switch (event.type) {\n case 'encrypted':\n if (event.initData) {\n let initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, {key: new NeedKey(initData, event.initDataType)});\n }\n break;\n }\n }\n };\n }\n\n function removeSession(token) {\n // Remove from our session list\n for (let i = 0; i < sessions.length; i++) {\n if (sessions[i] === token) {\n sessions.splice(i, 1);\n break;\n }\n }\n }\n\n function parseKeyStatus(args) {\n // Edge and Chrome implement different version of keystatues, param are not on same order\n let status, keyId;\n if (args && args.length > 0) {\n if (args[0]) {\n if (typeof args[0] === 'string') {\n status = args[0];\n } else {\n keyId = args[0];\n }\n }\n\n if (args[1]) {\n if (typeof args[1] === 'string') {\n status = args[1];\n } else {\n keyId = args[1];\n }\n }\n }\n return {\n status: status,\n keyId: keyId\n };\n }\n\n // Function to create our session token objects which manage the EME\n // MediaKeySession and session-specific event handler\n function createSessionToken(session, ksInfo) {\n const token = { // Implements SessionToken\n session: session,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n sessionId: ksInfo.sessionId,\n sessionType: ksInfo.sessionType,\n\n // This is our main event handler for all desired MediaKeySession events\n // These events are translated into our API-independent versions of the\n // same events\n handleEvent: function (event) {\n switch (event.type) {\n case 'keystatuseschange':\n eventBus.trigger(events.KEY_STATUSES_CHANGED, {data: this});\n event.target.keyStatuses.forEach(function () {\n let keyStatus = parseKeyStatus(arguments);\n switch (keyStatus.status) {\n case 'expired':\n eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, {error: new DashJSError(ProtectionErrors.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE, ProtectionErrors.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});\n break;\n default:\n eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, keyStatus);\n break;\n }\n });\n break;\n\n case 'message':\n let message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, {data: new KeyMessage(this, message, undefined, event.messageType)});\n break;\n }\n },\n\n getKeyId: function () {\n return this.keyId;\n },\n\n getSessionId: function () {\n return session.sessionId;\n },\n\n getSessionType: function () {\n return this.sessionType;\n },\n\n getExpirationTime: function () {\n return session.expiration;\n },\n\n getKeyStatuses: function () {\n return session.keyStatuses;\n },\n\n getUsable: function () {\n let usable = false;\n session.keyStatuses.forEach(function () {\n let keyStatus = parseKeyStatus(arguments);\n if (keyStatus.status === 'usable') {\n usable = true;\n }\n });\n return usable;\n }\n };\n\n // Add all event listeners\n session.addEventListener('keystatuseschange', token);\n session.addEventListener('message', token);\n\n // Register callback for session closed Promise\n session.closed.then(() => {\n removeSession(token);\n logger.debug('DRM: Session closed. SessionID = ' + token.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CLOSED, {data: token.getSessionId()});\n });\n\n // Add to our session list\n sessions.push(token);\n\n return token;\n }\n\n instance = {\n getAllInitData,\n getSessions,\n requestKeySystemAccess,\n selectKeySystem,\n setMediaElement,\n setServerCertificate,\n createKeySession,\n updateKeySession,\n loadKeySession,\n removeKeySession,\n closeKeySession,\n stop,\n reset\n };\n\n setup();\n\n return instance;\n}\n\nProtectionModel_21Jan2015.__dashjs_factory_name = 'ProtectionModel_21Jan2015';\nexport default dashjs.FactoryMaker.getClassFactory(ProtectionModel_21Jan2015); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Implementation of the EME APIs as of the 3 Feb 2014 state of the specification.\n *\n * Implemented by Internet Explorer 11 (Windows 8.1)\n *\n * @implements ProtectionModel\n * @class\n */\n\nimport ProtectionKeyController from '../controllers/ProtectionKeyController';\nimport NeedKey from '../vo/NeedKey';\nimport DashJSError from '../../vo/DashJSError';\nimport ProtectionErrors from '../errors/ProtectionErrors';\nimport KeyMessage from '../vo/KeyMessage';\nimport KeySystemConfiguration from '../vo/KeySystemConfiguration';\nimport KeySystemAccess from '../vo/KeySystemAccess';\n\nfunction ProtectionModel_3Feb2014(config) {\n\n config = config || {};\n const context = this.context;\n const eventBus = config.eventBus;//Need to pass in here so we can use same instance since this is optional module\n const events = config.events;\n const debug = config.debug;\n const api = config.api;\n\n let instance,\n logger,\n videoElement,\n keySystem,\n mediaKeys,\n keySystemAccess,\n sessions,\n eventHandler,\n protectionKeyController;\n\n function setup() {\n logger = debug.getLogger(instance);\n videoElement = null;\n keySystem = null;\n mediaKeys = null;\n keySystemAccess = null;\n sessions = [];\n protectionKeyController = ProtectionKeyController(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n try {\n for (let i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n if (videoElement) {\n videoElement.removeEventListener(api.needkey, eventHandler);\n }\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n } catch (error) {\n eventBus.trigger(events.TEARDOWN_COMPLETE, { error: 'Error tearing down key sessions and MediaKeys! -- ' + error.message });\n }\n }\n\n function getAllInitData() {\n const retVal = [];\n for (let i = 0; i < sessions.length; i++) {\n retVal.push(sessions[i].initData);\n }\n return retVal;\n }\n\n function getSessions() {\n return sessions;\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise((resolve, reject) => {\n // Try key systems in order, first one with supported key system configuration\n // is used\n let found = false;\n for (let ksIdx = 0; ksIdx < ksConfigurations.length; ksIdx++) {\n const systemString = ksConfigurations[ksIdx].ks.systemString;\n const configs = ksConfigurations[ksIdx].configs;\n let supportedAudio = null;\n let supportedVideo = null;\n\n // Try key system configs in order, first one with supported audio/video\n // is used\n for (let configIdx = 0; configIdx < configs.length; configIdx++) {\n const audios = configs[configIdx].audioCapabilities;\n const videos = configs[configIdx].videoCapabilities;\n\n // Look for supported audio container/codecs\n if (audios && audios.length !== 0) {\n supportedAudio = []; // Indicates that we have a requested audio config\n for (let audioIdx = 0; audioIdx < audios.length; audioIdx++) {\n if (window[api.MediaKeys].isTypeSupported(systemString, audios[audioIdx].contentType)) {\n supportedAudio.push(audios[audioIdx]);\n }\n }\n }\n\n // Look for supported video container/codecs\n if (videos && videos.length !== 0) {\n supportedVideo = []; // Indicates that we have a requested video config\n for (let videoIdx = 0; videoIdx < videos.length; videoIdx++) {\n if (window[api.MediaKeys].isTypeSupported(systemString, videos[videoIdx].contentType)) {\n supportedVideo.push(videos[videoIdx]);\n }\n }\n }\n\n // No supported audio or video in this configuration OR we have\n // requested audio or video configuration that is not supported\n if ((!supportedAudio && !supportedVideo) ||\n (supportedAudio && supportedAudio.length === 0) ||\n (supportedVideo && supportedVideo.length === 0)) {\n continue;\n }\n\n // This configuration is supported\n found = true;\n const ksConfig = new KeySystemConfiguration(supportedAudio, supportedVideo);\n const ks = protectionKeyController.getKeySystemBySystemString(systemString);\n const keySystemAccess = new KeySystemAccess(ks, ksConfig);\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, { data: keySystemAccess });\n resolve({ data: keySystemAccess });\n break;\n }\n }\n if (!found) {\n const errorMessage = 'Key system access denied! -- No valid audio/video content configurations detected!';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, { error: errorMessage });\n reject({ error: errorMessage });\n }\n })\n }\n\n function selectKeySystem(ksAccess) {\n return new Promise((resolve, reject) => {\n try {\n mediaKeys = ksAccess.mediaKeys = new window[api.MediaKeys](ksAccess.keySystem.systemString);\n keySystem = ksAccess.keySystem;\n keySystemAccess = ksAccess;\n if (videoElement) {\n setMediaKeys();\n }\n resolve(keySystem);\n } catch (error) {\n reject({ error: 'Error selecting keys system (' + keySystem.systemString + ')! Could not create MediaKeys -- TODO' });\n }\n })\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement)\n return;\n\n // Replacing the previous element\n if (videoElement) {\n videoElement.removeEventListener(api.needkey, eventHandler);\n }\n\n videoElement = mediaElement;\n\n // Only if we are not detaching from the existing element\n if (videoElement) {\n videoElement.addEventListener(api.needkey, eventHandler);\n if (mediaKeys) {\n setMediaKeys();\n }\n }\n }\n\n function createKeySession(ksInfo) {\n if (!keySystem || !mediaKeys || !keySystemAccess) {\n throw new Error('Can not create sessions until you have selected a key system');\n }\n\n // Use the first video capability for the contentType.\n // TODO: Not sure if there is a way to concatenate all capability data into a RFC6386-compatible format\n\n // If player is trying to playback Audio only stream - don't error out.\n let capabilities = null;\n\n if (keySystemAccess.ksConfiguration.videoCapabilities && keySystemAccess.ksConfiguration.videoCapabilities.length > 0) {\n capabilities = keySystemAccess.ksConfiguration.videoCapabilities[0];\n }\n\n if (capabilities === null && keySystemAccess.ksConfiguration.audioCapabilities && keySystemAccess.ksConfiguration.audioCapabilities.length > 0) {\n capabilities = keySystemAccess.ksConfiguration.audioCapabilities[0];\n }\n\n if (capabilities === null) {\n throw new Error('Can not create sessions for unknown content types.');\n }\n\n const contentType = capabilities.contentType;\n const session = mediaKeys.createSession(contentType, new Uint8Array(ksInfo.initData), ksInfo.cdmData ? new Uint8Array(ksInfo.cdmData) : null);\n const sessionToken = createSessionToken(session, ksInfo);\n\n // Add all event listeners\n session.addEventListener(api.error, sessionToken);\n session.addEventListener(api.message, sessionToken);\n session.addEventListener(api.ready, sessionToken);\n session.addEventListener(api.close, sessionToken);\n\n // Add to our session list\n sessions.push(sessionToken);\n logger.debug('DRM: Session created. SessionID = ' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, { data: sessionToken });\n }\n\n function updateKeySession(sessionToken, message) {\n const session = sessionToken.session;\n\n if (!protectionKeyController.isClearKey(keySystem)) {\n // Send our request to the key session\n session.update(new Uint8Array(message));\n } else {\n // For clearkey, message is a ClearKeyKeySet\n session.update(new Uint8Array(message.toJWK()));\n }\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n }\n\n /**\n * Close the given session and release all associated keys. Following\n * this call, the sessionToken becomes invalid\n *\n * @param {Object} sessionToken - the session token\n */\n function closeKeySession(sessionToken) {\n const session = sessionToken.session;\n\n // Remove event listeners\n session.removeEventListener(api.error, sessionToken);\n session.removeEventListener(api.message, sessionToken);\n session.removeEventListener(api.ready, sessionToken);\n session.removeEventListener(api.close, sessionToken);\n\n // Remove from our session list\n for (let i = 0; i < sessions.length; i++) {\n if (sessions[i] === sessionToken) {\n sessions.splice(i, 1);\n break;\n }\n }\n\n // Send our request to the key session\n session[api.release]();\n }\n\n function setServerCertificate(/*serverCertificate*/) { /* Not supported */\n }\n\n function loadKeySession(/*ksInfo*/) { /* Not supported */\n }\n\n function removeKeySession(/*sessionToken*/) { /* Not supported */\n }\n\n\n function createEventHandler() {\n return {\n handleEvent: function (event) {\n switch (event.type) {\n\n case api.needkey:\n if (event.initData) {\n const initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, { key: new NeedKey(initData, 'cenc') });\n }\n break;\n }\n }\n };\n }\n\n\n // IE11 does not let you set MediaKeys until it has entered a certain\n // readyState, so we need this logic to ensure we don't set the keys\n // too early\n function setMediaKeys() {\n let boundDoSetKeys = null;\n const doSetKeys = function () {\n videoElement.removeEventListener('loadedmetadata', boundDoSetKeys);\n videoElement[api.setMediaKeys](mediaKeys);\n eventBus.trigger(events.VIDEO_ELEMENT_SELECTED);\n };\n if (videoElement.readyState >= 1) {\n doSetKeys();\n } else {\n boundDoSetKeys = doSetKeys.bind(this);\n videoElement.addEventListener('loadedmetadata', boundDoSetKeys);\n }\n\n }\n\n // Function to create our session token objects which manage the EME\n // MediaKeySession and session-specific event handler\n function createSessionToken(keySession, ksInfo) {\n return {\n // Implements SessionToken\n session: keySession,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n\n getKeyId: function () {\n return this.keyId;\n },\n\n getSessionId: function () {\n return this.session.sessionId;\n },\n\n getExpirationTime: function () {\n return NaN;\n },\n\n getSessionType: function () {\n return 'temporary';\n },\n\n // This is our main event handler for all desired MediaKeySession events\n // These events are translated into our API-independent versions of the\n // same events\n handleEvent: function (event) {\n switch (event.type) {\n case api.error:\n let errorStr = 'KeyError'; // TODO: Make better string from event\n eventBus.trigger(events.KEY_ERROR, { error: new DashJSError(ProtectionErrors.MEDIA_KEYERR_CODE, errorStr, this) });\n break;\n case api.message:\n let message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, { data: new KeyMessage(this, message, event.destinationURL) });\n break;\n case api.ready:\n logger.debug('DRM: Key added.');\n eventBus.trigger(events.KEY_ADDED);\n break;\n\n case api.close:\n logger.debug('DRM: Session closed. SessionID = ' + this.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CLOSED, { data: this.getSessionId() });\n break;\n }\n }\n };\n }\n\n instance = {\n getAllInitData,\n getSessions,\n requestKeySystemAccess,\n selectKeySystem,\n setMediaElement,\n createKeySession,\n updateKeySession,\n closeKeySession,\n setServerCertificate,\n loadKeySession,\n removeKeySession,\n stop: reset,\n reset\n };\n\n setup();\n\n return instance;\n}\n\nProtectionModel_3Feb2014.__dashjs_factory_name = 'ProtectionModel_3Feb2014';\nexport default dashjs.FactoryMaker.getClassFactory(ProtectionModel_3Feb2014); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * CableLabs ClearKey license server implementation\n *\n * For testing purposes and evaluating potential uses for ClearKey, we have developed\n * a dirt-simple API for requesting ClearKey licenses from a remote server.\n *\n * @implements LicenseServer\n * @class\n */\nimport KeyPair from '../vo/KeyPair';\nimport ClearKeyKeySet from '../vo/ClearKeyKeySet';\n\nfunction ClearKey() {\n\n let instance;\n\n function getServerURLFromMessage(url /* message, messageType*/) {\n return url;\n }\n\n function getHTTPMethod(/*messageType*/) {\n return 'POST';\n }\n\n function getResponseType(/*keySystemStr*/) {\n return 'json';\n }\n\n function getLicenseMessage(serverResponse/*, keySystemStr, messageType*/) {\n if (!serverResponse.hasOwnProperty('keys')) {\n return null;\n }\n let keyPairs = [];\n for (let i = 0; i < serverResponse.keys.length; i++) {\n let keypair = serverResponse.keys[i];\n let keyid = keypair.kid.replace(/=/g, '');\n let key = keypair.k.replace(/=/g, '');\n\n keyPairs.push(new KeyPair(keyid, key));\n }\n return new ClearKeyKeySet(keyPairs);\n }\n\n function getErrorResponse(serverResponse/*, keySystemStr, messageType*/) {\n return String.fromCharCode.apply(null, new Uint8Array(serverResponse));\n }\n\n instance = {\n getServerURLFromMessage,\n getHTTPMethod,\n getResponseType,\n getLicenseMessage,\n getErrorResponse\n };\n\n return instance;\n}\n\nClearKey.__dashjs_factory_name = 'ClearKey';\nexport default dashjs.FactoryMaker.getSingletonFactory(ClearKey); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * CastLabs DRMToday License Server implementation\n *\n * @implements LicenseServer\n * @class\n */\n\nimport ProtectionConstants from '../../constants/ProtectionConstants';\n\nfunction DRMToday(config) {\n\n config = config || {};\n const BASE64 = config.BASE64;\n\n const keySystems = {};\n keySystems[ProtectionConstants.WIDEVINE_KEYSTEM_STRING] = {\n responseType: 'json',\n getLicenseMessage: function (response) {\n return BASE64.decodeArray(response.license);\n },\n getErrorResponse: function (response) {\n return response;\n }\n };\n keySystems[ProtectionConstants.PLAYREADY_KEYSTEM_STRING] = {\n responseType: 'arraybuffer',\n getLicenseMessage: function (response) {\n return response;\n },\n getErrorResponse: function (response) {\n return String.fromCharCode.apply(null, new Uint8Array(response));\n }\n };\n\n let instance;\n\n function checkConfig() {\n if (!BASE64 || !BASE64.hasOwnProperty('decodeArray')) {\n throw new Error('Missing config parameter(s)');\n }\n }\n\n function getServerURLFromMessage(url /*, message, messageType*/) {\n return url;\n }\n\n function getHTTPMethod(/*messageType*/) {\n return 'POST';\n }\n\n function getResponseType(keySystemStr/*, messageType*/) {\n return keySystems[keySystemStr].responseType;\n }\n\n function getLicenseMessage(serverResponse, keySystemStr/*, messageType*/) {\n checkConfig();\n return keySystems[keySystemStr].getLicenseMessage(serverResponse);\n }\n\n function getErrorResponse(serverResponse, keySystemStr/*, messageType*/) {\n return keySystems[keySystemStr].getErrorResponse(serverResponse);\n }\n\n instance = {\n getServerURLFromMessage,\n getHTTPMethod,\n getResponseType,\n getLicenseMessage,\n getErrorResponse\n };\n\n return instance;\n}\n\nDRMToday.__dashjs_factory_name = 'DRMToday';\nexport default dashjs.FactoryMaker.getSingletonFactory(DRMToday); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global escape: true */\n\n/**\n * Microsoft PlayReady Test License Server\n *\n * For testing content that uses the PlayReady test server at\n *\n * @implements LicenseServer\n * @class\n * @ignore\n */\n\nfunction PlayReady() {\n\n let instance;\n\n const soap = 'http://schemas.xmlsoap.org/soap/envelope/';\n\n function uintToString(arrayBuffer) {\n const encodedString = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));\n const decodedString = decodeURIComponent(escape(encodedString));\n return decodedString;\n }\n\n function parseServerResponse(serverResponse) {\n if (window.DOMParser) {\n const stringResponse = uintToString(serverResponse);\n const parser = new window.DOMParser();\n const xmlDoc = parser.parseFromString(stringResponse, 'text/xml');\n const envelope = xmlDoc ? xmlDoc.getElementsByTagNameNS(soap, 'Envelope')[0] : null;\n const body = envelope ? envelope.getElementsByTagNameNS(soap, 'Body')[0] : null;\n const fault = body ? body.getElementsByTagNameNS(soap, 'Fault')[0] : null;\n\n if (fault) {\n return null;\n }\n }\n return serverResponse;\n }\n\n function parseErrorResponse(serverResponse) {\n let faultstring = '';\n let statusCode = '';\n let message = '';\n let idStart = -1;\n let idEnd = -1;\n\n if (window.DOMParser) {\n const stringResponse = uintToString(serverResponse);\n const parser = new window.DOMParser();\n const xmlDoc = parser.parseFromString(stringResponse, 'text/xml');\n const envelope = xmlDoc ? xmlDoc.getElementsByTagNameNS(soap, 'Envelope')[0] : null;\n const body = envelope ? envelope.getElementsByTagNameNS(soap, 'Body')[0] : null;\n const fault = body ? body.getElementsByTagNameNS(soap, 'Fault')[0] : null;\n const detail = fault ? fault.getElementsByTagName('detail')[0] : null;\n const exception = detail ? detail.getElementsByTagName('Exception')[0] : null;\n let node = null;\n\n if (fault === null) {\n return stringResponse;\n }\n\n node = fault.getElementsByTagName('faultstring')[0].firstChild;\n faultstring = node ? node.nodeValue : null;\n\n if (exception !== null) {\n node = exception.getElementsByTagName('StatusCode')[0];\n statusCode = node ? node.firstChild.nodeValue : null;\n node = exception.getElementsByTagName('Message')[0];\n message = node ? node.firstChild.nodeValue : null;\n idStart = message ? message.lastIndexOf('[') + 1 : -1;\n idEnd = message ? message.indexOf(']') : -1;\n message = message ? message.substring(idStart, idEnd) : '';\n }\n }\n\n let errorString = `code: ${statusCode}, name: ${faultstring}`;\n if (message) {\n errorString += `, message: ${message}`;\n }\n\n return errorString;\n }\n\n function getServerURLFromMessage(url /*, message, messageType*/) {\n return url;\n }\n\n function getHTTPMethod(/*messageType*/) {\n return 'POST';\n }\n\n function getResponseType(/*keySystemStr, messageType*/) {\n return 'arraybuffer';\n }\n\n function getLicenseMessage(serverResponse/*, keySystemStr, messageType*/) {\n return parseServerResponse.call(this, serverResponse);\n }\n\n function getErrorResponse(serverResponse/*, keySystemStr, messageType*/) {\n return parseErrorResponse.call(this, serverResponse);\n }\n\n instance = {\n getServerURLFromMessage,\n getHTTPMethod,\n getResponseType,\n getLicenseMessage,\n getErrorResponse\n };\n\n return instance;\n}\n\nPlayReady.__dashjs_factory_name = 'PlayReady';\nexport default dashjs.FactoryMaker.getSingletonFactory(PlayReady); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction Widevine() {\n\n let instance;\n\n function getServerURLFromMessage(url /*, message, messageType*/) {\n return url;\n }\n\n function getHTTPMethod(/*messageType*/) {\n return 'POST';\n }\n\n function getResponseType(/*keySystemStr, messageType*/) {\n return 'arraybuffer';\n }\n\n function getLicenseMessage(serverResponse/*, keySystemStr, messageType*/) {\n return serverResponse;\n }\n\n function getErrorResponse(serverResponse/*, keySystemStr, messageType*/) {\n return String.fromCharCode.apply(null, new Uint8Array(serverResponse));\n }\n\n instance = {\n getServerURLFromMessage,\n getHTTPMethod,\n getResponseType,\n getLicenseMessage,\n getErrorResponse\n };\n\n return instance;\n}\n\nWidevine.__dashjs_factory_name = 'Widevine';\nexport default dashjs.FactoryMaker.getSingletonFactory(Widevine); /* jshint ignore:line */\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc A collection of ClearKey encryption keys with an (optional) associated\n * type\n * @ignore\n */\nclass ClearKeyKeySet {\n /**\n * @param {Array.<KeyPair>} keyPairs\n * @param {string} type the type of keys in this set. One of either 'persistent'\n * or 'temporary'. Can also be null or undefined.\n * @class\n * @ignore\n */\n constructor(keyPairs, type) {\n if (type && type !== 'persistent' && type !== 'temporary')\n throw new Error('Invalid ClearKey key set type! Must be one of \\'persistent\\' or \\'temporary\\'');\n this.keyPairs = keyPairs;\n this.type = type;\n }\n\n /**\n * Convert this key set to its JSON Web Key (JWK) representation\n *\n * @return {ArrayBuffer} JWK object UTF-8 encoded as ArrayBuffer\n */\n toJWK() {\n let i;\n let numKeys = this.keyPairs.length;\n let jwk = {keys: []};\n\n for (i = 0; i < numKeys; i++) {\n let key = {\n kty: 'oct',\n alg: 'A128KW',\n kid: this.keyPairs[i].keyID,\n k: this.keyPairs[i].key\n };\n jwk.keys.push(key);\n }\n if (this.type) {\n jwk.type = this.type;\n }\n let jwkString = JSON.stringify(jwk);\n const len = jwkString.length;\n\n // Convert JSON string to ArrayBuffer\n let buf = new ArrayBuffer(len);\n let bView = new Uint8Array(buf);\n for (i = 0; i < len; i++)\n bView[i] = jwkString.charCodeAt(i);\n return buf;\n }\n}\n\nexport default ClearKeyKeySet;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc EME-independent KeyMessage\n * @ignore\n */\nclass KeyMessage {\n /**\n * @param {SessionToken} sessionToken the session\n * to which the key message is associated\n * @param {ArrayBuffer} message the key message\n * @param {string} defaultURL license acquisition URL provided by the CDM\n * @param {string} messageType Supported message types can be found\n * {@link https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType|here}.\n * @class\n */\n constructor(sessionToken, message, defaultURL, messageType) {\n this.sessionToken = sessionToken;\n this.message = message;\n this.defaultURL = defaultURL;\n this.messageType = messageType ? messageType : 'license-request';\n }\n}\n\nexport default KeyMessage;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc Represents a 128-bit keyID and 128-bit encryption key\n * @ignore\n */\nclass KeyPair {\n /**\n * @param {string} keyID 128-bit key ID, base64 encoded, with no padding\n * @param {string} key 128-bit encryption key, base64 encoded, with no padding\n * @class\n * @ignore\n */\n constructor(keyID, key) {\n this.keyID = keyID;\n this.key = key;\n }\n}\n\nexport default KeyPair;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc Creates a new key system access token. Represents a valid key system for\n * given piece of content and key system requirements. Used to initialize license\n * acquisition operations.\n * @ignore\n */\nclass KeySystemAccess {\n /**\n * @param {MediaPlayer.dependencies.protection.KeySystem} keySystem the key system\n * @param {KeySystemConfiguration} ksConfiguration the\n * subset of configurations passed to the key system access request that are supported\n * by this user agent\n * @class\n * @ignore\n */\n constructor(keySystem, ksConfiguration) {\n this.keySystem = keySystem;\n this.ksConfiguration = ksConfiguration;\n }\n}\n\nexport default KeySystemAccess;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Represents a set of configurations that describe the capabilities desired for\n * support by a given CDM\n * @ignore\n */\nclass KeySystemConfiguration {\n /**\n * @param {Array.<MediaCapability>} audioCapabilities array of\n * desired audio capabilities. Higher preference capabilities should be placed earlier\n * in the array.\n * @param {Array.<MediaCapability>} videoCapabilities array of\n * desired video capabilities. Higher preference capabilities should be placed earlier\n * in the array.\n * @param {string} distinctiveIdentifier desired use of distinctive identifiers.\n * One of \"required\", \"optional\", or \"not-allowed\"\n * @param {string} persistentState desired support for persistent storage of\n * key systems. One of \"required\", \"optional\", or \"not-allowed\"\n * @param {Array.<string>} sessionTypes List of session types that must\n * be supported by the key system\n * @class\n */\n constructor(audioCapabilities, videoCapabilities, distinctiveIdentifier, persistentState, sessionTypes) {\n this.initDataTypes = [ 'cenc' ];\n if (audioCapabilities && audioCapabilities.length) {\n this.audioCapabilities = audioCapabilities;\n }\n if (videoCapabilities && videoCapabilities.length) {\n this.videoCapabilities = videoCapabilities;\n }\n this.distinctiveIdentifier = distinctiveIdentifier;\n this.persistentState = persistentState;\n this.sessionTypes = sessionTypes;\n }\n}\n\nexport default KeySystemConfiguration;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc Defines a license request\n * @ignore\n */\nclass LicenseRequest {\n /**\n * Defines a license request\n *\n * @class\n */\n constructor(url, method, responseType, headers, withCredentials, messageType, sessionId, data) {\n\n /**\n * The license request url\n */\n this.url = url;\n\n /**\n * The HTTP method\n */\n this.method = method;\n\n /**\n * The HTTP response type\n */\n this.responseType = responseType;\n\n /**\n * The HTP request headers\n */\n this.headers = headers;\n\n /**\n * Wether request is done using credentials (cross-site cookies)\n */\n this.withCredentials = withCredentials;\n\n /**\n * The license request message type (see https://www.w3.org/TR/encrypted-media/#dom-mediakeymessagetype)\n */\n this.messageType = messageType;\n\n /**\n * The corresponding EME session ID\n */\n this.sessionId = sessionId;\n\n /**\n * The license request data\n */\n this.data = data;\n }\n}\n\nexport default LicenseRequest;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc Defines a license response\n */\nclass LicenseResponse {\n /**\n * Defines a license request\n *\n * @class\n * @ignore\n */\n constructor(url, headers, data) {\n\n /**\n * The url that was loaded, that can be redirected from original request url\n */\n this.url = url;\n\n /**\n * The HTP response headers\n */\n this.headers = headers;\n\n /**\n * The license response data\n */\n this.data = data;\n }\n}\n\nexport default LicenseResponse;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc A media capability\n * @ignore\n */\nclass MediaCapability {\n /**\n * @param {string} contentType MIME type and codecs (RFC6386)\n * @param {string} robustness\n * @class\n * @ignore\n */\n constructor(contentType, robustness) {\n this.contentType = contentType;\n this.robustness = robustness;\n }\n}\n\nexport default MediaCapability;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc NeedKey\n * @ignore\n */\nclass NeedKey {\n /**\n * @param {ArrayBuffer} initData the initialization data\n * @param {string} initDataType initialization data type\n * @class\n */\n constructor(initData, initDataType) {\n this.initData = initData;\n this.initDataType = initDataType;\n }\n}\n\nexport default NeedKey;\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @class\n * @ignore\n */\nclass DashJSError {\n constructor(code, message, data) {\n this.code = code || null;\n this.message = message || null;\n this.data = data || null;\n }\n}\n\nexport default DashJSError;","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * @classdesc This Object holds reference to the HTTPRequest for manifest, fragment and xlink loading.\n * Members which are not defined in ISO23009-1 Annex D should be prefixed by a _ so that they are ignored\n * by Metrics Reporting code.\n * @ignore\n */\nclass HTTPRequest {\n /**\n * @class\n */\n constructor() {\n /**\n * Identifier of the TCP connection on which the HTTP request was sent.\n * @public\n */\n this.tcpid = null;\n /**\n * This is an optional parameter and should not be included in HTTP request/response transactions for progressive download.\n * The type of the request:\n * - MPD\n * - XLink expansion\n * - Initialization Fragment\n * - Index Fragment\n * - Media Fragment\n * - Bitstream Switching Fragment\n * - other\n * @public\n */\n this.type = null;\n /**\n * The original URL (before any redirects or failures)\n * @public\n */\n this.url = null;\n /**\n * The actual URL requested, if different from above\n * @public\n */\n this.actualurl = null;\n /**\n * The contents of the byte-range-spec part of the HTTP Range header.\n * @public\n */\n this.range = null;\n /**\n * Real-Time | The real time at which the request was sent.\n * @public\n */\n this.trequest = null;\n /**\n * Real-Time | The real time at which the first byte of the response was received.\n * @public\n */\n this.tresponse = null;\n /**\n * The HTTP response code.\n * @public\n */\n this.responsecode = null;\n /**\n * The duration of the throughput trace intervals (ms), for successful requests only.\n * @public\n */\n this.interval = null;\n /**\n * Throughput traces, for successful requests only.\n * @public\n */\n this.trace = [];\n\n /**\n * Type of stream (\"audio\" | \"video\" etc..)\n * @public\n */\n this._stream = null;\n /**\n * Real-Time | The real time at which the request finished.\n * @public\n */\n this._tfinish = null;\n /**\n * The duration of the media requests, if available, in seconds.\n * @public\n */\n this._mediaduration = null;\n /**\n * The media segment quality\n * @public\n */\n this._quality = null;\n /**\n * all the response headers from request.\n * @public\n */\n this._responseHeaders = null;\n /**\n * The selected service location for the request. string.\n * @public\n */\n this._serviceLocation = null;\n /**\n * The type of the loader that was used. Distinguish between fetch loader and xhr loader\n */\n this._fileLoaderType = null;\n }\n}\n\n/**\n * @classdesc This Object holds reference to the progress of the HTTPRequest.\n * @ignore\n */\nclass HTTPRequestTrace {\n /**\n * @class\n */\n constructor() {\n /**\n * Real-Time | Measurement stream start.\n * @public\n */\n this.s = null;\n /**\n * Measurement stream duration (ms).\n * @public\n */\n this.d = null;\n /**\n * List of integers counting the bytes received in each trace interval within the measurement stream.\n * @public\n */\n this.b = [];\n }\n}\n\nHTTPRequest.GET = 'GET';\nHTTPRequest.HEAD = 'HEAD';\nHTTPRequest.MPD_TYPE = 'MPD';\nHTTPRequest.XLINK_EXPANSION_TYPE = 'XLinkExpansion';\nHTTPRequest.INIT_SEGMENT_TYPE = 'InitializationSegment';\nHTTPRequest.INDEX_SEGMENT_TYPE = 'IndexSegment';\nHTTPRequest.MEDIA_SEGMENT_TYPE = 'MediaSegment';\nHTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE = 'BitstreamSwitchingSegment';\nHTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE = 'FragmentInfoSegment';\nHTTPRequest.DVB_REPORTING_TYPE = 'DVBReporting';\nHTTPRequest.LICENSE = 'license';\nHTTPRequest.OTHER_TYPE = 'other';\n\nexport {HTTPRequest, HTTPRequestTrace};\n"],"sourceRoot":""}