Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/typescript typings #3913

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,961 changes: 3,923 additions & 1,038 deletions index.d.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions src/dash/DashAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ function DashAdapter() {
* @param {MediaInfo} mInfoOne
* @param {MediaInfo} mInfoTwo
* @returns {boolean}
* @memberof module:DashAdapter
* @instance
*/
function areMediaInfosEqual(mInfoOne, mInfoTwo) {
if (!mInfoOne || !mInfoTwo) {
Expand Down Expand Up @@ -424,6 +426,8 @@ function DashAdapter() {
* Returns the period as defined in the DashManifestModel for a given index
* @param {number} index
* @return {object}
* @memberOf module:DashAdapter
* @instance
*/
function getRealPeriodByIndex(index) {
return dashManifestModel.getRealPeriodForIndex(index, voPeriods[0].mpd.manifest);
Expand Down Expand Up @@ -586,7 +590,7 @@ function DashAdapter() {
/**
* Returns the availabilityStartTime as specified in the manifest
* @param {object} externalManifest Omit this value if no external manifest should be used
* @returns {string} availabilityStartTime
* @returns {number} availabilityStartTime
* @memberOf module:DashAdapter
* @instance
*/
Expand Down Expand Up @@ -735,6 +739,8 @@ function DashAdapter() {
* Checks if the manifest is actually just a patch manifest
* @param {object} manifest
* @return {boolean}
* @memberOf module:DashAdapter
* @instance
*/
function getIsPatch(manifest) {
return patchManifestModel.getIsPatch(manifest);
Expand All @@ -743,7 +749,7 @@ function DashAdapter() {
/**
* Returns the base urls for a given element
* @param {object} node
* @returns {Array}
* @returns {BaseURL[]}
* @memberOf module:DashAdapter
* @instance
* @ignore
Expand All @@ -754,7 +760,7 @@ function DashAdapter() {

/**
* Returns the function to sort the Representations
* @returns {*}
* @returns {function}
* @memberOf module:DashAdapter
* @instance
* @ignore
Expand Down Expand Up @@ -812,7 +818,7 @@ function DashAdapter() {
* @param {string} bufferType - String 'audio' or 'video',
* @param {number} periodIdx - Make sure this is the period index not id
* @return {number}
* @memberof module:DashAdapter
* @memberOf module:DashAdapter
* @instance
*/
function getMaxIndexForBufferType(bufferType, periodIdx) {
Expand All @@ -825,6 +831,8 @@ function DashAdapter() {
* Returns the voPeriod object for a given id
* @param {String} id
* @returns {object|null}
* @memberOf module:DashAdapter
* @instance
*/
function getPeriodById(id) {
if (!id || voPeriods.length === 0) {
Expand All @@ -846,6 +854,8 @@ function DashAdapter() {
* @param {object} adaptation
* @param {string} type
* @return {boolean}
* @memberOf module:DashAdapter
* @instance
*/
function getIsTypeOf(adaptation, type) {
return dashManifestModel.getIsTypeOf(adaptation, type);
Expand All @@ -861,6 +871,8 @@ function DashAdapter() {
* @param {object} manifest
* @param {object} patch
* @return {boolean}
* @memberOf module:DashAdapter
* @instance
*/
function isPatchValid(manifest, patch) {
let manifestId = dashManifestModel.getId(manifest);
Expand All @@ -883,6 +895,8 @@ function DashAdapter() {
* Takes a given patch and applies it to the provided manifest, assumes patch is valid for manifest
* @param {object} manifest
* @param {object} patch
* @memberOf module:DashAdapter
* @instance
*/
function applyPatchToManifest(manifest, patch) {
// get all operations from the patch and apply them in document order
Expand Down
1 change: 1 addition & 0 deletions src/dash/DashHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ function DashHandler(config) {
* @param {object} mediaInfo
* @param {object} representation
* @param {number} targetThreshold
* @return {number}
*/
function getValidTimeAheadOfTargetTime(time, mediaInfo, representation, targetThreshold) {
try {
Expand Down
1 change: 1 addition & 0 deletions src/dash/vo/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/
class Event {
constructor() {
this.type = '';
this.duration = NaN;
this.presentationTime = NaN;
this.id = NaN;
Expand Down
2 changes: 2 additions & 0 deletions src/dash/vo/ManifestInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ManifestInfo {
this.duration = NaN;
this.isDynamic = false;
this.maxFragmentDuration = null;
this.serviceDescriptions = [];
this.protocol = null;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/dash/vo/MediaInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class MediaInfo {
this.codec = null;
this.mimeType = null;
this.contentProtection = null;
this.isText = false;
this.KID = null;
this.bitrateList = null;
this.isFragmented = null;
Expand Down
1 change: 1 addition & 0 deletions src/dash/vo/Representation.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Representation {
this.maxPlayoutRate = NaN;
this.availabilityTimeOffset = 0;
this.availabilityTimeComplete = true;
this.frameRate = null;
}

hasInitialization() {
Expand Down
4 changes: 2 additions & 2 deletions src/offline/OfflineDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ function OfflineDownload(config) {
});
_streams.push(stream);

// initialise stream and get downloadable representations
// initialize stream and get downloadable representations
stream.initialize(streamInfo);
_progressionById[streamInfo.id] = null;
}
Expand Down Expand Up @@ -428,7 +428,7 @@ function OfflineDownload(config) {

// save original manifest (for resume)

// initialise offline streams
// initialize offline streams
composeStreams(_manifest);

// get MediaInfos
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ function MediaPlayer() {

cmsdModel.setConfig({});

// initialises controller
// initializes controller
abrController.initialize();
streamController.initialize(autoPlay, protectionData);
textController.initialize();
Expand Down
5 changes: 2 additions & 3 deletions src/streaming/StreamProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function StreamProcessor(config) {
/**
* When a seek within the corresponding period occurs this function initiates the clearing of the buffer and sets the correct buffering time.
* @param {object} e
* @private
* @returns {Promise<any>}
*/
function prepareInnerPeriodPlaybackSeeking(e) {
return new Promise((resolve) => {
Expand Down Expand Up @@ -606,7 +606,6 @@ function StreamProcessor(config) {
* The quality has changed which means we have switched to a different representation.
* If we want to aggressively replace existing parts in the buffer we need to make sure that the new quality is higher than the already buffered one.
* @param {object} e
* @private
*/
function prepareQualityChange(e) {
logger.debug(`Preparing quality switch for type ${type}`);
Expand Down Expand Up @@ -713,7 +712,7 @@ function StreamProcessor(config) {
logger.info('onFragmentLoadingAbandoned request: ' + e.request.url + ' has been aborted');

// we only need to handle this if we are not seeking, not switching the tracks and not switching the quality
if (!playbackController.isSeeking() && !scheduleController.getSwitchStrack() && !qualityChangeInProgress) {
if (!playbackController.isSeeking() && !scheduleController.getSwitchTrack() && !qualityChangeInProgress) {
logger.info('onFragmentLoadingAbandoned request: ' + e.request.url + ' has to be downloaded again, origin is not seeking process or switch track call');

// in case of an init segment we force the download of an init segment
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/AbrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function AbrController() {
* Returns the highest possible index taking limitations like maxBitrate, representationRatio and portal size into account.
* @param {string} type
* @param {string} streamId
* @return {number}
* @return {undefined|number}
*/
function getMaxAllowedIndexFor(type, streamId) {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function ScheduleController(config) {
switchTrack = value;
}

function getSwitchStrack() {
function getSwitchTrack() {
return switchTrack;
}

Expand Down Expand Up @@ -445,7 +445,7 @@ function ScheduleController(config) {
setTimeToLoadDelay,
getTimeToLoadDelay,
setSwitchTrack,
getSwitchStrack,
getSwitchTrack,
startScheduleTimer,
clearScheduleTimer,
reset,
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/metrics/MetricsReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function MetricsReporting() {
metricsConstants: config.metricsConstants,
events: config.events
});
dvbErrorsTranslator.initialise();
dvbErrorsTranslator.initialize();
return MetricsCollectionController(context).create(config);
}

Expand Down
6 changes: 3 additions & 3 deletions src/streaming/metrics/utils/DVBErrorsTranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function DVBErrorsTranslator(config) {

function handleHttpMetric(vo) {
if ((vo.responsecode === 0) || // connection failure - unknown
(vo.responsecode == null) || // Generated on .catch() and when uninitialised
(vo.responsecode == null) || // Generated on .catch() and when uninitialized
(vo.responsecode >= 400) || // HTTP error status code
(vo.responsecode < 100) || // unknown status codes
(vo.responsecode >= 600)) { // unknown status codes
Expand Down Expand Up @@ -133,7 +133,7 @@ function DVBErrorsTranslator(config) {
});
}

function initialise() {
function initialize() {
eventBus.on(Events.MANIFEST_UPDATED, onManifestUpdate, instance);
eventBus.on(
Events.SERVICE_LOCATION_BLACKLIST_CHANGED,
Expand Down Expand Up @@ -168,7 +168,7 @@ function DVBErrorsTranslator(config) {
}

instance = {
initialise,
initialize,
reset
};

Expand Down
6 changes: 3 additions & 3 deletions src/streaming/metrics/utils/RNG.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function RNG() {
index,
instance;

function initialise() {
function initialize() {
if (crypto) {
if (!randomNumbers) {
randomNumbers = new ArrayType(NUM_RANDOM_NUMBERS);
Expand All @@ -74,7 +74,7 @@ function RNG() {

if (crypto) {
if (index === randomNumbers.length) {
initialise();
initialize();
}

r = randomNumbers[index] / MAX_VALUE;
Expand All @@ -90,7 +90,7 @@ function RNG() {
random: rand
};

initialise();
initialize();

return instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ function ProtectionController(config) {
* Event handler for "needkey" and "encrypted" events
* @param {object} event
* @param {number} retry
* @private
*/
function _onNeedKey(event, retry) {
if (!settings.get().streaming.protection.ignoreEmeEncryptedEvent) {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/protection/vo/LicenseResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
class LicenseResponse {
/**
* Defines a license request
* Defines a license response
*
* @class
* @ignore
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/rules/abr/lolp/LoLpWeightSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function LoLpWeightSelector(config) {
* @param {number} currentRebuffer
* @param {number} currentThroughput
* @param {number} playbackRate
* @return {null}
* @return {number|null}
* @private
*/
function findWeightVector(neurons, currentLatency, currentBuffer, currentRebuffer, currentThroughput, playbackRate) {
Expand Down
3 changes: 3 additions & 0 deletions src/streaming/text/TextController.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ function TextController(config) {
}
}
}

return true
}

function isTextEnabled() {
Expand All @@ -268,6 +270,7 @@ function TextController(config) {
function enableForcedTextStreaming(enable) {
checkParameterType(enable, 'boolean');
forceTextStreaming = enable;
return true
}

function setTextTrack(streamId, idx) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/helpers/DashUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function teardown() {
isSeeking = false;
}

/** Initialise the variables*/
/** initialize the variables*/
function initialisation(rowID) {
teardown();
$('#Video' + rowID).show();
Expand Down