{"version":3,"file":"dash.reporting.min.js","sourceRoot":"./src/","sources":["../node_modules/browserify/node_modules/browser-pack/_prelude.js","core/FactoryMaker.js","core/events/EventsBase.js","streaming/constants/Constants.js","streaming/metrics/MetricsReporting.js","streaming/metrics/MetricsReportingEvents.js","streaming/metrics/controllers/MetricsCollectionController.js","streaming/metrics/controllers/MetricsController.js","streaming/metrics/controllers/MetricsHandlersController.js","streaming/metrics/controllers/RangeController.js","streaming/metrics/controllers/ReportingController.js","streaming/metrics/metrics/MetricsHandlerFactory.js","streaming/metrics/metrics/handlers/BufferLevelHandler.js","streaming/metrics/metrics/handlers/DVBErrorsHandler.js","streaming/metrics/metrics/handlers/GenericMetricHandler.js","streaming/metrics/metrics/handlers/HttpListHandler.js","streaming/metrics/reporting/ReportingFactory.js","streaming/metrics/reporting/reporters/DVBReporting.js","streaming/metrics/utils/DVBErrorsTranslator.js","streaming/metrics/utils/HandlerHelpers.js","streaming/metrics/utils/ManifestParsing.js","streaming/metrics/utils/MetricSerialiser.js","streaming/metrics/utils/RNG.js","streaming/metrics/vo/DVBErrors.js","streaming/metrics/vo/Metrics.js","streaming/metrics/vo/Range.js","streaming/metrics/vo/Reporting.js","streaming/utils/CustomTimeRanges.js","streaming/utils/SupervisorTools.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n const key = JSON.stringify(m);\n\n if (!metricsControllers.hasOwnProperty(key)) {\n try {\n let controller = MetricsController(context).create(config);\n controller.initialize(m);\n metricsControllers[key] = controller;\n } catch (e) {\n // fail quietly\n }\n } else {\n // we still need this controller - delete from removal list\n controllersToRemove.splice(key, 1);\n }\n });\n\n // now remove the unwanted controllers\n controllersToRemove.forEach(c => {\n metricsControllers[c].reset();\n delete metricsControllers[c];\n });\n\n eventBus.trigger(\n MetricsReportingEvents.METRICS_INITIALISATION_COMPLETE\n );\n }\n\n function resetMetricsControllers() {\n Object.keys(metricsControllers).forEach(key => {\n metricsControllers[key].reset();\n });\n\n metricsControllers = {};\n }\n\n function setup() {\n eventBus.on(events.MANIFEST_UPDATED, update);\n eventBus.on(events.STREAM_TEARDOWN_COMPLETE, resetMetricsControllers);\n }\n\n function reset() {\n eventBus.off(events.MANIFEST_UPDATED, update);\n eventBus.off(events.STREAM_TEARDOWN_COMPLETE, resetMetricsControllers);\n }\n\n setup();\n\n return {\n reset: reset\n };\n}\n\nMetricsCollectionController.__dashjs_factory_name = 'MetricsCollectionController';\nexport default dashjs.FactoryMaker.getClassFactory(MetricsCollectionController); /* 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 RangeController from './RangeController';\nimport ReportingController from './ReportingController';\nimport MetricsHandlersController from './MetricsHandlersController';\n\nfunction MetricsController(config) {\n\n config = config || {};\n let metricsHandlersController,\n reportingController,\n rangeController,\n instance;\n\n let context = this.context;\n\n function initialize(metricsEntry) {\n try {\n rangeController = RangeController(context).create({\n mediaElement: config.mediaElement\n });\n\n rangeController.initialize(metricsEntry.Range);\n\n reportingController = ReportingController(context).create({\n debug: config.debug,\n metricsConstants: config.metricsConstants\n });\n\n reportingController.initialize(metricsEntry.Reporting, rangeController);\n\n metricsHandlersController = MetricsHandlersController(context).create({\n debug: config.debug,\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants,\n events: config.events\n });\n\n metricsHandlersController.initialize(metricsEntry.metrics, reportingController);\n } catch (e) {\n reset();\n throw e;\n }\n }\n\n function reset() {\n if (metricsHandlersController) {\n metricsHandlersController.reset();\n }\n\n if (reportingController) {\n reportingController.reset();\n }\n\n if (rangeController) {\n rangeController.reset();\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset\n };\n\n return instance;\n}\n\nMetricsController.__dashjs_factory_name = 'MetricsController';\nexport default dashjs.FactoryMaker.getClassFactory(MetricsController); /* 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 MetricsHandlerFactory from '../metrics/MetricsHandlerFactory';\n\nfunction MetricsHandlersController(config) {\n\n config = config || {};\n let handlers = [];\n\n let instance;\n const context = this.context;\n const eventBus = config.eventBus;\n const Events = config.events;\n\n let metricsHandlerFactory = MetricsHandlerFactory(context).getInstance({\n debug: config.debug,\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants\n });\n\n function handle(e) {\n handlers.forEach(handler => {\n handler.handleNewMetric(e.metric, e.value, e.mediaType);\n });\n }\n\n function initialize(metrics, reportingController) {\n metrics.split(',').forEach(\n (m, midx, ms) => {\n let handler;\n\n // there is a bug in ISO23009-1 where the metrics attribute\n // is a comma-separated list but HttpList key can contain a\n // comma enclosed by ().\n if ((m.indexOf('(') !== -1) && m.indexOf(')') === -1) {\n let nextm = ms[midx + 1];\n\n if (nextm &&\n (nextm.indexOf('(') === -1) &&\n (nextm.indexOf(')') !== -1)) {\n m += ',' + nextm;\n\n // delete the next metric so forEach does not visit.\n delete ms[midx + 1];\n }\n }\n\n handler = metricsHandlerFactory.create(\n m,\n reportingController\n );\n\n if (handler) {\n handlers.push(handler);\n }\n }\n );\n\n eventBus.on(\n Events.METRIC_ADDED,\n handle,\n instance\n );\n\n eventBus.on(\n Events.METRIC_UPDATED,\n handle,\n instance\n );\n }\n\n function reset() {\n eventBus.off(\n Events.METRIC_ADDED,\n handle,\n instance\n );\n\n eventBus.off(\n Events.METRIC_UPDATED,\n handle,\n instance\n );\n\n handlers.forEach(handler => handler.reset());\n\n handlers = [];\n }\n\n instance = {\n initialize: initialize,\n reset: reset\n };\n\n return instance;\n}\n\nMetricsHandlersController.__dashjs_factory_name = 'MetricsHandlersController';\nexport default dashjs.FactoryMaker.getClassFactory(MetricsHandlersController); /* 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 CustomTimeRanges from '../../utils/CustomTimeRanges';\n\nfunction RangeController(config) {\n\n config = config || {};\n let useWallClockTime = false;\n let context = this.context;\n let instance,\n ranges;\n\n let mediaElement = config.mediaElement;\n\n function initialize(rs) {\n if (rs && rs.length) {\n rs.forEach(r => {\n let start = r.starttime;\n let end = start + r.duration;\n\n ranges.add(start, end);\n });\n\n useWallClockTime = !!rs[0]._useWallClockTime;\n }\n }\n\n function reset() {\n ranges.clear();\n }\n\n function setup() {\n ranges = CustomTimeRanges(context).create();\n }\n\n function isEnabled() {\n let numRanges = ranges.length;\n let time;\n\n if (!numRanges) {\n return true;\n }\n\n // When not present, DASH Metrics reporting is requested\n // for the whole duration of the content.\n time = useWallClockTime ?\n (new Date().getTime() / 1000) :\n mediaElement.currentTime;\n\n for (let i = 0; i < numRanges; i += 1) {\n let start = ranges.start(i);\n let end = ranges.end(i);\n\n if ((start <= time) && (time < end)) {\n return true;\n }\n }\n\n return false;\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n isEnabled: isEnabled\n };\n\n setup();\n\n return instance;\n}\n\nRangeController.__dashjs_factory_name = 'RangeController';\nexport default dashjs.FactoryMaker.getClassFactory(RangeController); /* 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 ReportingFactory from '../reporting/ReportingFactory';\n\nfunction ReportingController(config) {\n\n let reporters = [];\n let instance;\n\n const reportingFactory = ReportingFactory(this.context).getInstance(config);\n\n function initialize(reporting, rangeController) {\n // \"if multiple Reporting elements are present, it is expected that\n // the client processes one of the recognized reporting schemes.\"\n // to ignore this, and support multiple Reporting per Metric,\n // simply change the 'some' below to 'forEach'\n reporting.some(r => {\n let reporter = reportingFactory.create(r, rangeController);\n\n if (reporter) {\n reporters.push(reporter);\n return true;\n }\n });\n }\n\n function reset() {\n reporters.forEach(r => r.reset());\n reporters = [];\n }\n\n function report(type, vos) {\n reporters.forEach(r => r.report(type, vos));\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n report: report\n };\n\n return instance;\n}\n\nReportingController.__dashjs_factory_name = 'ReportingController';\nexport default dashjs.FactoryMaker.getClassFactory(ReportingController); /* 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 BufferLevel from './handlers/BufferLevelHandler';\nimport DVBErrors from './handlers/DVBErrorsHandler';\nimport HttpList from './handlers/HttpListHandler';\nimport GenericMetricHandler from './handlers/GenericMetricHandler';\n\nfunction MetricsHandlerFactory(config) {\n\n config = config || {};\n let instance;\n const logger = config.debug ? config.debug.getLogger(instance) : {};\n\n // group 1: key, [group 3: n [, group 5: type]]\n let keyRegex = /([a-zA-Z]*)(\\(([0-9]*)(\\,\\s*([a-zA-Z]*))?\\))?/;\n\n const context = this.context;\n let knownFactoryProducts = {\n BufferLevel: BufferLevel,\n DVBErrors: DVBErrors,\n HttpList: HttpList,\n PlayList: GenericMetricHandler,\n RepSwitchList: GenericMetricHandler,\n TcpList: GenericMetricHandler\n };\n\n function create(listType, reportingController) {\n var matches = listType.match(keyRegex);\n var handler;\n\n if (!matches) {\n return;\n }\n\n try {\n handler = knownFactoryProducts[matches[1]](context).create({\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants\n });\n\n handler.initialize(\n matches[1],\n reportingController,\n matches[3],\n matches[5]\n );\n } catch (e) {\n handler = null;\n logger.error(`MetricsHandlerFactory: Could not create handler for type ${matches[1]} with args ${matches[3]}, ${matches[5]} (${e.message})`);\n }\n\n return handler;\n }\n\n function register(key, handler) {\n knownFactoryProducts[key] = handler;\n }\n\n function unregister(key) {\n delete knownFactoryProducts[key];\n }\n\n instance = {\n create: create,\n register: register,\n unregister: unregister\n };\n\n return instance;\n}\n\nMetricsHandlerFactory.__dashjs_factory_name = 'MetricsHandlerFactory';\nexport default dashjs.FactoryMaker.getSingletonFactory(MetricsHandlerFactory); /* 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 HandlerHelpers from '../../utils/HandlerHelpers';\n\nfunction BufferLevelHandler(config) {\n\n config = config || {};\n let instance,\n reportingController,\n n,\n name,\n interval,\n lastReportedTime;\n\n let context = this.context;\n let handlerHelpers = HandlerHelpers(context).getInstance();\n\n let storedVOs = [];\n\n const metricsConstants = config.metricsConstants;\n\n function getLowestBufferLevelVO() {\n try {\n return Object.keys(storedVOs).map(\n key => storedVOs[key]\n ).reduce(\n (a, b) => {\n return (a.level < b.level) ? a : b;\n }\n );\n } catch (e) {\n return;\n }\n }\n\n function intervalCallback() {\n let vo = getLowestBufferLevelVO();\n\n if (vo) {\n if (lastReportedTime !== vo.t) {\n lastReportedTime = vo.t;\n reportingController.report(name, vo);\n }\n }\n }\n\n function initialize(basename, rc, n_ms) {\n if (rc) {\n // this will throw if n is invalid, to be\n // caught by the initialize caller.\n n = handlerHelpers.validateN(n_ms);\n reportingController = rc;\n name = handlerHelpers.reconstructFullMetricName(basename, n_ms);\n interval = setInterval(intervalCallback, n);\n }\n }\n\n function reset() {\n clearInterval(interval);\n interval = null;\n n = 0;\n reportingController = null;\n lastReportedTime = null;\n }\n\n function handleNewMetric(metric, vo, type) {\n if (metric === metricsConstants.BUFFER_LEVEL) {\n storedVOs[type] = vo;\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n\n return instance;\n}\n\nBufferLevelHandler.__dashjs_factory_name = 'BufferLevelHandler';\nexport default dashjs.FactoryMaker.getClassFactory(BufferLevelHandler); /* 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 MetricsReportingEvents from '../../MetricsReportingEvents';\n\nfunction DVBErrorsHandler(config) {\n\n config = config || {};\n let instance,\n reportingController;\n\n let eventBus = config.eventBus;\n const metricsConstants = config.metricsConstants;\n\n function onInitialisationComplete() {\n // we only want to report this once per call to initialize\n eventBus.off(\n MetricsReportingEvents.METRICS_INITIALISATION_COMPLETE,\n onInitialisationComplete,\n this\n );\n\n // Note: A Player becoming a reporting Player is itself\n // something which is recorded by the DVBErrors metric.\n eventBus.trigger(\n MetricsReportingEvents.BECAME_REPORTING_PLAYER\n );\n }\n\n function initialize(unused, rc) {\n if (rc) {\n reportingController = rc;\n\n eventBus.on(\n MetricsReportingEvents.METRICS_INITIALISATION_COMPLETE,\n onInitialisationComplete,\n this\n );\n }\n }\n\n function reset() {\n reportingController = null;\n }\n\n function handleNewMetric(metric, vo) {\n // simply pass metric straight through\n if (metric === metricsConstants.DVB_ERRORS) {\n if (reportingController) {\n reportingController.report(metric, vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n\n return instance;\n}\n\nexport default dashjs.FactoryMaker.getClassFactory(DVBErrorsHandler); /* 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 GenericMetricHandler() {\n\n let instance,\n metricName,\n reportingController;\n\n function initialize(name, rc) {\n metricName = name;\n reportingController = rc;\n }\n\n function reset() {\n reportingController = null;\n metricName = undefined;\n }\n\n function handleNewMetric(metric, vo) {\n // simply pass metric straight through\n if (metric === metricName) {\n if (reportingController) {\n reportingController.report(metricName, vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n\n return instance;\n}\n\nGenericMetricHandler.__dashjs_factory_name = 'GenericMetricHandler';\nexport default dashjs.FactoryMaker.getClassFactory(GenericMetricHandler); /* 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 HandlerHelpers from '../../utils/HandlerHelpers';\n\nfunction HttpListHandler(config) {\n\n config = config || {};\n let instance,\n reportingController,\n n,\n type,\n name,\n interval;\n\n let storedVos = [];\n\n let handlerHelpers = HandlerHelpers(this.context).getInstance();\n\n const metricsConstants = config.metricsConstants;\n\n function intervalCallback() {\n var vos = storedVos;\n\n if (vos.length) {\n if (reportingController) {\n reportingController.report(name, vos);\n }\n }\n\n storedVos = [];\n }\n\n function initialize(basename, rc, n_ms, requestType) {\n if (rc) {\n\n // this will throw if n is invalid, to be\n // caught by the initialize caller.\n n = handlerHelpers.validateN(n_ms);\n\n reportingController = rc;\n\n if (requestType && requestType.length) {\n type = requestType;\n }\n\n name = handlerHelpers.reconstructFullMetricName(\n basename,\n n_ms,\n requestType\n );\n\n interval = setInterval(intervalCallback, n);\n }\n }\n\n function reset() {\n clearInterval(interval);\n interval = null;\n n = null;\n type = null;\n storedVos = [];\n reportingController = null;\n }\n\n function handleNewMetric(metric, vo) {\n if (metric === metricsConstants.HTTP_REQUEST) {\n if (!type || (type === vo.type)) {\n storedVos.push(vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n\n return instance;\n}\n\nHttpListHandler.__dashjs_factory_name = 'HttpListHandler';\nexport default dashjs.FactoryMaker.getClassFactory(HttpListHandler); /* 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 DVBReporting from './reporters/DVBReporting';\n\nfunction ReportingFactory(config) {\n config = config || {};\n\n const knownReportingSchemeIdUris = {\n 'urn:dvb:dash:reporting:2014': DVBReporting\n };\n\n const context = this.context;\n let instance;\n const logger = config.debug ? config.debug.getLogger(instance) : {};\n const metricsConstants = config.metricsConstants;\n\n function create(entry, rangeController) {\n let reporting;\n\n try {\n reporting = knownReportingSchemeIdUris[entry.schemeIdUri](context).create({\n metricsConstants: metricsConstants\n });\n\n reporting.initialize(entry, rangeController);\n } catch (e) {\n reporting = null;\n logger.error(`ReportingFactory: could not create Reporting with schemeIdUri ${entry.schemeIdUri} (${e.message})`);\n }\n\n return reporting;\n }\n\n function register(schemeIdUri, moduleName) {\n knownReportingSchemeIdUris[schemeIdUri] = moduleName;\n }\n\n function unregister(schemeIdUri) {\n delete knownReportingSchemeIdUris[schemeIdUri];\n }\n\n instance = {\n create: create,\n register: register,\n unregister: unregister\n };\n\n return instance;\n}\n\nReportingFactory.__dashjs_factory_name = 'ReportingFactory';\nexport default dashjs.FactoryMaker.getSingletonFactory(ReportingFactory); /* 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 MetricSerialiser from '../../utils/MetricSerialiser';\nimport RNG from '../../utils/RNG';\n\nfunction DVBReporting(config) {\n config = config || {};\n let instance;\n\n let context = this.context;\n let metricSerialiser,\n randomNumberGenerator,\n reportingPlayerStatusDecided,\n isReportingPlayer,\n reportingUrl,\n rangeController;\n\n let USE_DRAFT_DVB_SPEC = true;\n let allowPendingRequestsToCompleteOnReset = true;\n let pendingRequests = [];\n\n const metricsConstants = config.metricsConstants;\n\n function setup() {\n metricSerialiser = MetricSerialiser(context).getInstance();\n randomNumberGenerator = RNG(context).getInstance();\n\n resetInitialSettings();\n }\n\n function doGetRequest(url, successCB, failureCB) {\n let req = new XMLHttpRequest();\n const oncomplete = function () {\n let reqIndex = pendingRequests.indexOf(req);\n\n if (reqIndex === -1) {\n return;\n } else {\n pendingRequests.splice(reqIndex, 1);\n }\n\n if ((req.status >= 200) && (req.status < 300)) {\n if (successCB) {\n successCB();\n }\n } else {\n if (failureCB) {\n failureCB();\n }\n }\n };\n\n pendingRequests.push(req);\n\n try {\n req.open('GET', url);\n req.onloadend = oncomplete;\n req.onerror = oncomplete;\n req.send();\n } catch (e) {\n req.onerror();\n }\n }\n\n function report(type, vos) {\n if (!Array.isArray(vos)) {\n vos = [vos];\n }\n\n // If the Player is not a reporting Player, then the Player shall\n // not report any errors.\n // ... In addition to any time restrictions specified by a Range\n // element within the Metrics element.\n if (isReportingPlayer && rangeController.isEnabled()) {\n\n // This reporting mechanism operates by creating one HTTP GET\n // request for every entry in the top level list of the metric.\n vos.forEach(function (vo) {\n let url = metricSerialiser.serialise(vo);\n\n // this has been proposed for errata\n if (USE_DRAFT_DVB_SPEC && (type !== metricsConstants.DVB_ERRORS)) {\n url = `metricname=${type}&${url}`;\n }\n\n // Take the value of the @reportingUrl attribute, append a\n // question mark ('?') character and then append the string\n // created in the previous step.\n url = `${reportingUrl}?${url}`;\n\n // Make an HTTP GET request to the URL contained within the\n // string created in the previous step.\n doGetRequest(url, null, function () {\n // If the Player is unable to make the report, for\n // example because the @reportingUrl is invalid, the\n // host cannot be reached, or an HTTP status code other\n // than one in the 200 series is received, the Player\n // shall cease being a reporting Player for the\n // duration of the MPD.\n isReportingPlayer = false;\n });\n });\n }\n }\n\n function initialize(entry, rc) {\n let probability;\n\n rangeController = rc;\n\n reportingUrl = entry['dvb:reportingUrl'];\n\n // If a required attribute is missing, the Reporting descriptor may\n // be ignored by the Player\n if (!reportingUrl) {\n throw new Error(\n 'required parameter missing (dvb:reportingUrl)'\n );\n }\n\n // A Player's status, as a reporting Player or not, shall remain\n // static for the duration of the MPD, regardless of MPD updates.\n // (i.e. only calling reset (or failure) changes this state)\n if (!reportingPlayerStatusDecided) {\n // NOTE: DVB spec has a typo where it incorrectly references the\n // priority attribute, which should be probability\n probability = entry['dvb:probability'] || entry['dvb:priority'] || 0;\n // If the @priority attribute is set to 1000, it shall be a reporting Player.\n // If the @priority attribute is missing, the Player shall not be a reporting Player.\n // For any other value of the @probability attribute, it shall decide at random whether to be a\n // reporting Player, such that the probability of being one is @probability/1000.\n if (probability && (probability === 1000 || ((probability / 1000) >= randomNumberGenerator.random()))) {\n isReportingPlayer = true;\n }\n\n reportingPlayerStatusDecided = true;\n }\n }\n\n function resetInitialSettings() {\n reportingPlayerStatusDecided = false;\n isReportingPlayer = false;\n reportingUrl = null;\n rangeController = null;\n }\n\n function reset() {\n if (!allowPendingRequestsToCompleteOnReset) {\n pendingRequests.forEach(req => req.abort());\n pendingRequests = [];\n }\n\n resetInitialSettings();\n }\n\n instance = {\n report: report,\n initialize: initialize,\n reset: reset\n };\n\n setup();\n\n return instance;\n}\n\nDVBReporting.__dashjs_factory_name = 'DVBReporting';\nexport default dashjs.FactoryMaker.getClassFactory(DVBReporting); /* 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 DVBErrors from '../vo/DVBErrors';\nimport MetricsReportingEvents from '../MetricsReportingEvents';\n\nfunction DVBErrorsTranslator(config) {\n\n config = config || {};\n let instance,\n mpd;\n const eventBus = config.eventBus;\n const dashMetrics = config.dashMetrics;\n const metricsConstants = config.metricsConstants;\n //MediaPlayerEvents have been added to Events in MediaPlayer class\n const Events = config.events;\n\n function report(vo) {\n let o = new DVBErrors();\n\n if (!mpd) {\n return;\n }\n\n for (const key in vo) {\n if (vo.hasOwnProperty(key)) {\n o[key] = vo[key];\n }\n }\n\n if (!o.mpdurl) {\n o.mpdurl = mpd.originalUrl || mpd.url;\n }\n\n if (!o.terror) {\n o.terror = new Date();\n }\n\n dashMetrics.addDVBErrors(o);\n }\n\n function onManifestUpdate(e) {\n if (e.error) {\n return;\n }\n\n mpd = e.manifest;\n }\n\n function onServiceLocationChanged(e) {\n report({\n errorcode: DVBErrors.BASE_URL_CHANGED,\n servicelocation: e.entry\n });\n }\n\n function onBecameReporter() {\n report({\n errorcode: DVBErrors.BECAME_REPORTER\n });\n }\n\n function handleHttpMetric(vo) {\n if ((vo.responsecode === 0) || // connection failure - unknown\n (vo.responsecode >= 400) || // HTTP error status code\n (vo.responsecode < 100) || // unknown status codes\n (vo.responsecode >= 600)) { // unknown status codes\n report({\n errorcode: vo.responsecode || DVBErrors.CONNECTION_ERROR,\n url: vo.url,\n terror: vo.tresponse,\n servicelocation: vo._serviceLocation\n });\n }\n }\n\n function onMetricEvent(e) {\n switch (e.metric) {\n case metricsConstants.HTTP_REQUEST:\n handleHttpMetric(e.value);\n break;\n default:\n break;\n }\n }\n\n function onPlaybackError(e) {\n let reason = e.error ? e.error.code : 0;\n let errorcode;\n\n switch (reason) {\n case MediaError.MEDIA_ERR_NETWORK:\n errorcode = DVBErrors.CONNECTION_ERROR;\n break;\n case MediaError.MEDIA_ERR_DECODE:\n errorcode = DVBErrors.CORRUPT_MEDIA_OTHER;\n break;\n default:\n return;\n }\n\n report({\n errorcode: errorcode\n });\n }\n\n function initialise() {\n eventBus.on(Events.MANIFEST_UPDATED, onManifestUpdate, instance);\n eventBus.on(\n Events.SERVICE_LOCATION_BLACKLIST_CHANGED,\n onServiceLocationChanged,\n instance\n );\n eventBus.on(Events.METRIC_ADDED, onMetricEvent, instance);\n eventBus.on(Events.METRIC_UPDATED, onMetricEvent, instance);\n eventBus.on(Events.PLAYBACK_ERROR, onPlaybackError, instance);\n eventBus.on(\n MetricsReportingEvents.BECAME_REPORTING_PLAYER,\n onBecameReporter,\n instance\n );\n }\n\n function reset() {\n eventBus.off(Events.MANIFEST_UPDATED, onManifestUpdate, instance);\n eventBus.off(\n Events.SERVICE_LOCATION_BLACKLIST_CHANGED,\n onServiceLocationChanged,\n instance\n );\n eventBus.off(Events.METRIC_ADDED, onMetricEvent, instance);\n eventBus.off(Events.METRIC_UPDATED, onMetricEvent, instance);\n eventBus.off(Events.PLAYBACK_ERROR, onPlaybackError, instance);\n eventBus.off(\n MetricsReportingEvents.BECAME_REPORTING_PLAYER,\n onBecameReporter,\n instance\n );\n }\n\n instance = {\n initialise: initialise,\n reset: reset\n };\n\n initialise();\n\n return instance;\n}\n\nDVBErrorsTranslator.__dashjs_factory_name = 'DVBErrorsTranslator';\nexport default dashjs.FactoryMaker.getSingletonFactory(DVBErrorsTranslator); /* 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 HandlerHelpers() {\n return {\n reconstructFullMetricName: function (key, n, type) {\n let mn = key;\n\n if (n) {\n mn += '(' + n;\n\n if (type && type.length) {\n mn += ',' + type;\n }\n\n mn += ')';\n }\n\n return mn;\n },\n\n validateN: function (n_ms) {\n if (!n_ms) {\n throw new Error('missing n');\n }\n\n if (isNaN(n_ms)) {\n throw new Error('n is NaN');\n }\n\n // n is a positive integer is defined to refer to the metric\n // in which the buffer level is recorded every n ms.\n if (n_ms < 0) {\n throw new Error('n must be positive');\n }\n\n return n_ms;\n }\n };\n}\n\nHandlerHelpers.__dashjs_factory_name = 'HandlerHelpers';\nexport default dashjs.FactoryMaker.getSingletonFactory(HandlerHelpers); /* jshint ignore:line */\n","import Metrics from '../vo/Metrics';\nimport Range from '../vo/Range';\nimport Reporting from '../vo/Reporting';\n\nfunction ManifestParsing (config) {\n config = config || {};\n let instance;\n let adapter = config.adapter;\n const constants = config.constants;\n\n function getMetricsRangeStartTime(manifest, dynamic, range) {\n let voPeriods,\n reportingStartTime;\n let presentationStartTime = 0;\n\n if (dynamic) {\n // For services with MPD@type='dynamic', the start time is\n // indicated in wall clock time by adding the value of this\n // attribute to the value of the MPD@availabilityStartTime\n // attribute.\n presentationStartTime = adapter.getAvailabilityStartTime(manifest) / 1000;\n } else {\n // For services with MPD@type='static', the start time is indicated\n // in Media Presentation time and is relative to the PeriodStart\n // time of the first Period in this MPD.\n voPeriods = adapter.getRegularPeriods(manifest);\n\n if (voPeriods.length) {\n presentationStartTime = voPeriods[0].start;\n }\n }\n\n // When not present, DASH Metrics collection is\n // requested from the beginning of content\n // consumption.\n reportingStartTime = presentationStartTime;\n\n if (range && range.hasOwnProperty(constants.START_TIME)) {\n reportingStartTime += range.starttime;\n }\n\n return reportingStartTime;\n }\n\n function getMetrics(manifest) {\n let metrics = [];\n\n if (manifest && manifest.Metrics_asArray) {\n manifest.Metrics_asArray.forEach(metric => {\n var metricEntry = new Metrics();\n var isDynamic = adapter.getIsDynamic(manifest);\n\n if (metric.hasOwnProperty('metrics')) {\n metricEntry.metrics = metric.metrics;\n } else {\n return;\n }\n\n if (metric.Range_asArray) {\n metric.Range_asArray.forEach(range => {\n var rangeEntry = new Range();\n\n rangeEntry.starttime =\n getMetricsRangeStartTime(manifest, isDynamic, range);\n\n if (range.hasOwnProperty('duration')) {\n rangeEntry.duration = range.duration;\n } else {\n // if not present, the value is identical to the\n // Media Presentation duration.\n rangeEntry.duration = adapter.getDuration(manifest);\n }\n\n rangeEntry._useWallClockTime = isDynamic;\n\n metricEntry.Range.push(rangeEntry);\n });\n }\n\n if (metric.Reporting_asArray) {\n metric.Reporting_asArray.forEach(reporting => {\n var reportingEntry = new Reporting();\n\n if (reporting.hasOwnProperty(constants.SCHEME_ID_URI)) {\n reportingEntry.schemeIdUri = reporting.schemeIdUri;\n } else {\n // Invalid Reporting. schemeIdUri must be set. Ignore.\n return;\n }\n\n for (const prop in reporting) {\n if (reporting.hasOwnProperty(prop)) {\n reportingEntry[prop] = reporting[prop];\n }\n }\n\n metricEntry.Reporting.push(reportingEntry);\n });\n } else {\n // Invalid Metrics. At least one reporting must be present. Ignore\n return;\n }\n\n metrics.push(metricEntry);\n });\n }\n\n return metrics;\n }\n\n instance = {\n getMetrics: getMetrics\n };\n\n return instance;\n}\n\nManifestParsing.__dashjs_factory_name = 'ManifestParsing';\nexport default dashjs.FactoryMaker.getSingletonFactory(ManifestParsing); /* jshint ignore:line */","/**\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 MetricSerialiser() {\n\n // For each entry in the top level list within the metric (in the case\n // of the DVBErrors metric each entry corresponds to an \"error event\"\n // described in clause 10.8.4) the Player shall:\n function serialise(metric) {\n let pairs = [];\n let obj = [];\n let key,\n value;\n\n // Take each (key, value) pair from the metric entry and create a\n // string consisting of the name of the key, followed by an equals\n // ('=') character, followed by the string representation of the\n // value. The string representation of the value is created based\n // on the type of the value following the instructions in Table 22.\n for (key in metric) {\n if (metric.hasOwnProperty(key) && (key.indexOf('_') !== 0)) {\n value = metric[key];\n\n // we want to ensure that keys still end up in the report\n // even if there is no value\n if ((value === undefined) || (value === null)) {\n value = '';\n }\n\n // DVB A168 10.12.4 Table 22\n if (Array.isArray(value)) {\n // if trace or similar is null, do not include in output\n if (!value.length) {\n continue;\n }\n\n obj = [];\n\n value.forEach(function (v) {\n let isBuiltIn = Object.prototype.toString.call(v).slice(8, -1) !== 'Object';\n\n obj.push(isBuiltIn ? v : serialise(v));\n });\n\n value = obj.map(encodeURIComponent).join(',');\n } else if (typeof value === 'string') {\n value = encodeURIComponent(value);\n } else if (value instanceof Date) {\n value = value.toISOString();\n } else if (typeof value === 'number') {\n value = Math.round(value);\n }\n\n pairs.push(key + '=' + value);\n }\n }\n\n // Concatenate the strings created in the previous step with an\n // ampersand ('&') character between each one.\n return pairs.join('&');\n }\n\n return {\n serialise: serialise\n };\n}\n\nMetricSerialiser.__dashjs_factory_name = 'MetricSerialiser';\nexport default dashjs.FactoryMaker.getSingletonFactory(MetricSerialiser); /* 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 RNG() {\n\n // check whether secure random numbers are available. if not, revert to\n // using Math.random\n let crypto = window.crypto || window.msCrypto;\n\n // could just as easily use any other array type by changing line below\n let ArrayType = Uint32Array;\n let MAX_VALUE = Math.pow(2, ArrayType.BYTES_PER_ELEMENT * 8) - 1;\n\n // currently there is only one client for this code, and that only uses\n // a single random number per initialisation. may want to increase this\n // number if more consumers in the future\n let NUM_RANDOM_NUMBERS = 10;\n\n let randomNumbers,\n index,\n instance;\n\n function initialise() {\n if (crypto) {\n if (!randomNumbers) {\n randomNumbers = new ArrayType(NUM_RANDOM_NUMBERS);\n }\n crypto.getRandomValues(randomNumbers);\n index = 0;\n }\n }\n\n function rand(min, max) {\n let r;\n\n if (!min) {\n min = 0;\n }\n\n if (!max) {\n max = 1;\n }\n\n if (crypto) {\n if (index === randomNumbers.length) {\n initialise();\n }\n\n r = randomNumbers[index] / MAX_VALUE;\n index += 1;\n } else {\n r = Math.random();\n }\n\n return (r * (max - min)) + min;\n }\n\n instance = {\n random: rand\n };\n\n initialise();\n\n return instance;\n}\n\nRNG.__dashjs_factory_name = 'RNG';\nexport default dashjs.FactoryMaker.getSingletonFactory(RNG); /* 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 * @class\n * @ignore\n */\nclass DVBErrors {\n constructor() {\n this.mpdurl = null;\n // String - Absolute URL from which the MPD was originally\n // retrieved (MPD updates will not change this value).\n\n this.errorcode = null;\n // String - The value of errorcode depends upon the type\n // of error being reported. For an error listed in the\n // ErrorType column below the value is as described in the\n // Value column.\n //\n // ErrorType Value\n // --------- -----\n // HTTP error status code HTTP status code\n // Unknown HTTP status code HTTP status code\n // SSL connection failed \"SSL\" followed by SSL alert value\n // DNS resolution failed \"C00\"\n // Host unreachable \"C01\"\n // Connection refused \"C02\"\n // Connection error – Not otherwise specified \"C03\"\n // Corrupt media – ISO BMFF container cannot be parsed \"M00\"\n // Corrupt media – Not otherwise specified \"M01\"\n // Changing Base URL in use due to errors \"F00\"\n // Becoming an error reporting Player \"S00\"\n\n this.terror = null;\n // Real-Time - Date and time at which error occurred in UTC,\n // formatted as a combined date and time according to ISO 8601.\n\n this.url = null;\n // String - Absolute URL from which data was being requested\n // when this error occurred. If the error report is in relation\n // to corrupt media or changing BaseURL, this may be a null\n // string if the URL from which the media was obtained or\n // which led to the change of BaseURL is no longer known.\n\n this.ipaddress = null;\n // String - IP Address which the host name in \"url\" resolved to.\n // If the error report is in relation to corrupt media or\n // changing BaseURL, this may be a null string if the URL\n // from which the media was obtained or which led to the\n // change of BaseURL is no longer known.\n\n this.servicelocation = null;\n // String - The value of the serviceLocation field in the\n // BaseURL being used. In the event of this report indicating\n // a change of BaseURL this is the value from the BaseURL\n // being moved from.\n }\n}\n\nDVBErrors.SSL_CONNECTION_FAILED_PREFIX = 'SSL';\nDVBErrors.DNS_RESOLUTION_FAILED = 'C00';\nDVBErrors.HOST_UNREACHABLE = 'C01';\nDVBErrors.CONNECTION_REFUSED = 'C02';\nDVBErrors.CONNECTION_ERROR = 'C03';\nDVBErrors.CORRUPT_MEDIA_ISOBMFF = 'M00';\nDVBErrors.CORRUPT_MEDIA_OTHER = 'M01';\nDVBErrors.BASE_URL_CHANGED = 'F00';\nDVBErrors.BECAME_REPORTER = 'S00';\n\nexport default DVBErrors;\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 Metrics {\n constructor() {\n\n this.metrics = '';\n this.Range = [];\n this.Reporting = [];\n }\n}\n\nexport default Metrics;\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 Range {\n constructor() {\n\n // as defined in ISO23009-1\n this.starttime = 0;\n this.duration = Infinity;\n\n // for internal use\n this._useWallClockTime = false;\n }\n}\n\nexport default Range;\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 Reporting {\n constructor() {\n // Reporting is a DescriptorType and doesn't have any additional fields\n this.schemeIdUri = '';\n this.value = '';\n }\n}\n\nexport default Reporting;\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 FactoryMaker from '../../core/FactoryMaker';\nimport { checkInteger } from '../utils/SupervisorTools';\n\nfunction CustomTimeRanges(/*config*/) {\n let customTimeRangeArray = [];\n let length = 0;\n\n function add(start, end) {\n let i = 0;\n\n for (i = 0; (i < this.customTimeRangeArray.length) && (start > this.customTimeRangeArray[i].start); i++);\n\n this.customTimeRangeArray.splice(i, 0, {start: start,end: end});\n\n for (i = 0; i < this.customTimeRangeArray.length - 1; i++) {\n if (this.mergeRanges(i,i + 1)) {\n i--;\n }\n }\n this.length = this.customTimeRangeArray.length;\n }\n\n function clear() {\n this.customTimeRangeArray = [];\n this.length = 0;\n }\n\n function remove(start, end) {\n for (let i = 0; i < this.customTimeRangeArray.length; i++) {\n if (start <= this.customTimeRangeArray[i].start && end >= this.customTimeRangeArray[i].end) {\n // |--------------Range i-------|\n //|---------------Range to remove ---------------|\n // or\n //|--------------Range i-------|\n //|--------------Range to remove ---------------|\n // or\n // |--------------Range i-------|\n //|--------------Range to remove ---------------|\n this.customTimeRangeArray.splice(i,1);\n i--;\n\n } else if (start > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) {\n //|-----------------Range i----------------|\n // |-------Range to remove -----|\n this.customTimeRangeArray.splice(i + 1, 0, {start: end,end: this.customTimeRangeArray[i].end});\n this.customTimeRangeArray[i].end = start;\n break;\n } else if ( start > this.customTimeRangeArray[i].start && start < this.customTimeRangeArray[i].end) {\n //|-----------Range i----------|\n // |---------Range to remove --------|\n // or\n //|-----------------Range i----------------|\n // |-------Range to remove -----|\n this.customTimeRangeArray[i].end = start;\n } else if ( end > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) {\n // |-----------Range i----------|\n //|---------Range to remove --------|\n // or\n //|-----------------Range i----------------|\n //|-------Range to remove -----|\n this.customTimeRangeArray[i].start = end;\n }\n }\n\n this.length = this.customTimeRangeArray.length;\n }\n\n function mergeRanges(rangeIndex1, rangeIndex2) {\n let range1 = this.customTimeRangeArray[rangeIndex1];\n let range2 = this.customTimeRangeArray[rangeIndex2];\n\n if (range1.start <= range2.start && range2.start <= range1.end && range1.end <= range2.end) {\n //|-----------Range1----------|\n // |-----------Range2----------|\n range1.end = range2.end;\n this.customTimeRangeArray.splice(rangeIndex2,1);\n return true;\n\n } else if (range2.start <= range1.start && range1.start <= range2.end && range2.end <= range1.end) {\n // |-----------Range1----------|\n //|-----------Range2----------|\n range1.start = range2.start;\n this.customTimeRangeArray.splice(rangeIndex2,1);\n return true;\n } else if (range2.start <= range1.start && range1.start <= range2.end && range1.end <= range2.end) {\n // |--------Range1-------|\n //|---------------Range2--------------|\n this.customTimeRangeArray.splice(rangeIndex1,1);\n return true;\n } else if (range1.start <= range2.start && range2.start <= range1.end && range2.end <= range1.end) {\n //|-----------------Range1--------------|\n // |-----------Range2----------|\n this.customTimeRangeArray.splice(rangeIndex2,1);\n return true;\n }\n return false;\n }\n\n function start(index) {\n checkInteger(index);\n\n if (index >= this.customTimeRangeArray.length || index < 0) {\n return NaN;\n }\n\n return this.customTimeRangeArray[index].start;\n }\n\n function end(index) {\n checkInteger(index);\n\n if (index >= this.customTimeRangeArray.length || index < 0) {\n return NaN;\n }\n\n return this.customTimeRangeArray[index].end;\n }\n\n return {\n customTimeRangeArray: customTimeRangeArray,\n length: length,\n add: add,\n clear: clear,\n remove: remove,\n mergeRanges: mergeRanges,\n start: start,\n end: end\n };\n}\nCustomTimeRanges.__dashjs_factory_name = 'CustomTimeRanges';\nexport default FactoryMaker.getClassFactory(CustomTimeRanges);\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 Constants from '../constants/Constants';\n\nexport function checkParameterType(parameter, type) {\n if (typeof parameter !== type) {\n throw Constants.BAD_ARGUMENT_ERROR;\n }\n}\n\nexport function checkInteger(parameter) {\n const isInt = parameter !== null && !isNaN(parameter) && (parameter % 1 === 0);\n\n if (!isInt) {\n throw Constants.BAD_ARGUMENT_ERROR + ' : argument is not an integer';\n }\n}\n\nexport function checkRange(parameter, min, max) {\n if (parameter < min || parameter > max) {\n throw Constants.BAD_ARGUMENT_ERROR + ' : argument out of range';\n }\n}\n\nexport function checkIsVideoOrAudioType(type) {\n if (typeof type !== 'string' || (type !== Constants.AUDIO && type !== Constants.VIDEO)) {\n throw Constants.BAD_ARGUMENT_ERROR;\n }\n}"],"names":["f","g","exports","module","define","amd","window","global","self","this","dashjs","MetricsReporting","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","_dereq_","instance","singletonContexts","singletonFactories","classFactories","FactoryMaker","undefined","extend","name","childInstance","override","context","getSingletonInstance","setSingletonInstance","className","obj","push","getSingletonFactory","classConstructor","factory","getFactoryByName","__dashjs_factory_name","getInstance","merge","arguments","getSingletonFactoryByName","updateSingletonFactory","updateFactory","getClassFactory","create","getClassFactoryByName","updateClassFactory","factoriesArray","args","classInstance","extensionObject","extension","apply","prop","parent","hasOwnProperty","getClassName","EventsBase","events","config","publicOnly","evt","indexOf","Constants","init","constants","STREAM","VIDEO","AUDIO","TEXT","FRAGMENTED_TEXT","EMBEDDED_TEXT","MUXED","IMAGE","STPP","TTML","VTT","WVTT","ABR_STRATEGY_DYNAMIC","ABR_STRATEGY_BOLA","ABR_STRATEGY_THROUGHPUT","MOVING_AVERAGE_SLIDING_WINDOW","MOVING_AVERAGE_EWMA","BAD_ARGUMENT_ERROR","MISSING_CONFIG_ERROR","LOCATION","INITIALIZE","TEXT_SHOWING","TEXT_HIDDEN","CC1","CC3","UTF8","SCHEME_ID_URI","START_TIME","SERVICE_DESCRIPTION_LL_SCHEME","SUPPLEMENTAL_PROPERTY_LL_SCHEME","XML","ARRAY_BUFFER","createMetricsReporting","_utilsDVBErrorsTranslator2","eventBus","dashMetrics","metricsConstants","_controllersMetricsCollectionController2","getReportingFactory","_reportingReportingFactory2","getMetricsHandlerFactory","_metricsMetricsHandlerFactory2","_MetricsReportingEvents2","MetricsReportingEvents","_get","Object","getPrototypeOf","prototype","METRICS_INITIALISATION_COMPLETE","BECAME_REPORTING_PLAYER","metricsReportingEvents","MetricsCollectionController","metricsControllers","update","controllersToRemove","error","keys","_utilsManifestParsing2","adapter","getMetrics","manifest","forEach","m","key","JSON","stringify","splice","controller","_MetricsController2","initialize","reset","trigger","resetMetricsControllers","on","MANIFEST_UPDATED","STREAM_TEARDOWN_COMPLETE","off","MetricsController","metricsHandlersController","reportingController","rangeController","metricsEntry","_RangeController2","mediaElement","Range","_ReportingController2","debug","Reporting","_MetricsHandlersController2","metrics","MetricsHandlersController","handlers","Events","metricsHandlerFactory","handle","handler","handleNewMetric","metric","value","mediaType","split","midx","ms","nextm","METRIC_ADDED","METRIC_UPDATED","RangeController","useWallClockTime","ranges","rs","start","starttime","end","duration","add","_useWallClockTime","clear","isEnabled","time","numRanges","Date","getTime","currentTime","_utilsCustomTimeRanges2","ReportingController","reporters","reportingFactory","reporting","some","reporter","report","type","vos","MetricsHandlerFactory","logger","getLogger","keyRegex","knownFactoryProducts","BufferLevel","_handlersBufferLevelHandler2","DVBErrors","_handlersDVBErrorsHandler2","HttpList","_handlersHttpListHandler2","PlayList","_handlersGenericMetricHandler2","RepSwitchList","TcpList","listType","matches","match","message","register","unregister","BufferLevelHandler","interval","lastReportedTime","handlerHelpers","_utilsHandlerHelpers2","storedVOs","intervalCallback","vo","map","reduce","b","level","getLowestBufferLevelVO","basename","rc","n_ms","validateN","reconstructFullMetricName","setInterval","clearInterval","BUFFER_LEVEL","onInitialisationComplete","unused","DVB_ERRORS","GenericMetricHandler","metricName","HttpListHandler","storedVos","requestType","HTTP_REQUEST","ReportingFactory","knownReportingSchemeIdUris","urn:dvb:dash:reporting:2014","_reportersDVBReporting2","entry","schemeIdUri","moduleName","DVBReporting","metricSerialiser","randomNumberGenerator","reportingPlayerStatusDecided","isReportingPlayer","reportingUrl","pendingRequests","doGetRequest","url","successCB","failureCB","oncomplete","reqIndex","req","status","XMLHttpRequest","open","onloadend","onerror","send","resetInitialSettings","Array","isArray","serialise","probability","random","_utilsMetricSerialiser2","_utilsRNG2","DVBErrorsTranslator","mpd","_voDVBErrors2","mpdurl","originalUrl","terror","addDVBErrors","onManifestUpdate","onServiceLocationChanged","errorcode","BASE_URL_CHANGED","servicelocation","onBecameReporter","BECAME_REPORTER","onMetricEvent","responsecode","CONNECTION_ERROR","tresponse","_serviceLocation","onPlaybackError","MediaError","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","CORRUPT_MEDIA_OTHER","initialise","SERVICE_LOCATION_BLACKLIST_CHANGED","PLAYBACK_ERROR","HandlerHelpers","mn","isNaN","ManifestParsing","Metrics_asArray","metricEntry","_voMetrics2","isDynamic","getIsDynamic","Range_asArray","range","voPeriods","reportingStartTime","presentationStartTime","rangeEntry","_voRange2","getAvailabilityStartTime","getRegularPeriods","getDuration","Reporting_asArray","reportingEntry","_voReporting2","MetricSerialiser","pairs","v","isBuiltIn","toString","slice","encodeURIComponent","join","toISOString","Math","round","RNG","crypto","msCrypto","ArrayType","Uint32Array","MAX_VALUE","pow","BYTES_PER_ELEMENT","NUM_RANDOM_NUMBERS","randomNumbers","index","getRandomValues","min","max","ipaddress","SSL_CONNECTION_FAILED_PREFIX","DNS_RESOLUTION_FAILED","HOST_UNREACHABLE","CONNECTION_REFUSED","CORRUPT_MEDIA_ISOBMFF","Metrics","Infinity","CustomTimeRanges","customTimeRangeArray","mergeRanges","remove","rangeIndex1","rangeIndex2","range1","range2","_utilsSupervisorTools","checkInteger","NaN","_coreFactoryMaker2","parameter","_constantsConstants2"],"mappings":";CAAA,SAAAA,GAAA,IAAAC,EAAA,iBAAAC,SAAA,oBAAAC,OAAAA,OAAAD,QAAAF,IAAA,mBAAAI,QAAAA,OAAAC,IAAAD,OAAA,GAAAJ,KAAAC,EAAA,oBAAAK,OAAAA,OAAA,oBAAAC,OAAAA,OAAA,oBAAAC,KAAAA,KAAAC,MAAAC,SAAAT,EAAAS,OAAA,KAAAC,iBAAAX,IAAA,CAAA,WAAA,OAAA,SAAAY,EAAAC,EAAAC,EAAAC,GAAA,SAAAC,EAAAC,EAAAjB,GAAA,IAAAc,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,IAAAC,EAAA,mBAAAC,SAAAA,QAAA,IAAAnB,GAAAkB,EAAA,OAAAA,EAAAD,GAAA,GAAA,GAAAG,EAAA,OAAAA,EAAAH,GAAA,GAAA,IAAAI,EAAA,IAAAC,MAAA,uBAAAL,EAAA,KAAA,MAAAI,EAAAE,KAAA,mBAAAF,EAAA,IAAAG,EAAAV,EAAAG,GAAA,CAAAf,QAAA,IAAAW,EAAAI,GAAA,GAAAQ,KAAAD,EAAAtB,QAAA,SAAAU,GAAA,OAAAI,EAAAH,EAAAI,GAAA,GAAAL,IAAAA,IAAAY,EAAAA,EAAAtB,QAAAU,EAAAC,EAAAC,EAAAC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