From 5cc45bc48447a8fa28fa19afc9cd9ef2ecb396c7 Mon Sep 17 00:00:00 2001 From: Martin Lasak Date: Thu, 7 May 2020 19:32:41 +0200 Subject: [PATCH] Fix lint errors --- .../controllers/RepresentationController.js | 2 +- src/dash/parser/DashParser.js | 14 ++-- src/dash/parser/matchers/StringMatcher.js | 56 +++++++------- src/dash/utils/SegmentsUtils.js | 12 +-- src/mss/MssFragmentProcessor.js | 3 +- src/mss/parser/MssParser.js | 4 +- src/offline/OfflineDownload.js | 74 +++++++++---------- src/offline/OfflineStreamProcessor.js | 34 ++++----- src/offline/controllers/OfflineController.js | 10 +-- src/offline/utils/OfflineUrlUtils.js | 8 +- src/streaming/ManifestLoader.js | 2 +- src/streaming/MediaPlayer.js | 2 +- src/streaming/MediaPlayerFactory.js | 4 +- .../controllers/BaseURLController.js | 7 +- .../controllers/TimeSyncController.js | 26 +++---- src/streaming/controllers/XlinkController.js | 14 ++-- src/streaming/metrics/MetricsReporting.js | 6 +- .../metrics/controllers/MetricsController.js | 2 +- .../controllers/MetricsHandlersController.js | 2 +- .../metrics/controllers/RangeController.js | 8 +- .../controllers/ReportingController.js | 4 +- .../metrics/metrics/MetricsHandlerFactory.js | 16 ++-- .../metrics/handlers/BufferLevelHandler.js | 6 +- .../metrics/handlers/DVBErrorsHandler.js | 6 +- .../metrics/handlers/HttpListHandler.js | 6 +- .../metrics/reporting/ReportingFactory.js | 4 +- .../reporting/reporters/DVBReporting.js | 11 ++- src/streaming/models/MediaPlayerModel.js | 6 +- src/streaming/net/HTTPLoader.js | 4 +- src/streaming/net/SchemeLoaderFactory.js | 4 +- src/streaming/protection/CommonEncryption.js | 5 +- .../models/ProtectionModel_21Jan2015.js | 2 +- src/streaming/rules/ThroughputHistory.js | 2 +- .../scheduling/NextFragmentRequestRule.js | 4 +- src/streaming/thumbnail/ThumbnailTracks.js | 2 +- src/streaming/utils/BaseURLSelector.js | 4 +- src/streaming/utils/DefaultURLUtils.js | 22 +++--- src/streaming/utils/URLUtils.js | 26 +++---- test/unit/Streaming.StreamProcessor.js | 2 +- test/unit/dash.DashParser.js | 2 +- test/unit/dash.models.DashManifestModel.js | 44 +++++------ test/unit/mocks/AdapterMock.js | 2 +- test/unit/mocks/MediaPlayerModelMock.js | 2 +- test/unit/mocks/RulesContextMock.js | 4 +- test/unit/mss.parser.MssParser.js | 2 +- test/unit/streaming.ManifestUpdater.js | 2 +- .../streaming.controllers.BufferController.js | 4 +- .../streaming.controllers.MediaController.js | 4 +- ...treaming.controllers.ScheduleController.js | 18 ++--- .../streaming.controllers.SourceBufferSink.js | 8 +- .../streaming.controllers.StreamController.js | 20 ++--- test/unit/streaming.net.HTTPLoader.js | 10 +-- test/unit/streaming.net.XHRLoader.js | 4 +- ...ing.protection.drm.KeySystemW3CClearKey.js | 6 +- ....text.NotFragmentedTextBufferController.js | 4 +- test/unit/streaming.text.TextController.js | 8 +- test/unit/streaming.text.TextSourceBuffer.js | 6 +- ...streaming.thumbnail.ThumbnailController.js | 10 ++- 58 files changed, 294 insertions(+), 292 deletions(-) diff --git a/src/dash/controllers/RepresentationController.js b/src/dash/controllers/RepresentationController.js index 0c1e9b92f6..71b1c6d9be 100644 --- a/src/dash/controllers/RepresentationController.js +++ b/src/dash/controllers/RepresentationController.js @@ -178,7 +178,7 @@ function RepresentationController(config) { for (let i = 0, ln = voAvailableRepresentations.length; i < ln; i++) { updateRepresentation(voAvailableRepresentations[i], isDynamic); if (notifyUpdate) { - eventBus.trigger(events.REPRESENTATION_UPDATE_STARTED, { sender: instance, representation: voAvailableRepresentations[i]}); + eventBus.trigger(events.REPRESENTATION_UPDATE_STARTED, { sender: instance, representation: voAvailableRepresentations[i]}); } } } diff --git a/src/dash/parser/DashParser.js b/src/dash/parser/DashParser.js index 7b8497e436..e7d772b24b 100644 --- a/src/dash/parser/DashParser.js +++ b/src/dash/parser/DashParser.js @@ -59,14 +59,14 @@ function DashParser() { ]; converter = new X2JS({ - escapeMode: false, - attributePrefix: '', - arrayAccessForm: 'property', - emptyNodeForm: 'object', - stripWhitespaces: false, + escapeMode: false, + attributePrefix: '', + arrayAccessForm: 'property', + emptyNodeForm: 'object', + stripWhitespaces: false, enableToStringFunc: true, - ignoreRoot: true, - matchers: matchers + ignoreRoot: true, + matchers: matchers }); objectIron = ObjectIron(context).create({ diff --git a/src/dash/parser/matchers/StringMatcher.js b/src/dash/parser/matchers/StringMatcher.js index a1e203cfe1..78321c7dcb 100644 --- a/src/dash/parser/matchers/StringMatcher.js +++ b/src/dash/parser/matchers/StringMatcher.js @@ -39,34 +39,34 @@ class StringMatcher extends BaseMatcher { super( (attr, nodeName) => { const stringAttrsInElements = { - [DashConstants.MPD]: [ DashConstants.ID, DashConstants.PROFILES ], - [DashConstants.PERIOD]: [ DashConstants.ID ], - [DashConstants.BASE_URL]: [ DashConstants.SERVICE_LOCATION, DashConstants.BYTE_RANGE ], - [DashConstants.SEGMENT_BASE]: [ DashConstants.INDEX_RANGE ], - [DashConstants.INITIALIZATION]: [ DashConstants.RANGE ], - [DashConstants.REPRESENTATION_INDEX]: [ DashConstants.RANGE ], - [DashConstants.SEGMENT_LIST]: [ DashConstants.INDEX_RANGE ], - [DashConstants.BITSTREAM_SWITCHING]: [ DashConstants.RANGE ], - [DashConstants.SEGMENT_URL]: [ DashConstants.MEDIA_RANGE, DashConstants.INDEX_RANGE ], - [DashConstants.SEGMENT_TEMPLATE]: [ DashConstants.INDEX_RANGE, DashConstants.MEDIA, DashConstants.INDEX, DashConstants.INITIALIZATION_MINUS, DashConstants.BITSTREAM_SWITCHING_MINUS ], - [DashConstants.ASSET_IDENTIFIER]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.EVENT_STREAM]: [ DashConstants.VALUE ], - [DashConstants.ADAPTATION_SET]: [ DashConstants.PROFILES, DashConstants.MIME_TYPE, DashConstants.SEGMENT_PROFILES, DashConstants.CODECS, DashConstants.CONTENT_TYPE ], - [DashConstants.FRAME_PACKING]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.AUDIO_CHANNEL_CONFIGURATION]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.CONTENT_PROTECTION]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.ESSENTIAL_PROPERTY]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.SUPPLEMENTAL_PROPERTY]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.INBAND_EVENT_STREAM]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.ACCESSIBILITY]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.ROLE]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.RATING]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.VIEWPOINT]: [ DashConstants.VALUE, DashConstants.ID ], - [DashConstants.CONTENT_COMPONENT]: [ DashConstants.CONTENT_TYPE ], - [DashConstants.REPRESENTATION]: [ DashConstants.ID, DashConstants.DEPENDENCY_ID, DashConstants.MEDIA_STREAM_STRUCTURE_ID ], - [DashConstants.SUBSET]: [ DashConstants.ID ], - [DashConstants.METRICS]: [ DashConstants.METRICS_MINUS ], - [DashConstants.REPORTING]: [ DashConstants.VALUE, DashConstants.ID ] + [DashConstants.MPD]: [ DashConstants.ID, DashConstants.PROFILES ], + [DashConstants.PERIOD]: [ DashConstants.ID ], + [DashConstants.BASE_URL]: [ DashConstants.SERVICE_LOCATION, DashConstants.BYTE_RANGE ], + [DashConstants.SEGMENT_BASE]: [ DashConstants.INDEX_RANGE ], + [DashConstants.INITIALIZATION]: [ DashConstants.RANGE ], + [DashConstants.REPRESENTATION_INDEX]: [ DashConstants.RANGE ], + [DashConstants.SEGMENT_LIST]: [ DashConstants.INDEX_RANGE ], + [DashConstants.BITSTREAM_SWITCHING]: [ DashConstants.RANGE ], + [DashConstants.SEGMENT_URL]: [ DashConstants.MEDIA_RANGE, DashConstants.INDEX_RANGE ], + [DashConstants.SEGMENT_TEMPLATE]: [ DashConstants.INDEX_RANGE, DashConstants.MEDIA, DashConstants.INDEX, DashConstants.INITIALIZATION_MINUS, DashConstants.BITSTREAM_SWITCHING_MINUS ], + [DashConstants.ASSET_IDENTIFIER]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.EVENT_STREAM]: [ DashConstants.VALUE ], + [DashConstants.ADAPTATION_SET]: [ DashConstants.PROFILES, DashConstants.MIME_TYPE, DashConstants.SEGMENT_PROFILES, DashConstants.CODECS, DashConstants.CONTENT_TYPE ], + [DashConstants.FRAME_PACKING]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.AUDIO_CHANNEL_CONFIGURATION]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.CONTENT_PROTECTION]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.ESSENTIAL_PROPERTY]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.SUPPLEMENTAL_PROPERTY]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.INBAND_EVENT_STREAM]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.ACCESSIBILITY]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.ROLE]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.RATING]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.VIEWPOINT]: [ DashConstants.VALUE, DashConstants.ID ], + [DashConstants.CONTENT_COMPONENT]: [ DashConstants.CONTENT_TYPE ], + [DashConstants.REPRESENTATION]: [ DashConstants.ID, DashConstants.DEPENDENCY_ID, DashConstants.MEDIA_STREAM_STRUCTURE_ID ], + [DashConstants.SUBSET]: [ DashConstants.ID ], + [DashConstants.METRICS]: [ DashConstants.METRICS_MINUS ], + [DashConstants.REPORTING]: [ DashConstants.VALUE, DashConstants.ID ] }; if (stringAttrsInElements.hasOwnProperty(nodeName)) { let attrNames = stringAttrsInElements[nodeName]; diff --git a/src/dash/utils/SegmentsUtils.js b/src/dash/utils/SegmentsUtils.js index b521503e1b..ee219c4b84 100644 --- a/src/dash/utils/SegmentsUtils.js +++ b/src/dash/utils/SegmentsUtils.js @@ -183,9 +183,9 @@ export function getIndexBasedSegment(timelineConverter, isDynamic, representatio presentationEndTime = parseFloat((presentationStartTime + duration).toFixed(5)); const segment = getSegment(representation, duration, presentationStartTime, - timelineConverter.calcMediaTimeFromPresentationTime(presentationStartTime, representation), - timelineConverter.calcAvailabilityStartTimeFromPresentationTime(presentationStartTime, representation.adaptation.period.mpd, isDynamic), - timelineConverter, presentationEndTime, isDynamic, index); + timelineConverter.calcMediaTimeFromPresentationTime(presentationStartTime, representation), + timelineConverter.calcAvailabilityStartTimeFromPresentationTime(presentationStartTime, representation.adaptation.period.mpd, isDynamic), + timelineConverter, presentationEndTime, isDynamic, index); if (!isSegmentAvailable(timelineConverter, representation, segment, isDynamic)) { return null; @@ -206,9 +206,9 @@ export function getTimeBasedSegment(timelineConverter, isDynamic, representation presentationEndTime = presentationStartTime + scaledDuration; seg = getSegment(representation, scaledDuration, presentationStartTime, - scaledTime, - representation.adaptation.period.mpd.manifest.loadedTime, - timelineConverter, presentationEndTime, isDynamic, index); + scaledTime, + representation.adaptation.period.mpd.manifest.loadedTime, + timelineConverter, presentationEndTime, isDynamic, index); if (!isSegmentAvailable(timelineConverter, representation, seg, isDynamic)) { return null; diff --git a/src/mss/MssFragmentProcessor.js b/src/mss/MssFragmentProcessor.js index 6804c547b1..ef2f3d3c79 100644 --- a/src/mss/MssFragmentProcessor.js +++ b/src/mss/MssFragmentProcessor.js @@ -138,7 +138,8 @@ function MssFragmentProcessor(config) { mssFragmentMoovProcessor = MssFragmentMoovProcessor(context).create({ protectionController: protectionController, constants: config.constants, - ISOBoxer: ISOBoxer}); + ISOBoxer: ISOBoxer + }); mssFragmentMoofProcessor = MssFragmentMoofProcessor(context).create({ dashMetrics: dashMetrics, diff --git a/src/mss/parser/MssParser.js b/src/mss/parser/MssParser.js index a03891fdbc..5891fda42b 100644 --- a/src/mss/parser/MssParser.js +++ b/src/mss/parser/MssParser.js @@ -111,8 +111,8 @@ function MssParser(config) { function mapAdaptationSet(streamIndex, timescale) { const adaptationSet = {}; const representations = []; - let segmentTemplate; - let qualityLevels, + let segmentTemplate, + qualityLevels, representation, segments, i; diff --git a/src/offline/OfflineDownload.js b/src/offline/OfflineDownload.js index 0fb4476175..8449190a62 100644 --- a/src/offline/OfflineDownload.js +++ b/src/offline/OfflineDownload.js @@ -229,10 +229,10 @@ function OfflineDownload(config) { if (!e.error && manifestId !== null) { _status = OfflineConstants.OFFLINE_STATUS_FINISHED; offlineStoreController.setDownloadingStatus(manifestId, _status) - .then(function () { - eventBus.trigger(events.DOWNLOADING_FINISHED, {id: manifestId, message: 'Downloading has been successfully completed for this stream !'}); - resetDownload(); - }); + .then(function () { + eventBus.trigger(events.DOWNLOADING_FINISHED, {id: manifestId, message: 'Downloading has been successfully completed for this stream !'}); + resetDownload(); + }); } else { _status = OfflineConstants.OFFLINE_STATUS_ERROR; errHandler.error({ @@ -258,15 +258,15 @@ function OfflineDownload(config) { _indexDBManifestParser.parse(_xmlManifest, _representationsToUpdate).then(function (parsedManifest) { if (parsedManifest !== null && manifestId !== null) { offlineStoreController.getManifestById(manifestId) - .then((item) => { - item.manifest = parsedManifest; - return updateOfflineManifest(item); - }) - .then( function () { - for (let i = 0, ln = _streams.length; i < ln; i++) { - _streams[i].startOfflineStreamProcessors(); - } - }); + .then((item) => { + item.manifest = parsedManifest; + return updateOfflineManifest(item); + }) + .then( function () { + for (let i = 0, ln = _streams.length; i < ln; i++) { + _streams[i].startOfflineStreamProcessors(); + } + }); } else { throw 'falling parsing offline manifest'; } @@ -447,15 +447,15 @@ function OfflineDownload(config) { let rep = formatSelectedRepresentations(selectedRepresentations); offlineStoreController.saveSelectedRepresentations(manifestId, rep) - .then(() => { - return createFragmentStore(manifestId); - }) - .then(() => { - return generateOfflineManifest(_xmlManifest, rep, manifestId); - }) - .then(function () { - initializeAllMediasInfoList(rep); - }); + .then(() => { + return createFragmentStore(manifestId); + }) + .then(() => { + return generateOfflineManifest(_xmlManifest, rep, manifestId); + }) + .then(function () { + initializeAllMediasInfoList(rep); + }); } catch (err) { _status = OfflineConstants.OFFLINE_STATUS_ERROR; errHandler.error({ @@ -490,12 +490,12 @@ function OfflineDownload(config) { return _indexDBManifestParser.parse(XMLManifest).then(function (parsedManifest) { if (parsedManifest !== null && manifestId !== null) { return offlineStoreController.getManifestById(manifestId) - .then((item) => { - item.originalURL = _manifest.url; - item.originalManifest = _manifest; - item.manifest = parsedManifest; - return updateOfflineManifest(item); - }); + .then((item) => { + item.originalURL = _manifest.url; + item.originalManifest = _manifest; + item.manifest = parsedManifest; + return updateOfflineManifest(item); + }); } else { return Promise.reject('falling parsing offline manifest'); } @@ -552,17 +552,17 @@ function OfflineDownload(config) { let selectedRepresentation; offlineStoreController.getManifestById(manifestId) - .then((item) => { - _manifest = item.originalManifest; - selectedRepresentation = item.selected; + .then((item) => { + _manifest = item.originalManifest; + selectedRepresentation = item.selected; - composeStreams(_manifest); - eventBus.trigger(events.STREAMS_COMPOSED); + composeStreams(_manifest); + eventBus.trigger(events.STREAMS_COMPOSED); - return createFragmentStore(manifestId); - }). then(() => { - initializeAllMediasInfoList(selectedRepresentation); - }); + return createFragmentStore(manifestId); + }). then(() => { + initializeAllMediasInfoList(selectedRepresentation); + }); } } diff --git a/src/offline/OfflineStreamProcessor.js b/src/offline/OfflineStreamProcessor.js index 9126766447..7e48ef00e6 100644 --- a/src/offline/OfflineStreamProcessor.js +++ b/src/offline/OfflineStreamProcessor.js @@ -117,15 +117,15 @@ function OfflineStreamProcessor(config) { let suffix = isInit ? 'init' : e.request.index; let fragmentName = e.request.representationId + '_' + suffix; offlineStoreController.storeFragment(manifestId, fragmentName, e.response) - .then(() => { - if (!isInit) { + .then(() => { + if (!isInit) { // store current index and downloadedSegments number - offlineStoreController.setRepresentationCurrentState(manifestId, e.request.representationId, { - index: e.request.index, - downloaded: downloadedSegments - } ); - } - }); + offlineStoreController.setRepresentationCurrentState(manifestId, e.request.representationId, { + index: e.request.index, + downloaded: downloadedSegments + } ); + } + }); } if (e.error && e.request.serviceLocation && !isStopped) { @@ -226,16 +226,16 @@ function OfflineStreamProcessor(config) { isStopped = false; offlineStoreController.getRepresentationCurrentState(manifestId, representationController.getCurrentRepresentation().id) - .then((state) => { - if (state) { - indexHandler.setCurrentIndex(state.index); - downloadedSegments = state.downloaded; - } - download(); - }).catch(() => { + .then((state) => { + if (state) { + indexHandler.setCurrentIndex(state.index); + downloadedSegments = state.downloaded; + } + download(); + }).catch(() => { // start from beginining - download(); - }); + download(); + }); } } diff --git a/src/offline/controllers/OfflineController.js b/src/offline/controllers/OfflineController.js index 05559f622d..1a30015042 100644 --- a/src/offline/controllers/OfflineController.js +++ b/src/offline/controllers/OfflineController.js @@ -260,12 +260,12 @@ function OfflineController() { download.downloadFromUrl(url).then(() => { resolve(id); }) - .catch((e) => { - logger.error('Failed to download ' + e); - removeDownloadFromId(id).then(function () { - reject(e); + .catch((e) => { + logger.error('Failed to download ' + e); + removeDownloadFromId(id).then(function () { + reject(e); + }); }); - }); }); } diff --git a/src/offline/utils/OfflineUrlUtils.js b/src/offline/utils/OfflineUrlUtils.js index 244c22fb16..b368a8d606 100644 --- a/src/offline/utils/OfflineUrlUtils.js +++ b/src/offline/utils/OfflineUrlUtils.js @@ -69,10 +69,10 @@ function OfflineUrlUtils() { setup(); const instance = { - getRegex: getRegex, - isRelative: isRelative, - removeHostname: removeHostname, - resolve: resolve + getRegex: getRegex, + isRelative: isRelative, + removeHostname: removeHostname, + resolve: resolve }; return instance; } diff --git a/src/streaming/ManifestLoader.js b/src/streaming/ManifestLoader.js index 6d0195016a..bf2a07c324 100644 --- a/src/streaming/ManifestLoader.js +++ b/src/streaming/ManifestLoader.js @@ -172,7 +172,7 @@ function ManifestLoader(config) { error: new DashJSError( Errors.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE, Errors.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE + `${url}` - ) + ) } ); return; diff --git a/src/streaming/MediaPlayer.js b/src/streaming/MediaPlayer.js index 1e0cde29b2..ce23e62da7 100644 --- a/src/streaming/MediaPlayer.js +++ b/src/streaming/MediaPlayer.js @@ -60,7 +60,7 @@ import Settings from '../core/Settings'; import { getVersionString } -from './../core/Version'; + from './../core/Version'; //Dash import SegmentBaseController from '../dash/controllers/SegmentBaseController'; diff --git a/src/streaming/MediaPlayerFactory.js b/src/streaming/MediaPlayerFactory.js index 289f7be050..471552aa63 100644 --- a/src/streaming/MediaPlayerFactory.js +++ b/src/streaming/MediaPlayerFactory.js @@ -28,8 +28,8 @@ function MediaPlayerFactory() { let videoID = (video.id || video.name || 'video element'); source = source || [].slice.call(video.querySelectorAll('source')).filter(function (s) { - return s.type == SUPPORTED_MIME_TYPE; - })[0]; + return s.type == SUPPORTED_MIME_TYPE; + })[0]; if (!source && video.src) { source = document.createElement('source'); source.src = video.src; diff --git a/src/streaming/controllers/BaseURLController.js b/src/streaming/controllers/BaseURLController.js index 523655668e..cd4af842f9 100644 --- a/src/streaming/controllers/BaseURLController.js +++ b/src/streaming/controllers/BaseURLController.js @@ -40,15 +40,14 @@ import Events from '../../core/events/Events'; function BaseURLController() { let instance, - adapter; + adapter, + baseURLTreeModel, + baseURLSelector; const context = this.context; const eventBus = EventBus(context).getInstance(); const urlUtils = URLUtils(context).getInstance(); - let baseURLTreeModel, - baseURLSelector; - function onBlackListChanged(e) { baseURLTreeModel.invalidateSelectedIndexes(e.entry); } diff --git a/src/streaming/controllers/TimeSyncController.js b/src/streaming/controllers/TimeSyncController.js index b3f45d76c9..995f6971d3 100644 --- a/src/streaming/controllers/TimeSyncController.js +++ b/src/streaming/controllers/TimeSyncController.js @@ -65,27 +65,27 @@ function TimeSyncController() { // a list of known schemeIdUris and a method to call with @value handlers = { - 'urn:mpeg:dash:utc:http-head:2014': httpHeadHandler, - 'urn:mpeg:dash:utc:http-xsdate:2014': httpHandler.bind(null, xsdatetimeDecoder), - 'urn:mpeg:dash:utc:http-iso:2014': httpHandler.bind(null, iso8601Decoder), - 'urn:mpeg:dash:utc:direct:2014': directHandler, + 'urn:mpeg:dash:utc:http-head:2014': httpHeadHandler, + 'urn:mpeg:dash:utc:http-xsdate:2014': httpHandler.bind(null, xsdatetimeDecoder), + 'urn:mpeg:dash:utc:http-iso:2014': httpHandler.bind(null, iso8601Decoder), + 'urn:mpeg:dash:utc:direct:2014': directHandler, // some specs referencing early ISO23009-1 drafts incorrectly use // 2012 in the URI, rather than 2014. support these for now. - 'urn:mpeg:dash:utc:http-head:2012': httpHeadHandler, - 'urn:mpeg:dash:utc:http-xsdate:2012': httpHandler.bind(null, xsdatetimeDecoder), - 'urn:mpeg:dash:utc:http-iso:2012': httpHandler.bind(null, iso8601Decoder), - 'urn:mpeg:dash:utc:direct:2012': directHandler, + 'urn:mpeg:dash:utc:http-head:2012': httpHeadHandler, + 'urn:mpeg:dash:utc:http-xsdate:2012': httpHandler.bind(null, xsdatetimeDecoder), + 'urn:mpeg:dash:utc:http-iso:2012': httpHandler.bind(null, iso8601Decoder), + 'urn:mpeg:dash:utc:direct:2012': directHandler, // it isn't clear how the data returned would be formatted, and // no public examples available so http-ntp not supported for now. // presumably you would do an arraybuffer type xhr and decode the // binary data returned but I would want to see a sample first. - 'urn:mpeg:dash:utc:http-ntp:2014': notSupportedHandler, + 'urn:mpeg:dash:utc:http-ntp:2014': notSupportedHandler, // not clear how this would be supported in javascript (in browser) - 'urn:mpeg:dash:utc:ntp:2014': notSupportedHandler, - 'urn:mpeg:dash:utc:sntp:2014': notSupportedHandler + 'urn:mpeg:dash:utc:ntp:2014': notSupportedHandler, + 'urn:mpeg:dash:utc:sntp:2014': notSupportedHandler }; if (!getIsSynchronizing()) { @@ -236,8 +236,8 @@ function TimeSyncController() { if (req.status === 200) { time = isHeadRequest ? - req.getResponseHeader('Date') : - req.response; + req.getResponseHeader('Date') : + req.response; result = decoder(time); diff --git a/src/streaming/controllers/XlinkController.js b/src/streaming/controllers/XlinkController.js index 5f9610127a..7de613b697 100644 --- a/src/streaming/controllers/XlinkController.js +++ b/src/streaming/controllers/XlinkController.js @@ -86,14 +86,14 @@ function XlinkController(config) { let elements; // First resolve all periods, so unnecessary requests inside onLoad Periods with Default content are avoided converter = new X2JS({ - escapeMode: false, - attributePrefix: '', - arrayAccessForm: 'property', - emptyNodeForm: 'object', - stripWhitespaces: false, + escapeMode: false, + attributePrefix: '', + arrayAccessForm: 'property', + emptyNodeForm: 'object', + stripWhitespaces: false, enableToStringFunc: false, - ignoreRoot: true, - matchers: matchers + ignoreRoot: true, + matchers: matchers }); manifest = mpd; diff --git a/src/streaming/metrics/MetricsReporting.js b/src/streaming/metrics/MetricsReporting.js index b4bb25591c..5f02ce2f46 100644 --- a/src/streaming/metrics/MetricsReporting.js +++ b/src/streaming/metrics/MetricsReporting.js @@ -74,9 +74,9 @@ function MetricsReporting() { } instance = { - createMetricsReporting: createMetricsReporting, - getReportingFactory: getReportingFactory, - getMetricsHandlerFactory: getMetricsHandlerFactory + createMetricsReporting: createMetricsReporting, + getReportingFactory: getReportingFactory, + getMetricsHandlerFactory: getMetricsHandlerFactory }; return instance; diff --git a/src/streaming/metrics/controllers/MetricsController.js b/src/streaming/metrics/controllers/MetricsController.js index 0bc84e255d..f54473696e 100644 --- a/src/streaming/metrics/controllers/MetricsController.js +++ b/src/streaming/metrics/controllers/MetricsController.js @@ -88,7 +88,7 @@ function MetricsController(config) { instance = { initialize: initialize, - reset: reset + reset: reset }; return instance; diff --git a/src/streaming/metrics/controllers/MetricsHandlersController.js b/src/streaming/metrics/controllers/MetricsHandlersController.js index ae4fdbc14a..74c93ec9ad 100644 --- a/src/streaming/metrics/controllers/MetricsHandlersController.js +++ b/src/streaming/metrics/controllers/MetricsHandlersController.js @@ -118,7 +118,7 @@ function MetricsHandlersController(config) { instance = { initialize: initialize, - reset: reset + reset: reset }; return instance; diff --git a/src/streaming/metrics/controllers/RangeController.js b/src/streaming/metrics/controllers/RangeController.js index a3ebbfc1d6..3370aada6a 100644 --- a/src/streaming/metrics/controllers/RangeController.js +++ b/src/streaming/metrics/controllers/RangeController.js @@ -73,8 +73,8 @@ function RangeController(config) { // When not present, DASH Metrics reporting is requested // for the whole duration of the content. time = useWallClockTime ? - (new Date().getTime() / 1000) : - mediaElement.currentTime; + (new Date().getTime() / 1000) : + mediaElement.currentTime; for (let i = 0; i < numRanges; i += 1) { let start = ranges.start(i); @@ -90,8 +90,8 @@ function RangeController(config) { instance = { initialize: initialize, - reset: reset, - isEnabled: isEnabled + reset: reset, + isEnabled: isEnabled }; setup(); diff --git a/src/streaming/metrics/controllers/ReportingController.js b/src/streaming/metrics/controllers/ReportingController.js index 4d409843c6..ac64bc8e31 100644 --- a/src/streaming/metrics/controllers/ReportingController.js +++ b/src/streaming/metrics/controllers/ReportingController.js @@ -64,8 +64,8 @@ function ReportingController(config) { instance = { initialize: initialize, - reset: reset, - report: report + reset: reset, + report: report }; return instance; diff --git a/src/streaming/metrics/metrics/MetricsHandlerFactory.js b/src/streaming/metrics/metrics/MetricsHandlerFactory.js index 85a423cf04..68a0ae9b7f 100644 --- a/src/streaming/metrics/metrics/MetricsHandlerFactory.js +++ b/src/streaming/metrics/metrics/MetricsHandlerFactory.js @@ -45,12 +45,12 @@ function MetricsHandlerFactory(config) { const context = this.context; let knownFactoryProducts = { - BufferLevel: BufferLevel, - DVBErrors: DVBErrors, - HttpList: HttpList, - PlayList: GenericMetricHandler, - RepSwitchList: GenericMetricHandler, - TcpList: GenericMetricHandler + BufferLevel: BufferLevel, + DVBErrors: DVBErrors, + HttpList: HttpList, + PlayList: GenericMetricHandler, + RepSwitchList: GenericMetricHandler, + TcpList: GenericMetricHandler }; function create(listType, reportingController) { @@ -90,8 +90,8 @@ function MetricsHandlerFactory(config) { } instance = { - create: create, - register: register, + create: create, + register: register, unregister: unregister }; diff --git a/src/streaming/metrics/metrics/handlers/BufferLevelHandler.js b/src/streaming/metrics/metrics/handlers/BufferLevelHandler.js index df06c6db15..0071c5ac3f 100644 --- a/src/streaming/metrics/metrics/handlers/BufferLevelHandler.js +++ b/src/streaming/metrics/metrics/handlers/BufferLevelHandler.js @@ -99,9 +99,9 @@ function BufferLevelHandler(config) { } instance = { - initialize: initialize, - reset: reset, - handleNewMetric: handleNewMetric + initialize: initialize, + reset: reset, + handleNewMetric: handleNewMetric }; return instance; diff --git a/src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js b/src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js index aebb11e043..3f276f525c 100644 --- a/src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js +++ b/src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js @@ -81,9 +81,9 @@ function DVBErrorsHandler(config) { } instance = { - initialize: initialize, - reset: reset, - handleNewMetric: handleNewMetric + initialize: initialize, + reset: reset, + handleNewMetric: handleNewMetric }; return instance; diff --git a/src/streaming/metrics/metrics/handlers/HttpListHandler.js b/src/streaming/metrics/metrics/handlers/HttpListHandler.js index e1f832e765..b3d65d13d9 100644 --- a/src/streaming/metrics/metrics/handlers/HttpListHandler.js +++ b/src/streaming/metrics/metrics/handlers/HttpListHandler.js @@ -100,9 +100,9 @@ function HttpListHandler(config) { } instance = { - initialize: initialize, - reset: reset, - handleNewMetric: handleNewMetric + initialize: initialize, + reset: reset, + handleNewMetric: handleNewMetric }; return instance; diff --git a/src/streaming/metrics/reporting/ReportingFactory.js b/src/streaming/metrics/reporting/ReportingFactory.js index 8fe9948deb..135b62751e 100644 --- a/src/streaming/metrics/reporting/ReportingFactory.js +++ b/src/streaming/metrics/reporting/ReportingFactory.js @@ -69,8 +69,8 @@ function ReportingFactory(config) { } instance = { - create: create, - register: register, + create: create, + register: register, unregister: unregister }; diff --git a/src/streaming/metrics/reporting/reporters/DVBReporting.js b/src/streaming/metrics/reporting/reporters/DVBReporting.js index 33841c48bd..f1b8645017 100644 --- a/src/streaming/metrics/reporting/reporters/DVBReporting.js +++ b/src/streaming/metrics/reporting/reporters/DVBReporting.js @@ -34,16 +34,15 @@ import RNG from '../../utils/RNG'; function DVBReporting(config) { config = config || {}; - let instance; - - let context = this.context; - let metricSerialiser, + let instance, + metricSerialiser, randomNumberGenerator, reportingPlayerStatusDecided, isReportingPlayer, reportingUrl, rangeController; + let context = this.context; let USE_DRAFT_DVB_SPEC = true; let allowPendingRequestsToCompleteOnReset = true; let pendingRequests = []; @@ -183,9 +182,9 @@ function DVBReporting(config) { } instance = { - report: report, + report: report, initialize: initialize, - reset: reset + reset: reset }; setup(); diff --git a/src/streaming/models/MediaPlayerModel.js b/src/streaming/models/MediaPlayerModel.js index 37c51335cc..53d6cc5d41 100644 --- a/src/streaming/models/MediaPlayerModel.js +++ b/src/streaming/models/MediaPlayerModel.js @@ -53,9 +53,9 @@ function MediaPlayerModel() { customABRRule; const DEFAULT_UTC_TIMING_SOURCE = { - scheme: 'urn:mpeg:dash:utc:http-xsdate:2014', - value: 'http://time.akamai.com/?iso&ms' - }; + scheme: 'urn:mpeg:dash:utc:http-xsdate:2014', + value: 'http://time.akamai.com/?iso&ms' + }; const context = this.context; const settings = Settings(context).getInstance(); diff --git a/src/streaming/net/HTTPLoader.js b/src/streaming/net/HTTPLoader.js index 264b5549ed..2f94ab2951 100644 --- a/src/streaming/net/HTTPLoader.js +++ b/src/streaming/net/HTTPLoader.js @@ -87,7 +87,8 @@ function HTTPLoader(cfg) { let requestStartTime = new Date(); let lastTraceTime = requestStartTime; let lastTraceReceivedCount = 0; - let httpRequest; + let httpRequest, + loader; if (!requestModifier || !dashMetrics || !errHandler) { throw new Error('config object is not correct or missing'); @@ -204,7 +205,6 @@ function HTTPLoader(cfg) { } }; - let loader; if (useFetch && window.fetch && request.responseType === 'arraybuffer' && request.type === HTTPRequest.MEDIA_SEGMENT_TYPE) { loader = FetchLoader(context).create({ requestModifier: requestModifier, diff --git a/src/streaming/net/SchemeLoaderFactory.js b/src/streaming/net/SchemeLoaderFactory.js index 00205bfa54..32fb5cb6ec 100644 --- a/src/streaming/net/SchemeLoaderFactory.js +++ b/src/streaming/net/SchemeLoaderFactory.js @@ -38,9 +38,9 @@ import HTTPLoader from '../../streaming/net/HTTPLoader'; */ function SchemeLoaderFactory() { - let instance; + let instance, - let schemeLoaderMap; + schemeLoaderMap; function registerLoader(scheme, loader) { schemeLoaderMap[scheme] = loader; diff --git a/src/streaming/protection/CommonEncryption.js b/src/streaming/protection/CommonEncryption.js index 0bf295e266..0887cf898f 100644 --- a/src/streaming/protection/CommonEncryption.js +++ b/src/streaming/protection/CommonEncryption.js @@ -135,7 +135,9 @@ class CommonEncryption { nextBox, version, systemID, - psshDataSize; + psshDataSize, + i, + val; let boxStart = byteCursor; if (byteCursor >= dv.buffer.byteLength) @@ -165,7 +167,6 @@ class CommonEncryption { // 16-byte UUID/SystemID systemID = ''; - let i, val; for (i = 0; i < 4; i++) { val = dv.getUint8(byteCursor + i).toString(16); systemID += (val.length === 1) ? '0' + val : val; diff --git a/src/streaming/protection/models/ProtectionModel_21Jan2015.js b/src/streaming/protection/models/ProtectionModel_21Jan2015.js index 50779ea58c..595322cf3b 100644 --- a/src/streaming/protection/models/ProtectionModel_21Jan2015.js +++ b/src/streaming/protection/models/ProtectionModel_21Jan2015.js @@ -300,7 +300,7 @@ function ProtectionModel_21Jan2015(config) { navigator.requestMediaKeySystemAccess(systemString, configs).then(function (mediaKeySystemAccess) { // Chrome 40 does not currently implement MediaKeySystemAccess.getConfiguration() const configuration = (typeof mediaKeySystemAccess.getConfiguration === 'function') ? - mediaKeySystemAccess.getConfiguration() : null; + mediaKeySystemAccess.getConfiguration() : null; const keySystemAccess = new KeySystemAccess(keySystem, configuration); keySystemAccess.mksa = mediaKeySystemAccess; eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {data: keySystemAccess}); diff --git a/src/streaming/rules/ThroughputHistory.js b/src/streaming/rules/ThroughputHistory.js index d9c0a8f04c..d6337a0274 100644 --- a/src/streaming/rules/ThroughputHistory.js +++ b/src/streaming/rules/ThroughputHistory.js @@ -63,7 +63,7 @@ function ThroughputHistory(config) { function setup() { ewmaHalfLife = { throughputHalfLife: { fast: EWMA_THROUGHPUT_FAST_HALF_LIFE_SECONDS, slow: EWMA_THROUGHPUT_SLOW_HALF_LIFE_SECONDS }, - latencyHalfLife: { fast: EWMA_LATENCY_FAST_HALF_LIFE_COUNT, slow: EWMA_LATENCY_SLOW_HALF_LIFE_COUNT } + latencyHalfLife: { fast: EWMA_LATENCY_FAST_HALF_LIFE_COUNT, slow: EWMA_LATENCY_SLOW_HALF_LIFE_COUNT } }; reset(); diff --git a/src/streaming/rules/scheduling/NextFragmentRequestRule.js b/src/streaming/rules/scheduling/NextFragmentRequestRule.js index 8703a9c474..d768dae921 100644 --- a/src/streaming/rules/scheduling/NextFragmentRequestRule.js +++ b/src/streaming/rules/scheduling/NextFragmentRequestRule.js @@ -91,8 +91,8 @@ function NextFragmentRequestRule(config) { // Use time just whenever is strictly needed request = streamProcessor.getFragmentRequest(representationInfo, hasSeekTarget || bufferIsDivided ? time : undefined, { - keepIdx: !hasSeekTarget && !bufferIsDivided - }); + keepIdx: !hasSeekTarget && !bufferIsDivided + }); // Then, check if this request was downloaded or not while (request && request.action !== FragmentRequest.ACTION_COMPLETE && streamProcessor.getFragmentModel().isFragmentLoaded(request)) { diff --git a/src/streaming/thumbnail/ThumbnailTracks.js b/src/streaming/thumbnail/ThumbnailTracks.js index b959855511..03010218b6 100644 --- a/src/streaming/thumbnail/ThumbnailTracks.js +++ b/src/streaming/thumbnail/ThumbnailTracks.js @@ -40,7 +40,7 @@ import XHRLoader from '../../streaming/net/XHRLoader'; import DashHandler from '../../dash/DashHandler'; export const THUMBNAILS_SCHEME_ID_URIS = ['http://dashif.org/thumbnail_tile', - 'http://dashif.org/guidelines/thumbnail_tile']; + 'http://dashif.org/guidelines/thumbnail_tile']; function ThumbnailTracks(config) { const context = this.context; diff --git a/src/streaming/utils/BaseURLSelector.js b/src/streaming/utils/BaseURLSelector.js index e5c984260f..c3fb201934 100644 --- a/src/streaming/utils/BaseURLSelector.js +++ b/src/streaming/utils/BaseURLSelector.js @@ -52,8 +52,8 @@ function BaseURLSelector() { function setup() { serviceLocationBlacklistController = BlacklistController(context).create({ - updateEventName: Events.SERVICE_LOCATION_BLACKLIST_CHANGED, - addBlacklistEventName: Events.SERVICE_LOCATION_BLACKLIST_ADD + updateEventName: Events.SERVICE_LOCATION_BLACKLIST_CHANGED, + addBlacklistEventName: Events.SERVICE_LOCATION_BLACKLIST_ADD }); basicSelector = BasicSelector(context).create({ diff --git a/src/streaming/utils/DefaultURLUtils.js b/src/streaming/utils/DefaultURLUtils.js index 1de4be6f65..d32359f23a 100644 --- a/src/streaming/utils/DefaultURLUtils.js +++ b/src/streaming/utils/DefaultURLUtils.js @@ -102,7 +102,7 @@ function DefaultURLUtils() { const joinChar = base.charAt(base.length - 1) !== '/' && url.charAt(0) !== '/' ? - '/' : ''; + '/' : ''; return [base, url].join(joinChar); }; @@ -264,16 +264,16 @@ function DefaultURLUtils() { setup(); const instance = { - parseBaseUrl: parseBaseUrl, - parseOrigin: parseOrigin, - parseScheme: parseScheme, - isRelative: isRelative, - isPathAbsolute: isPathAbsolute, - isSchemeRelative: isSchemeRelative, - isHTTPURL: isHTTPURL, - isHTTPS: isHTTPS, - removeHostname: removeHostname, - resolve: resolve + parseBaseUrl: parseBaseUrl, + parseOrigin: parseOrigin, + parseScheme: parseScheme, + isRelative: isRelative, + isPathAbsolute: isPathAbsolute, + isSchemeRelative: isSchemeRelative, + isHTTPURL: isHTTPURL, + isHTTPS: isHTTPS, + removeHostname: removeHostname, + resolve: resolve }; return instance; diff --git a/src/streaming/utils/URLUtils.js b/src/streaming/utils/URLUtils.js index 4fc46c8bb7..b045354fab 100644 --- a/src/streaming/utils/URLUtils.js +++ b/src/streaming/utils/URLUtils.js @@ -42,8 +42,8 @@ import DefaultURLUtils from './DefaultURLUtils'; */ function URLUtils() { - let instance; - let defaultURLUtils; + let instance, + defaultURLUtils; let regexUtils = []; const context = this.context; @@ -194,17 +194,17 @@ function URLUtils() { setup(); instance = { - registerUrlRegex: registerUrlRegex, - parseBaseUrl: parseBaseUrl, - parseOrigin: parseOrigin, - parseScheme: parseScheme, - isRelative: isRelative, - isPathAbsolute: isPathAbsolute, - isSchemeRelative: isSchemeRelative, - isHTTPURL: isHTTPURL, - isHTTPS: isHTTPS, - removeHostname: removeHostname, - resolve: resolve + registerUrlRegex: registerUrlRegex, + parseBaseUrl: parseBaseUrl, + parseOrigin: parseOrigin, + parseScheme: parseScheme, + isRelative: isRelative, + isPathAbsolute: isPathAbsolute, + isSchemeRelative: isSchemeRelative, + isHTTPURL: isHTTPURL, + isHTTPS: isHTTPS, + removeHostname: removeHostname, + resolve: resolve }; return instance; diff --git a/test/unit/Streaming.StreamProcessor.js b/test/unit/Streaming.StreamProcessor.js index 995bd448cd..f805a57009 100644 --- a/test/unit/Streaming.StreamProcessor.js +++ b/test/unit/Streaming.StreamProcessor.js @@ -91,7 +91,7 @@ describe('StreamProcessor', function () { let dvrInfo = dashMetricsMock.getCurrentDVRInfo(); expect(dvrInfo).to.be.null; // jshint ignore:line - eventBus.trigger(Events.BUFFER_LEVEL_UPDATED, { sender: { getStreamProcessor() { return streamProcessor;}}, bufferLevel: 50 }); + eventBus.trigger(Events.BUFFER_LEVEL_UPDATED, { sender: { getStreamProcessor() { return streamProcessor; } }, bufferLevel: 50 }); dvrInfo = dashMetricsMock.getCurrentDVRInfo(); expect(dvrInfo).not.to.be.null; // jshint ignore:line diff --git a/test/unit/dash.DashParser.js b/test/unit/dash.DashParser.js index e40b3ff8f1..498fb1a67d 100644 --- a/test/unit/dash.DashParser.js +++ b/test/unit/dash.DashParser.js @@ -18,7 +18,7 @@ describe('DashParser', function () { return Date.now(); } }, - DOMParser: new jsdom().window.DOMParser + DOMParser: new jsdom().window.DOMParser }; } }); diff --git a/test/unit/dash.models.DashManifestModel.js b/test/unit/dash.models.DashManifestModel.js index 1ab6d4b90d..1d1cdd33e6 100644 --- a/test/unit/dash.models.DashManifestModel.js +++ b/test/unit/dash.models.DashManifestModel.js @@ -511,28 +511,28 @@ describe('DashManifestModel', function () { it('should not return an empty Array when getEventStreamForRepresentation is called and manifest and representation are well defined', () => { const manifest = { - Period: [ - { - 'id': '153199', - AdaptationSet: [{Representation: [{InbandEventStream: []}]}] - }, - { - 'id': '153202', - AdaptationSet: [{Representation: [{InbandEventStream: []}]}] - } - ], - Period_asArray: [ - { - 'id': '153199', - AdaptationSet_asArray: [{Representation_asArray: [{InbandEventStream_asArray: []}]}] - }, - { - 'id': '153202', - AdaptationSet_asArray: [{Representation_asArray: [{InbandEventStream_asArray: []}]}] - } - ], - 'type': 'static' - }; + Period: [ + { + 'id': '153199', + AdaptationSet: [{Representation: [{InbandEventStream: []}]}] + }, + { + 'id': '153202', + AdaptationSet: [{Representation: [{InbandEventStream: []}]}] + } + ], + Period_asArray: [ + { + 'id': '153199', + AdaptationSet_asArray: [{Representation_asArray: [{InbandEventStream_asArray: []}]}] + }, + { + 'id': '153202', + AdaptationSet_asArray: [{Representation_asArray: [{InbandEventStream_asArray: []}]}] + } + ], + 'type': 'static' + }; const representation = {adaptation: {index: 0, period: {index: 0}}, index: 0}; const eventsStream = dashManifestModel.getEventStreamForRepresentation(manifest, representation); diff --git a/test/unit/mocks/AdapterMock.js b/test/unit/mocks/AdapterMock.js index 647e061b19..1dc2ba288b 100644 --- a/test/unit/mocks/AdapterMock.js +++ b/test/unit/mocks/AdapterMock.js @@ -21,7 +21,7 @@ function AdapterMock () { this.getAllMediaInfoForType = function () { return [{codec: 'audio/mp4;codecs="mp4a.40.2"', id: undefined, index: 0, isText: false, lang: 'eng',mimeType: 'audio/mp4', roles: ['main']}, - {codec: 'audio/mp4;codecs="mp4a.40.2"', id: undefined, index: 1, isText: false, lang: 'deu',mimeType: 'audio/mp4', roles: ['main']}]; + {codec: 'audio/mp4;codecs="mp4a.40.2"', id: undefined, index: 1, isText: false, lang: 'deu',mimeType: 'audio/mp4', roles: ['main']}]; }; this.getDataForMedia = function () { diff --git a/test/unit/mocks/MediaPlayerModelMock.js b/test/unit/mocks/MediaPlayerModelMock.js index b1d69da9c7..38dd040d98 100644 --- a/test/unit/mocks/MediaPlayerModelMock.js +++ b/test/unit/mocks/MediaPlayerModelMock.js @@ -31,7 +31,7 @@ import { HTTPRequest } -from '../../../src/streaming/vo/metrics/HTTPRequest'; + from '../../../src/streaming/vo/metrics/HTTPRequest'; const DEFAULT_UTC_TIMING_SOURCE = { scheme: 'urn:mpeg:dash:utc:http-xsdate:2014', diff --git a/test/unit/mocks/RulesContextMock.js b/test/unit/mocks/RulesContextMock.js index 3cb1d15a59..13c729a9ae 100644 --- a/test/unit/mocks/RulesContextMock.js +++ b/test/unit/mocks/RulesContextMock.js @@ -3,8 +3,8 @@ import FragmentRequest from '../../../src/streaming/vo/FragmentRequest'; function switchRequestHistoryMock() { this.getSwitchRequests = function () { return [{drops: 7, - noDrops: 0, - dropSize: 4}]; + noDrops: 0, + dropSize: 4}]; }; } diff --git a/test/unit/mss.parser.MssParser.js b/test/unit/mss.parser.MssParser.js index ee86ef533b..146d63e974 100644 --- a/test/unit/mss.parser.MssParser.js +++ b/test/unit/mss.parser.MssParser.js @@ -22,7 +22,7 @@ describe('MssParser', function () { return Date.now(); } }, - DOMParser: new jsdom().window.DOMParser + DOMParser: new jsdom().window.DOMParser }; } }); diff --git a/test/unit/streaming.ManifestUpdater.js b/test/unit/streaming.ManifestUpdater.js index dc0eb29fff..1af2b1403a 100644 --- a/test/unit/streaming.ManifestUpdater.js +++ b/test/unit/streaming.ManifestUpdater.js @@ -20,7 +20,7 @@ describe('ManifestUpdater', function () { const manifestLoaderMock = new ManifestLoaderMock(); const errHandlerMock = new ErrorHandlerMock(); - const manifestErrorMockText = `Mock Failed detecting manifest type or manifest type unsupported`; + const manifestErrorMockText = 'Mock Failed detecting manifest type or manifest type unsupported'; manifestUpdater.setConfig({ manifestModel: manifestModelMock, diff --git a/test/unit/streaming.controllers.BufferController.js b/test/unit/streaming.controllers.BufferController.js index 3f4b64893b..420a79f25c 100644 --- a/test/unit/streaming.controllers.BufferController.js +++ b/test/unit/streaming.controllers.BufferController.js @@ -42,8 +42,8 @@ describe('BufferController', function () { const mediaControllerMock = new MediaControllerMock(); const abrControllerMock = new AbrControllerMock(); const textControllerMock = new TextControllerMock(); - let bufferController; - let mediaSourceMock; + let bufferController, + mediaSourceMock; const mediaInfo = { codec: 'video/webm; codecs="vp8, vorbis"' }; beforeEach(function () { diff --git a/test/unit/streaming.controllers.MediaController.js b/test/unit/streaming.controllers.MediaController.js index c8e220c795..c76eaa25d9 100644 --- a/test/unit/streaming.controllers.MediaController.js +++ b/test/unit/streaming.controllers.MediaController.js @@ -12,8 +12,8 @@ const eventBus = EventBus(context).getInstance(); const objectUtils = ObjectUtils(context).getInstance(); describe('MediaController', function () { - let mediaController; - let domStorageMock; + let mediaController, + domStorageMock; const trackType = Constants.AUDIO; beforeEach(function () { diff --git a/test/unit/streaming.controllers.ScheduleController.js b/test/unit/streaming.controllers.ScheduleController.js index 0b3c5cd420..7ffd234a2e 100644 --- a/test/unit/streaming.controllers.ScheduleController.js +++ b/test/unit/streaming.controllers.ScheduleController.js @@ -23,15 +23,15 @@ const testType = 'video'; describe('ScheduleController', function () { - let scheduleController; - let mediaPlayerModelMock; - let streamProcessorMock; - let adapterMock; - let playbackControllerMock; - let abrControllerMock; - let streamControllerMock; - let dashMetricsMock; - let metricsModelMock; + let scheduleController, + mediaPlayerModelMock, + streamProcessorMock, + adapterMock, + playbackControllerMock, + abrControllerMock, + streamControllerMock, + dashMetricsMock, + metricsModelMock; const settings = Settings(context).getInstance(); beforeEach(function () { diff --git a/test/unit/streaming.controllers.SourceBufferSink.js b/test/unit/streaming.controllers.SourceBufferSink.js index 27bd210982..dc63f90091 100644 --- a/test/unit/streaming.controllers.SourceBufferSink.js +++ b/test/unit/streaming.controllers.SourceBufferSink.js @@ -16,8 +16,8 @@ const eventBus = EventBus(context).getInstance(); describe('SourceBufferSink', function () { - let sink; - let textControllerMock; + let sink, + textControllerMock; beforeEach(function () { textControllerMock = new TextControllerMock(); @@ -108,8 +108,8 @@ describe('SourceBufferSink', function () { }); describe('Method getAllBufferRanges', function () { - let sink; - let buffer; + let sink, + buffer; beforeEach(function () { let mediaInfo = { codec: 'video/webm; codecs="vp8, vorbis"' diff --git a/test/unit/streaming.controllers.StreamController.js b/test/unit/streaming.controllers.StreamController.js index bb1f9ce36b..06d2dac0e8 100644 --- a/test/unit/streaming.controllers.StreamController.js +++ b/test/unit/streaming.controllers.StreamController.js @@ -126,16 +126,16 @@ describe('StreamController', function () { beforeEach(function () { streamController.setConfig({adapter: adapterMock, - manifestLoader: manifestLoaderMock, - timelineConverter: timelineConverterMock, - manifestModel: manifestModelMock, - errHandler: errHandlerMock, - dashMetrics: dashMetricsMock, - protectionController: protectionControllerMock, - videoModel: videoModelMock, - playbackController: playbackControllerMock, - baseURLController: baseUrlControllerMock, - settings: settings}); + manifestLoader: manifestLoaderMock, + timelineConverter: timelineConverterMock, + manifestModel: manifestModelMock, + errHandler: errHandlerMock, + dashMetrics: dashMetricsMock, + protectionController: protectionControllerMock, + videoModel: videoModelMock, + playbackController: playbackControllerMock, + baseURLController: baseUrlControllerMock, + settings: settings}); streamController.initialize(false); }); diff --git a/test/unit/streaming.net.HTTPLoader.js b/test/unit/streaming.net.HTTPLoader.js index a2684d35a3..0f71738166 100644 --- a/test/unit/streaming.net.HTTPLoader.js +++ b/test/unit/streaming.net.HTTPLoader.js @@ -15,11 +15,11 @@ const Stream = require('stream'); const context = {}; -let errHandler; -let dashMetrics; -let requestModifier; -let mediaPlayerModelMock; -let httpLoader; +let errHandler, + dashMetrics, + requestModifier, + mediaPlayerModelMock, + httpLoader; describe('HTTPLoader', function () { diff --git a/test/unit/streaming.net.XHRLoader.js b/test/unit/streaming.net.XHRLoader.js index 2bb26f3902..b080df9423 100644 --- a/test/unit/streaming.net.XHRLoader.js +++ b/test/unit/streaming.net.XHRLoader.js @@ -6,8 +6,8 @@ const sinon = require('sinon'); const context = {}; -let requestModifier; -let xhrLoader; +let requestModifier, + xhrLoader; describe('XHRLoader', function () { diff --git a/test/unit/streaming.protection.drm.KeySystemW3CClearKey.js b/test/unit/streaming.protection.drm.KeySystemW3CClearKey.js index 29d2233a8f..54b634383c 100644 --- a/test/unit/streaming.protection.drm.KeySystemW3CClearKey.js +++ b/test/unit/streaming.protection.drm.KeySystemW3CClearKey.js @@ -8,9 +8,9 @@ const expect = chai.expect; describe('KeySystemW3CClearKey', function () { - let context; - let config; - let keySystem; + let context, + config, + keySystem; let message = new Uint8Array([123,34,107,105,100,115,34,58,91,34,97,75,69,114,88,72,78,71,98,51,103,97,68,98,89,98,95,114,111,99,112,119,34,93,44,34,116,121,112,101,34,58,34,116,101,109,112,111,114,97,114,121,34,125]); let debug = new DebugMock(); const protData = { diff --git a/test/unit/streaming.text.NotFragmentedTextBufferController.js b/test/unit/streaming.text.NotFragmentedTextBufferController.js index 244ee688b5..b5f924edaf 100644 --- a/test/unit/streaming.text.NotFragmentedTextBufferController.js +++ b/test/unit/streaming.text.NotFragmentedTextBufferController.js @@ -24,8 +24,8 @@ describe('NotFragmentedTextBufferController', function () { let streamProcessorMock = new StreamProcessorMock(testType, streamInfo); let errorHandlerMock = new ErrorHandlerMock(); - let mediaSourceMock; - let notFragmentedTextBufferController; + let mediaSourceMock, + notFragmentedTextBufferController; let mockMediaInfo = { isText: false, codec: '' }; beforeEach(function () { diff --git a/test/unit/streaming.text.TextController.js b/test/unit/streaming.text.TextController.js index c2cc2a7101..4c3699ed75 100644 --- a/test/unit/streaming.text.TextController.js +++ b/test/unit/streaming.text.TextController.js @@ -19,8 +19,8 @@ describe('TextController', function () { let videoModelMock = new VideoModelMock(); let streamControllerMock = new StreamControllerMock(); - let textTracks; - let textController; + let textTracks, + textController; beforeEach(function () { if (typeof document === 'undefined') { @@ -199,8 +199,8 @@ describe('TextController', function () { }); describe('Handle event TEXT_TRACKS_QUEUE_INITIALIZED', function () { - var textTracksQueue; - var initialIndex; + var textTracksQueue, + initialIndex; beforeEach(function () { textTracksQueue = []; diff --git a/test/unit/streaming.text.TextSourceBuffer.js b/test/unit/streaming.text.TextSourceBuffer.js index db00b5122b..ddc5da67fb 100644 --- a/test/unit/streaming.text.TextSourceBuffer.js +++ b/test/unit/streaming.text.TextSourceBuffer.js @@ -19,9 +19,9 @@ describe('TextSourceBuffer', function () { let textSourceBuffer = TextSourceBuffer(context).getInstance(); textSourceBuffer.setConfig({streamController: streamControllerMock, - adapter: adapterMock, - errHandler: errorHandlerMock, - ttmlParser: ttmlParser}); + adapter: adapterMock, + errHandler: errorHandlerMock, + ttmlParser: ttmlParser}); it('call to addEmbeddedTrack function with no mediaInfo parameter should not throw an error', function () { expect(textSourceBuffer.addEmbeddedTrack.bind(textSourceBuffer)).to.not.throw(); diff --git a/test/unit/streaming.thumbnail.ThumbnailController.js b/test/unit/streaming.thumbnail.ThumbnailController.js index 9ccbc5d9e7..f26da2fe49 100644 --- a/test/unit/streaming.thumbnail.ThumbnailController.js +++ b/test/unit/streaming.thumbnail.ThumbnailController.js @@ -254,10 +254,12 @@ describe('Thumbnails', function () { }); it('addTracks method doesn\'t add any track if config not set properly', function () { - thumbnailTracks = ThumbnailTracks(context).create({debug: Debug(context).getInstance(), - eventBus: EventBus(context).getInstance(), - events: Events, - dashConstants: DashConstants}); + thumbnailTracks = ThumbnailTracks(context).create({ + debug: Debug(context).getInstance(), + eventBus: EventBus(context).getInstance(), + events: Events, + dashConstants: DashConstants + }); thumbnailTracks.initialize(); const tracks = thumbnailTracks.getTracks(); expect(tracks).to.be.empty; // jshint ignore:line