-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dash.protection.min.js.map
1 lines (1 loc) · 417 KB
/
dash.protection.min.js.map
1
{"version":3,"sources":["webpack://dashjs/webpack/universalModuleDefinition","webpack://dashjs/webpack/bootstrap","webpack://dashjs/./src/streaming/constants/Constants.js","webpack://dashjs/./src/streaming/vo/DashJSError.js","webpack://dashjs/./src/core/Utils.js","webpack://dashjs/./src/core/events/EventsBase.js","webpack://dashjs/./node_modules/process/browser.js","webpack://dashjs/./src/core/errors/ErrorsBase.js","webpack://dashjs/./src/core/FactoryMaker.js","webpack://dashjs/./node_modules/path-browserify/index.js","webpack://dashjs/./node_modules/ua-parser-js/src/ua-parser.js","webpack://dashjs/./src/streaming/vo/metrics/HTTPRequest.js","webpack://dashjs/(webpack)/buildin/amd-options.js","webpack://dashjs/./src/streaming/protection/CommonEncryption.js","webpack://dashjs/./src/streaming/protection/vo/MediaCapability.js","webpack://dashjs/./src/streaming/protection/vo/KeySystemConfiguration.js","webpack://dashjs/./src/streaming/protection/errors/ProtectionErrors.js","webpack://dashjs/./src/streaming/protection/vo/LicenseRequest.js","webpack://dashjs/./src/streaming/protection/vo/LicenseResponse.js","webpack://dashjs/./src/streaming/protection/controllers/ProtectionController.js","webpack://dashjs/./src/streaming/protection/vo/KeyPair.js","webpack://dashjs/./src/streaming/protection/vo/ClearKeyKeySet.js","webpack://dashjs/./src/streaming/constants/ProtectionConstants.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemClearKey.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemW3CClearKey.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemWidevine.js","webpack://dashjs/./src/streaming/protection/drm/KeySystemPlayReady.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/servers/ClearKey.js","webpack://dashjs/./src/streaming/protection/controllers/ProtectionKeyController.js","webpack://dashjs/./src/streaming/protection/ProtectionEvents.js","webpack://dashjs/./src/streaming/protection/vo/NeedKey.js","webpack://dashjs/./src/streaming/protection/vo/KeyMessage.js","webpack://dashjs/./src/streaming/protection/vo/KeySystemAccess.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_21Jan2015.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_3Feb2014.js","webpack://dashjs/./src/streaming/protection/models/ProtectionModel_01b.js","webpack://dashjs/./src/streaming/protection/Protection.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","constants","this","init","STREAM","VIDEO","AUDIO","TEXT","MUXED","IMAGE","STPP","TTML","VTT","WVTT","CONTENT_STEERING","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","DashJSError","code","message","data","Utils","dest","source","copy","empty","mixin","src","Array","length","push","clone","url","params","modifiedUrl","URL","forEach","param","searchParams","set","href","e","headerStr","headers","headerPairs","trim","split","ilen","headerPair","index","indexOf","substring","dt","Date","getTime","replace","Math","random","floor","toString","string","hash","charCodeAt","originalUrl","targetUrl","original","target","protocol","origin","relativePath","path","relative","pathname","substr","lastIndexOf","startIndexOffset","ua","uaString","navigator","userAgent","toLowerCase","UAParser","EventsBase","events","config","override","publicOnly","evt","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","concat","drainQueue","timeout","len","run","marker","runClearTimeout","Item","array","noop","nextTick","args","arguments","apply","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","ErrorsBase","errors","err","FactoryMaker","instance","singletonContexts","singletonFactories","classFactories","getSingletonInstance","context","className","obj","getFactoryByName","factoriesArray","updateFactory","merge","classConstructor","classInstance","__dashjs_factory_name","extensionObject","extension","prop","parent","getClassName","extend","childInstance","setSingletonInstance","deleteSingletonInstances","filter","x","getSingletonFactory","undefined","getInstance","getSingletonFactoryByName","updateSingletonFactory","getClassFactory","getClassFactoryByName","updateClassFactory","normalizeArray","parts","allowAboveRoot","up","last","splice","unshift","xs","f","res","resolve","resolvedPath","resolvedAbsolute","TypeError","charAt","join","normalize","isAbsolute","trailingSlash","paths","slice","from","to","arr","start","end","fromParts","toParts","min","samePartsLength","outputParts","sep","delimiter","dirname","hasRoot","matchedSlash","basename","ext","extname","startDot","startPart","preDotState","str","MODEL","NAME","TYPE","VENDOR","VERSION","MOBILE","TABLET","SMARTTV","enumerize","enums","toUpperCase","has","str1","str2","lowerize","rgxMapper","arrays","j","k","q","matches","match","regex","props","exec","test","strMapper","map","windowsVersionMap","regexes","OPERA","FIREFOX","CHROME","cpu","device","APPLE","engine","EDGE","os","extensions","getResult","_ua","_rgxmap","mergedRegexes","getBrowser","_browser","major","getCPU","_cpu","getDevice","_device","getEngine","_engine","getOS","_os","getUA","setUA","BROWSER","CPU","DEVICE","ENGINE","OS","$","jQuery","Zepto","parser","result","HTTPRequest","tcpid","type","actualurl","range","trequest","tresponse","responsecode","interval","trace","_stream","_tfinish","_mediaduration","_quality","_responseHeaders","_serviceLocation","_fileLoaderType","HTTPRequestTrace","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","LICENSE","CONTENT_STEERING_TYPE","OTHER_TYPE","__webpack_amd_options__","LICENSE_SERVER_MANIFEST_CONFIGURATIONS","attributes","prefixes","CommonEncryption","cpArray","retVal","cp","schemeIdUri","pssh","offset","view","DataView","getUint8","getUint32","keySystem","initData","psshList","parsePSSHList","uuid","cpData","BASE64","__text","decodeArray","buffer","dv","byteCursor","nextBox","systemID","boxStart","byteLength","val","mediaInfo","licenseServer","info","contentProtection","targetProtectionData","ckData","attribute","prefix","__prefix","MediaCapability","contentType","robustness","KeySystemConfiguration","audioCapabilities","videoCapabilities","distinctiveIdentifier","persistentState","sessionTypes","initDataTypes","protectionErrors","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","MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE","SERVER_CERTIFICATE_UPDATED_ERROR_CODE","KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE","MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE","KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE","KEY_SESSION_CREATED_ERROR_CODE","MEDIA_KEY_MESSAGE_LICENSER_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","MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE","SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE","KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE","MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE","KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE","KEY_SESSION_CREATED_ERROR_MESSAGE","MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE","LicenseRequest","method","responseType","withCredentials","messageType","sessionId","LicenseResponse","ProtectionController","logger","pendingKeySessionsToHandle","mediaInfoArr","protDataSet","sessionType","robustnessLevel","selectedKeySystem","keySystemSelectionInProgress","licenseXhrRequest","licenseRequestRetryTimeout","protectionKeyController","protectionModel","eventBus","debug","needkeyRetries","cmcdModel","settings","customParametersModel","checkConfig","_selectKeySystemOrUpdateKeySessions","supportedKs","fromManifest","_handleKeySessions","keySystemAccess","requestedKeySystems","sort","ksA","ksB","ks","systemString","priority","keySystemConfiguration","_getKeySystemConfiguration","configs","protData","requestKeySystemAccess","then","event","selectedSystemString","mksa","selectKeySystem","trigger","KEY_SYSTEM_SELECTED","_getProtDataForKeySystem","serverCertificate","setServerCertificate","error","ProtectionErrors","_selectInitialKeySystem","ksIdx","_loadOrCreateKeySession","keySystemInfo","isClearKey","keys","clearkeys","kids","TextEncoder","encode","JSON","stringify","loadKeySession","createKeySession","initDataForKS","getPSSHForKeySystem","keyId","sessions","getSessions","getKeyId","_isKeyIdDuplicate","_isInitDataDuplicate","KEY_SESSION_CREATED","keySystemString","currentInitData","getAllInitData","initDataEquals","setMediaElement","element","NEED_KEY","_onNeedKey","keySystemData","audioRobustness","videoRobustness","ksSessionType","media","codec","_onKeyStatusChanged","KEY_STATUSES_CHANGED","status","_onKeyMessage","keyMessage","KEY_MESSAGE","sessionToken","licenseServerModelInstance","getLicenseServerModelInstance","eventData","getSessionId","_sendLicenseRequestCompleteEvent","processClearKeyLicenseRequest","keyPairs","updateKeySession","licenseServerData","serverURL","laURL","getLicenseServerUrlFromMediaInfo","schemeIdURI","psshData","getPSSHData","getLicenseServerURLFromInitData","getServerURLFromMessage","_getLicenseServerUrl","reqHeaders","_updateHeaders","httpRequestHeaders","headersFromMessage","getRequestHeadersFromMessage","onLoad","xhr","responseHeaders","parseHttpHeaders","getAllResponseHeaders","licenseResponse","responseURL","response","_applyFilters","getLicenseResponseFilters","licenseMessage","getLicenseMessage","_reportError","onAbort","statusText","readyState","onError","reqPayload","getLicenseRequestFromMessage","reqMethod","getHTTPMethod","getResponseType","isNaN","httpTimeout","licenseRequest","retryAttempts","streaming","getLicenseRequestFilters","_doLicenseRequest","request","retriesCount","XMLHttpRequest","cmcd","enabled","Constants","cmcdParams","getQueryParameter","addAditionalQueryParameterToUrl","open","setRequestHeader","cmcdHeaders","getHeaderParameters","header","_retryRequest","retryInterval","retryIntervals","onload","warn","ontimeout","onerror","onabort","LICENSE_REQUEST_SENDING","payload","send","_issueLicenseRequest","LICENSE_REQUEST_COMPLETE","_abortLicenseRequest","onloadend","onprogress","abort","errorMsg","getErrorResponse","serverResponse","responseCode","responseText","filters","reduce","prev","next","Promise","retry","protection","ignoreEmeEncryptedEvent","initDataType","abInitData","ArrayBuffer","isView","String","fromCharCode","Uint8Array","getSupportedKeySystemsFromSegmentPssh","_handleKeySystemFromPssh","initializeForMedia","clearMediaInfoArray","handleKeySystemFromManifest","supportedKeySystems","mInfo","currentKs","getSupportedKeySystemsFromContentProtection","removeKeySession","closeKeySession","setSessionType","setRobustnessLevel","level","setProtectionData","cps","getKeySystems","setKeySystems","keySystems","stop","reset","INTERNAL_KEY_MESSAGE","INTERNAL_KEY_STATUS_CHANGED","retryTimeout","getLogger","KeyPair","keyID","ClearKeyKeySet","numKeys","jwk","kty","alg","kid","jwkString","buf","bView","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","ProtectionConstants","KeySystemClearKey","getInitData","cencContentProtection","parseInitDataFromContentProtection","cencDefaultKid","btoa","a","parseInt","cencDefaultKidToBase64Representation","parse","getCDMData","getClearKeysFromProtectionData","protectionData","clearkeySet","jsonMsg","clearkeyID","clearkey","dashjs","KeySystemW3CClearKey","KeySystemWidevine","KeySystemPlayReady","messageFormat","PROSize","PSSHSize","PSSHBoxBuffer","PSSHBox","PSSHData","PSSHBoxType","playreadySystemID","uint8arraydecodedPROHeader","pro","prheader","setUint32","msg","xmlDoc","DOMParser","detectPlayreadyMessageFormat","dataview","Uint16Array","headerNameList","parseFromString","getElementsByTagName","headerValueList","childNodes","nodeValue","Content","Challenge","decode","numRecords","getUint16","recordType","recordLength","recordData","record","laurl","luiurl","_cdmData","customData","cdmData","cdmDataBytes","setPlayReadyMessageFormat","format","DRMToday","license","keySystemStr","PlayReady","soap","uintToString","arrayBuffer","encodedString","decodeURIComponent","escape","parseServerResponse","stringResponse","envelope","getElementsByTagNameNS","body","parseErrorResponse","faultstring","statusCode","idStart","idEnd","fault","detail","exception","node","firstChild","errorString","Widevine","ClearKey","keypair","keyid","ProtectionKeyController","clearkeyKeySystem","clearkeyW3CKeySystem","_getSessionId","_getSessionType","initialize","protectionDataSet","initData1","initData2","data1","data2","newKeySystems","getKeySystemBySystemString","cpIdx","supportedKS","findCencContentProtection","setConfig","protectionEvents","KEY_ADDED","KEY_ERROR","KEY_SESSION_CLOSED","KEY_SESSION_REMOVED","KEY_SYSTEM_ACCESS_COMPLETE","PROTECTION_CREATED","PROTECTION_DESTROYED","SERVER_CERTIFICATE_UPDATED","TEARDOWN_COMPLETE","VIDEO_ELEMENT_SELECTED","KEY_SESSION_UPDATED","NeedKey","KeyMessage","defaultURL","KeySystemAccess","ksConfiguration","SYSTEM_STRING_PRIORITY","ProtectionModel_21Jan2015","videoElement","mediaKeys","eventHandler","_closeKeySessionInternal","session","removeEventListener","close","removeSession","token","parseKeyStatus","createSessionToken","ksInfo","handleEvent","keyStatuses","keyStatus","getSessionType","getExpirationTime","expiration","getKeyStatuses","getUsable","usable","addEventListener","closed","ksConfigurations","reject","_requestKeySystemAccessInternal","idx","requestMediaKeySystemAccess","protDataSystemStringPriority","systemStringPriority","currentKeySystem","systemStringsToApply","_checkAccessForSystemStrings","mediaKeySystemAccess","_checkAccessForKeySystem","configuration","getConfiguration","createMediaKeys","mkeys","setMediaKeys","mediaElement","createSession","dataType","generateRequest","toJWK","update","load","success","remove","numSessions","done","ProtectionModel_3Feb2014","api","needkey","ready","release","boundDoSetKeys","doSetKeys","found","supportedAudio","supportedVideo","configIdx","audios","videos","audioIdx","MediaKeys","isTypeSupported","videoIdx","ksConfig","errorMessage","ksAccess","capabilities","keySession","NaN","destinationURL","ProtectionModel_01b","pendingSessions","moreSessionsAllowed","errHandler","removeEventListeners","cancelKeyRequest","findSessionByID","sessionArray","keyerror","keymessage","keyadded","ve","document","createElement","canPlayType","newSession","generateKeyRequest","addKey","errorCode","systemCode","shift","APIS_ProtectionModel_01b","APIS_ProtectionModel_3Feb2014","Protection","_getAPI","apis","createProtectionSystem","controller","videoModel","getElement","onencrypted","_getProtectionModel","setEncryptedMediaSupported","ProtectionEvents"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAStB,GACX,oBAAXuB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAenB,EAASuB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAenB,EAAS,aAAc,CAAEyB,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAs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2B,IAE5CL,IAgDfJ,GAAW5sB,sBAAwB,aACnC,IAAMjP,GAAU4uB,OAAO1gB,aAAagC,gBAAgB2rB,IACpD77B,GAAQwK,OAAS+xB,GACjBv8B,GAAQgO,OAAS2T,EACjBiN,OAAO1gB,aAAakC,mBAAmByrB,GAAW5sB,sBAAuBjP,IAC1DA,gB","file":"dash.protection.min.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 = 92);\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 * 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} Content Steering\n * @memberof Constants#\n * @static\n */\n this.CONTENT_STEERING = 'contentSteering';\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 * @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/**\n * @class\n * @ignore\n */\n\nimport path from 'path-browserify'\nimport { UAParser } from 'ua-parser-js'\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 static parseUserAgent(ua = null) {\n try {\n const uaString = ua === null ? typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '' : '';\n\n return UAParser(uaString);\n }\n catch(e) {\n return {};\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 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;","// 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 * @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 * @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","// .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","/////////////////////////////////////////////////////////////////////////////////\n/* UAParser.js v1.0.32\n Copyright © 2012-2021 Faisal Salman <f@faisalman.com>\n MIT License *//*\n Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.\n Supports browser & node.js environment. \n Demo : https://faisalman.github.io/ua-parser-js\n Source : https://github.com/faisalman/ua-parser-js */\n/////////////////////////////////////////////////////////////////////////////////\n\n(function (window, undefined) {\n\n 'use strict';\n\n //////////////\n // Constants\n /////////////\n\n\n var LIBVERSION = '1.0.32',\n EMPTY = '',\n UNKNOWN = '?',\n FUNC_TYPE = 'function',\n UNDEF_TYPE = 'undefined',\n OBJ_TYPE = 'object',\n STR_TYPE = 'string',\n MAJOR = 'major',\n MODEL = 'model',\n NAME = 'name',\n TYPE = 'type',\n VENDOR = 'vendor',\n VERSION = 'version',\n ARCHITECTURE= 'architecture',\n CONSOLE = 'console',\n MOBILE = 'mobile',\n TABLET = 'tablet',\n SMARTTV = 'smarttv',\n WEARABLE = 'wearable',\n EMBEDDED = 'embedded',\n UA_MAX_LENGTH = 350;\n\n var AMAZON = 'Amazon',\n APPLE = 'Apple',\n ASUS = 'ASUS',\n BLACKBERRY = 'BlackBerry',\n BROWSER = 'Browser',\n CHROME = 'Chrome',\n EDGE = 'Edge',\n FIREFOX = 'Firefox',\n GOOGLE = 'Google',\n HUAWEI = 'Huawei',\n LG = 'LG',\n MICROSOFT = 'Microsoft',\n MOTOROLA = 'Motorola',\n OPERA = 'Opera',\n SAMSUNG = 'Samsung',\n SHARP = 'Sharp',\n SONY = 'Sony',\n XIAOMI = 'Xiaomi',\n ZEBRA = 'Zebra',\n FACEBOOK = 'Facebook';\n\n ///////////\n // Helper\n //////////\n\n var extend = function (regexes, extensions) {\n var mergedRegexes = {};\n for (var i in regexes) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes[i]);\n } else {\n mergedRegexes[i] = regexes[i];\n }\n }\n return mergedRegexes;\n },\n enumerize = function (arr) {\n var enums = {};\n for (var i=0; i<arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n },\n has = function (str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n },\n lowerize = function (str) {\n return str.toLowerCase();\n },\n majorize = function (version) {\n return typeof(version) === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split('.')[0] : undefined;\n },\n trim = function (str, len) {\n if (typeof(str) === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY).replace(/\\s\\s*$/, EMPTY);\n return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n\n ///////////////\n // Map helper\n //////////////\n\n var rgxMapper = function (ua, arrays) {\n\n var i = 0, j, k, p, q, matches, match;\n\n // loop through all regexes maps\n while (i < arrays.length && !matches) {\n\n var regex = arrays[i], // even sequence (0,2,4,..)\n props = arrays[i + 1]; // odd sequence (1,3,5,..)\n j = k = 0;\n\n // try matching uastring with regexes\n while (j < regex.length && !matches) {\n\n matches = regex[j++].exec(ua);\n\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n // check if given property is actually array\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n // assign modified match\n this[q[0]] = q[1].call(this, match);\n } else {\n // assign given value, ignore regex match\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n // check whether function or regex\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n // call function (usually string mapper)\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;\n } else {\n // sanitize match using given regex\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;\n }\n } else {\n this[q] = match ? match : undefined;\n }\n }\n }\n }\n i += 2;\n }\n },\n\n strMapper = function (str, map) {\n\n for (var i in map) {\n // check if current value is array\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return (i === UNKNOWN) ? undefined : i;\n }\n }\n } else if (has(map[i], str)) {\n return (i === UNKNOWN) ? undefined : i;\n }\n }\n return str;\n };\n\n ///////////////\n // String map\n //////////////\n\n // Safari < 3.0\n var oldSafariMap = {\n '1.0' : '/8',\n '1.2' : '/1',\n '1.3' : '/3',\n '2.0' : '/412',\n '2.0.2' : '/416',\n '2.0.3' : '/417',\n '2.0.4' : '/419',\n '?' : '/'\n },\n windowsVersionMap = {\n 'ME' : '4.90',\n 'NT 3.11' : 'NT3.51',\n 'NT 4.0' : 'NT4.0',\n '2000' : 'NT 5.0',\n 'XP' : ['NT 5.1', 'NT 5.2'],\n 'Vista' : 'NT 6.0',\n '7' : 'NT 6.1',\n '8' : 'NT 6.2',\n '8.1' : 'NT 6.3',\n '10' : ['NT 6.4', 'NT 10.0'],\n 'RT' : 'ARM'\n };\n\n //////////////\n // Regex map\n /////////////\n\n var regexes = {\n\n browser : [[\n\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i // Chrome for Android/iOS\n ], [VERSION, [NAME, 'Chrome']], [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i // Microsoft Edge\n ], [VERSION, [NAME, 'Edge']], [\n\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i, // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i, // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i // Opera\n ], [NAME, VERSION], [\n /opios[\\/ ]+([\\w\\.]+)/i // Opera mini on iphone >= 8.0\n ], [VERSION, [NAME, OPERA+' Mini']], [\n /\\bopr\\/([\\w\\.]+)/i // Opera Webkit\n ], [VERSION, [NAME, OPERA]], [\n\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i, // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i, // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i, // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i, // Internet Explorer\n\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i // Weibo\n ], [NAME, VERSION], [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i // UCBrowser\n ], [VERSION, [NAME, 'UC'+BROWSER]], [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i, // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ], [VERSION, [NAME, 'WeChat(Win) Desktop']], [\n /micromessenger\\/([\\w\\.]+)/i // WeChat\n ], [VERSION, [NAME, 'WeChat']], [\n /konqueror\\/([\\w\\.]+)/i // Konqueror\n ], [VERSION, [NAME, 'Konqueror']], [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i // IE11\n ], [VERSION, [NAME, 'IE']], [\n /yabrowser\\/([\\w\\.]+)/i // Yandex\n ], [VERSION, [NAME, 'Yandex']], [\n /(avast|avg)\\/([\\w\\.]+)/i // Avast/AVG Secure Browser\n ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [\n /\\bfocus\\/([\\w\\.]+)/i // Firefox Focus\n ], [VERSION, [NAME, FIREFOX+' Focus']], [\n /\\bopt\\/([\\w\\.]+)/i // Opera Touch\n ], [VERSION, [NAME, OPERA+' Touch']], [\n /coc_coc\\w+\\/([\\w\\.]+)/i // Coc Coc Browser\n ], [VERSION, [NAME, 'Coc Coc']], [\n /dolfin\\/([\\w\\.]+)/i // Dolphin\n ], [VERSION, [NAME, 'Dolphin']], [\n /coast\\/([\\w\\.]+)/i // Opera Coast\n ], [VERSION, [NAME, OPERA+' Coast']], [\n /miuibrowser\\/([\\w\\.]+)/i // MIUI Browser\n ], [VERSION, [NAME, 'MIUI '+BROWSER]], [\n /fxios\\/([-\\w\\.]+)/i // Firefox for iOS\n ], [VERSION, [NAME, FIREFOX]], [\n /\\bqihu|(qi?ho?o?|360)browser/i // 360\n ], [[NAME, '360 '+BROWSER]], [\n /(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i\n ], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i // Comodo Dragon\n ], [[NAME, /_/g, ' '], VERSION], [\n /(electron)\\/([\\w\\.]+) safari/i, // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i, // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i // QQBrowser/Baidu App/2345 Browser\n ], [NAME, VERSION], [\n /(metasr)[\\/ ]?([\\w\\.]+)/i, // SouGouBrowser\n /(lbbrowser)/i, // LieBao Browser\n /\\[(linkedin)app\\]/i // LinkedIn App for iOS & Android\n ], [NAME], [\n\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i // Facebook App for iOS & Android\n ], [[NAME, FACEBOOK], VERSION], [\n /safari (line)\\/([\\w\\.]+)/i, // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i, // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i // Chromium/Instagram\n ], [NAME, VERSION], [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i // Google Search Appliance on iOS\n ], [VERSION, [NAME, 'GSA']], [\n\n /headlesschrome(?:\\/([\\w\\.]+)| )/i // Chrome Headless\n ], [VERSION, [NAME, CHROME+' Headless']], [\n\n / wv\\).+(chrome)\\/([\\w\\.]+)/i // Chrome WebView\n ], [[NAME, CHROME+' WebView'], VERSION], [\n\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i // Android Browser\n ], [VERSION, [NAME, 'Android '+BROWSER]], [\n\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia\n ], [NAME, VERSION], [\n\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i // Mobile Safari\n ], [VERSION, [NAME, 'Mobile Safari']], [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile\n ], [VERSION, NAME], [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i // Safari < 3.0\n ], [NAME, [VERSION, strMapper, oldSafariMap]], [\n\n /(webkit|khtml)\\/([\\w\\.]+)/i\n ], [NAME, VERSION], [\n\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i // Netscape\n ], [[NAME, 'Netscape'], VERSION], [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i // Firefox Reality\n ], [VERSION, [NAME, FIREFOX+' Reality']], [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i, // Flow\n /(swiftfox)/i, // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i, // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i, // Mozilla\n\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i // Links\n ], [NAME, VERSION]\n ],\n\n cpu : [[\n\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i // AMD64 (x64)\n ], [[ARCHITECTURE, 'amd64']], [\n\n /(ia32(?=;))/i // IA32 (quicktime)\n ], [[ARCHITECTURE, lowerize]], [\n\n /((?:i[346]|x)86)[;\\)]/i // IA32 (x86)\n ], [[ARCHITECTURE, 'ia32']], [\n\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i // ARM64\n ], [[ARCHITECTURE, 'arm64']], [\n\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i // ARMHF\n ], [[ARCHITECTURE, 'armhf']], [\n\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ], [[ARCHITECTURE, 'arm']], [\n\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i // PowerPC\n ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [\n\n /(sun4\\w)[;\\)]/i // SPARC\n ], [[ARCHITECTURE, 'sparc']], [\n\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ], [[ARCHITECTURE, lowerize]]\n ],\n\n device : [[\n\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [\n\n // Apple\n /\\((ip(?:hone|od)[\\w ]*);/i // iPod/iPhone\n ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [\n /\\((ipad);[-\\w\\),; ]+apple/i, // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [\n\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [\n\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i, // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i, // Xiaomi Hongmi 'numeric' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i, // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i, // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i // Xiaomi Mi\n ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i // Mi Pad tablets\n ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [\n\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [\n\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [\n\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [\n\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [\n /\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i\n ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [\n\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [\n\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [\n\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [\n\n // Google\n /(pixel c)\\b/i // Google Pixel C\n ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i // Google Pixel\n ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [\n\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [\n /sony tablet [ps]/i,\n /\\b(?:sony)?sgp\\w+(?: bui|\\))/i\n ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [\n\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [\n\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i, // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i // Kindle Fire HD\n ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i // Fire Phone\n ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [\n\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i // BlackBerry PlayBook\n ], [MODEL, VENDOR, [TYPE, TABLET]], [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i // BlackBerry 10\n ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [\n\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [\n / (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i\n ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [\n\n // HTC\n /(nexus 9)/i // HTC Nexus 9\n ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i, // HTC\n\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [\n\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [\n\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [\n\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [\n\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i, // HP iPAQ\n /(asus)-?(\\w+)/i, // Asus\n /(microsoft); (lumia[\\w ]+)/i, // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i, // Lenovo\n /(jolla)/i, // Jolla\n /(oppo) ?([\\w ]+) bui/i // OPPO\n ], [VENDOR, MODEL, [TYPE, MOBILE]], [\n\n /(archos) (gamepad2?)/i, // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i, // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i, // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i, // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i, // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i, // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i, // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i // Vodafone\n ], [VENDOR, MODEL, [TYPE, TABLET]], [\n\n /(surface duo)/i // Surface Duo\n ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i // Fairphone\n ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [\n /(u304aa)/i // AT&T\n ], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [\n /\\bsie-(\\w*)/i // Siemens\n ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [\n /\\b(rct\\w+) b/i // RCA Tablets\n ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [\n /\\b(venue[\\d ]{2,7}) b/i // Dell Venue Tablets\n ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [\n /\\b(q(?:mv|ta)\\w+) b/i // Verizon Tablet\n ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i // Barnes & Noble Tablet\n ], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [\n /\\b(tm\\d{3}\\w+) b/i\n ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [\n /\\b(k88) b/i // ZTE K Series Tablet\n ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [\n /\\b(nx\\d{3}j) b/i // ZTE Nubia\n ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [\n /\\b(gen\\d{3}) b.+49h/i // Swiss GEN Mobile\n ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [\n /\\b(zur\\d{3}) b/i // Swiss ZUR Tablet\n ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [\n /\\b((zeki)?tb.*\\b) b/i // Zeki Tablets\n ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i // Dragon Touch Tablet\n ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [\n /\\b(ns-?\\w{0,9}) b/i // Insignia Tablets\n ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [\n /\\b((nxa|next)-?\\w{0,9}) b/i // NextBook Tablets\n ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones\n ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [\n /\\b(lvtel\\-)?(v1[12]) b/i // LvTel Phones\n ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [\n /\\b(ph-1) /i // Essential PH-1\n ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i // Envizen Tablets\n ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [\n /\\b(trio[-\\w\\. ]+) b/i // MachSpeed Tablets\n ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [\n /\\btu_(1491) b/i // Rotor Tablets\n ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [\n /(shield[\\w ]+) b/i // Nvidia Shield Tablets\n ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [\n /(sprint) (\\w+)/i // Sprint Phones\n ], [VENDOR, MODEL, [TYPE, MOBILE]], [\n /(kin\\.[onetw]{3})/i // Microsoft Kin\n ], [[MODEL, /\\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i // Zebra\n ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [\n /droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i\n ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [\n\n ///////////////////\n // CONSOLES\n ///////////////////\n\n /(ouya)/i, // Ouya\n /(nintendo) ([wids3utch]+)/i // Nintendo\n ], [VENDOR, MODEL, [TYPE, CONSOLE]], [\n /droid.+; (shield) bui/i // Nvidia\n ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [\n /(playstation [345portablevi]+)/i // Playstation\n ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i // Microsoft Xbox\n ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [\n\n ///////////////////\n // SMARTTVS\n ///////////////////\n\n /smart-tv.+(samsung)/i // Samsung\n ], [VENDOR, [TYPE, SMARTTV]], [\n /hbbtv.+maple;(\\d+)/i\n ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i // LG SmartTV\n ], [[VENDOR, LG], [TYPE, SMARTTV]], [\n /(apple) ?tv/i // Apple TV\n ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [\n /crkey/i // Google Chromecast\n ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [\n /droid.+aft(\\w)( bui|\\))/i // Fire TV\n ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i // Sharp\n ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[\n /(bravia[\\w ]+)( bui|\\))/i // Sony\n ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [\n /(mitv-\\w{5}) bui/i // Xiaomi\n ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i, // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i // HbbTV devices\n ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i // SmartTV from Unidentified Vendors\n ], [[TYPE, SMARTTV]], [\n\n ///////////////////\n // WEARABLES\n ///////////////////\n\n /((pebble))app/i // Pebble\n ], [VENDOR, MODEL, [TYPE, WEARABLE]], [\n /droid.+; (glass) \\d/i // Google Glass\n ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [\n /droid.+; (wt63?0{2,3})\\)/i\n ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [\n /(quest( 2)?)/i // Oculus Quest\n ], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [\n\n ///////////////////\n // EMBEDDED\n ///////////////////\n\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i // Tesla\n ], [VENDOR, [TYPE, EMBEDDED]], [\n\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors\n ], [MODEL, [TYPE, MOBILE]], [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors\n ], [MODEL, [TYPE, TABLET]], [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i // Unidentifiable Tablet\n ], [[TYPE, TABLET]], [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile\n ], [[TYPE, MOBILE]], [\n /(android[-\\w\\. ]{0,9});.+buil/i // Generic Android Device\n ], [MODEL, [VENDOR, 'Generic']]\n ],\n\n engine : [[\n\n /windows.+ edge\\/([\\w\\.]+)/i // EdgeHTML\n ], [VERSION, [NAME, EDGE+'HTML']], [\n\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i // Blink\n ], [VERSION, [NAME, 'Blink']], [\n\n /(presto)\\/([\\w\\.]+)/i, // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i, // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i, // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i // iCab\n ], [NAME, VERSION], [\n\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i // Gecko\n ], [VERSION, NAME]\n ],\n\n os : [[\n\n // Windows\n /microsoft (windows) (vista|xp)/i // Windows (iTunes)\n ], [NAME, VERSION], [\n /(windows) nt 6\\.2; (arm)/i, // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i, // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ], [NAME, [VERSION, strMapper, windowsVersionMap]], [\n /(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i\n ], [[NAME, 'Windows'], [VERSION, strMapper, windowsVersionMap]], [\n\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i, // iOS\n /cfnetwork\\/.+darwin/i\n ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i // Mac OS\n ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [\n\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS\n ], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i, // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i, // Tizen/KaiOS\n /\\((series40);/i // Series 40\n ], [NAME, VERSION], [\n /\\(bb(10);/i // BlackBerry 10\n ], [VERSION, [NAME, BLACKBERRY]], [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i // Symbian\n ], [VERSION, [NAME, 'Symbian']], [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i // Firefox OS\n ], [VERSION, [NAME, FIREFOX+' OS']], [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i // WebOS\n ], [VERSION, [NAME, 'webOS']], [\n\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i // Google Chromecast\n ], [VERSION, [NAME, CHROME+'cast']], [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i // Chromium OS\n ], [[NAME, 'Chromium OS'], VERSION],[\n\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i, // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)\n\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i, // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i, // Mint\n /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i, // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i, // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i // Haiku\n ], [NAME, VERSION], [\n /(sunos) ?([\\w\\.\\d]*)/i // Solaris\n ], [[NAME, 'Solaris'], VERSION], [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i, // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i, // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i // UNIX\n ], [NAME, VERSION]\n ]\n };\n\n /////////////////\n // Constructor\n ////////////////\n\n var UAParser = function (ua, extensions) {\n\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined;\n }\n\n if (!(this instanceof UAParser)) {\n return new UAParser(ua, extensions).getResult();\n }\n\n var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n\n this.getBrowser = function () {\n var _browser = {};\n _browser[NAME] = undefined;\n _browser[VERSION] = undefined;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function () {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function () {\n var _device = {};\n _device[VENDOR] = undefined;\n _device[MODEL] = undefined;\n _device[TYPE] = undefined;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function () {\n var _engine = {};\n _engine[NAME] = undefined;\n _engine[VERSION] = undefined;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function () {\n var _os = {};\n _os[NAME] = undefined;\n _os[VERSION] = undefined;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function () {\n return {\n ua : this.getUA(),\n browser : this.getBrowser(),\n engine : this.getEngine(),\n os : this.getOS(),\n device : this.getDevice(),\n cpu : this.getCPU()\n };\n };\n this.getUA = function () {\n return _ua;\n };\n this.setUA = function (ua) {\n _ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n\n UAParser.VERSION = LIBVERSION;\n UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR]);\n UAParser.CPU = enumerize([ARCHITECTURE]);\n UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);\n UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);\n\n ///////////\n // Export\n //////////\n\n // check js environment\n if (typeof(exports) !== UNDEF_TYPE) {\n // nodejs env\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser;\n }\n exports.UAParser = UAParser;\n } else {\n // requirejs env (optional)\n if (typeof(define) === FUNC_TYPE && define.amd) {\n define(function () {\n return UAParser;\n });\n } else if (typeof window !== UNDEF_TYPE) {\n // browser env\n window.UAParser = UAParser;\n }\n }\n\n // jQuery/Zepto specific (optional)\n // Note:\n // In AMD env the global scope should be kept clean, but jQuery is an exception.\n // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,\n // and we should catch that.\n var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser();\n $.ua = parser.getResult();\n $.ua.get = function () {\n return parser.getUA();\n };\n $.ua.set = function (ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n\n})(typeof window === 'object' ? window : this);\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 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.CONTENT_STEERING_TYPE = 'ContentSteering';\nHTTPRequest.OTHER_TYPE = 'other';\n\nexport {HTTPRequest, HTTPRequestTrace};\n","/* globals __webpack_amd_options__ */\nmodule.exports = __webpack_amd_options__;\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 */\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/**\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 */\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 * @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\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 pendingKeySessionsToHandle,\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 pendingKeySessionsToHandle = [];\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\n /**\n * Once all mediaInfo objects have been added to our mediaInfoArray we can select a key system or check if the kid has changed and we need to trigger a new license request\n * @memberof module:ProtectionController\n * @instance\n */\n function handleKeySystemFromManifest() {\n if (!mediaInfoArr || mediaInfoArr.length === 0) {\n return;\n }\n\n let supportedKeySystems = [];\n mediaInfoArr.forEach((mInfo) => {\n const currentKs = protectionKeyController.getSupportedKeySystemsFromContentProtection(mInfo.contentProtection, protDataSet, sessionType);\n // We assume that the same key systems are signaled for each AS. We can use the first entry we found\n if (currentKs.length > 0) {\n if (supportedKeySystems.length === 0) {\n supportedKeySystems = currentKs;\n }\n // Save config for creating key session once we selected a key system\n pendingKeySessionsToHandle.push(currentKs);\n }\n })\n\n if (supportedKeySystems && supportedKeySystems.length > 0) {\n _selectKeySystemOrUpdateKeySessions(supportedKeySystems, 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 * @private\n */\n function _handleKeySystemFromPssh(supportedKs) {\n pendingKeySessionsToHandle.push(supportedKs);\n _selectKeySystemOrUpdateKeySessions(supportedKs, false);\n }\n\n /**\n * Select the key system or update one of our existing key sessions\n * @param {array} supportedKs\n * @param {boolean} fromManifest\n * @private\n */\n function _selectKeySystemOrUpdateKeySessions(supportedKs, fromManifest) {\n // First time, so we need to select a key system\n if (!selectedKeySystem && !keySystemSelectionInProgress) {\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 _handleKeySessions();\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 if (!keySystemSelectionInProgress) {\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 // 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 _handleKeySessions();\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 /**\n * If we have already selected a key system we only need to create a new key session and issue a new license request if the init data has changed.\n * @private\n */\n function _handleKeySessions() {\n // Create key sessions for the different AdaptationSets\n let ksIdx;\n for (let i = 0; i < pendingKeySessionsToHandle.length; i++) {\n for (ksIdx = 0; ksIdx < pendingKeySessionsToHandle[i].length; ksIdx++) {\n if (selectedKeySystem === pendingKeySessionsToHandle[i][ksIdx].ks) {\n const current = pendingKeySessionsToHandle[i][ksIdx]\n _loadOrCreateKeySession(current)\n break;\n }\n }\n }\n pendingKeySessionsToHandle = [];\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 pendingKeySessionsToHandle = [];\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 _handleKeySystemFromPssh(supportedKs);\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 handleKeySystemFromManifest,\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 */\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/**\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/**\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\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 .replace(/\\//g, '_')\n .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\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 */\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\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 * 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 */\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 */\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/**\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 * @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 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 * 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 * 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 */\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"],"sourceRoot":""}