Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mlasak committed May 13, 2020
1 parent 7049c4a commit 5cc45bc
Show file tree
Hide file tree
Showing 58 changed files with 294 additions and 292 deletions.
2 changes: 1 addition & 1 deletion src/dash/controllers/RepresentationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]});
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/dash/parser/DashParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
56 changes: 28 additions & 28 deletions src/dash/parser/matchers/StringMatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
12 changes: 6 additions & 6 deletions src/dash/utils/SegmentsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/mss/MssFragmentProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
74 changes: 37 additions & 37 deletions src/offline/OfflineDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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';
}
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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);
});
}
}

Expand Down
34 changes: 17 additions & 17 deletions src/offline/OfflineStreamProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
});
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/offline/controllers/OfflineController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/offline/utils/OfflineUrlUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/ManifestLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Settings from '../core/Settings';
import {
getVersionString
}
from './../core/Version';
from './../core/Version';

//Dash
import SegmentBaseController from '../dash/controllers/SegmentBaseController';
Expand Down
4 changes: 2 additions & 2 deletions src/streaming/MediaPlayerFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions src/streaming/controllers/BaseURLController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 5cc45bc

Please sign in to comment.