m3u8stream
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -70,2 +70,11 @@ const Writable = require('stream').Writable; | ||
break; | ||
case 'initialization': | ||
if (getSegments) { | ||
this.emit('item', { | ||
url: baseURL.filter(s => !!s).join('') + node.attributes.sourceurl, | ||
seq: seq++, | ||
duration: 0, | ||
}); | ||
} | ||
break; | ||
case 'segmenturl': | ||
@@ -88,3 +97,3 @@ if (getSegments) { | ||
if (!getSegments) { | ||
this.emit('error', new Error(`Representation '${targetID}' not found`)); | ||
this.emit('error', Error(`Representation '${targetID}' not found`)); | ||
} | ||
@@ -91,0 +100,0 @@ this.emit('end'); |
@@ -11,3 +11,3 @@ const PassThrough = require('stream').PassThrough; | ||
/** | ||
* @param {String} playlistURL | ||
* @param {string} playlistURL | ||
* @param {Object} options | ||
@@ -27,3 +27,3 @@ * @return {stream.Readable} | ||
if (!Parser) { | ||
throw new TypeError(`parser '${options.parser}' not supported`); | ||
throw TypeError(`parser '${options.parser}' not supported`); | ||
} | ||
@@ -49,3 +49,3 @@ let relativeBegin = typeof options.begin === 'string'; | ||
function onError(err) { | ||
const onError = (err) => { | ||
if (ended) { return; } | ||
@@ -55,3 +55,3 @@ stream.emit('error', err); | ||
stream.end(); | ||
} | ||
}; | ||
@@ -66,3 +66,3 @@ // When to look for items again. | ||
function onQueuedEnd(err) { | ||
const onQueuedEnd = (err) => { | ||
currSegment = null; | ||
@@ -78,7 +78,7 @@ if (err) { | ||
} | ||
} | ||
}; | ||
let currPlaylist; | ||
let lastSeq; | ||
function refreshPlaylist() { | ||
const refreshPlaylist = () => { | ||
fetchingPlaylist = true; | ||
@@ -101,3 +101,3 @@ lastRefresh = Date.now(); | ||
let liveAddedItems = []; | ||
function addItem(item, isLive) { | ||
const addItem = (item, isLive) => { | ||
if (item.seq <= lastSeq) { return; } | ||
@@ -111,3 +111,3 @@ lastSeq = item.seq; | ||
} | ||
} | ||
}; | ||
@@ -149,3 +149,3 @@ let tailedItems = [], tailedItemsDuration = 0; | ||
}); | ||
} | ||
}; | ||
refreshPlaylist(); | ||
@@ -152,0 +152,0 @@ |
@@ -6,4 +6,4 @@ /** | ||
* | ||
* @param {String|Number} time | ||
* @return {Number} | ||
* @param {string|number} time | ||
* @return {number} | ||
*/ | ||
@@ -10,0 +10,0 @@ const numberFormat = /^\d+$/; |
module.exports = class Queue { | ||
/** | ||
* A really simple queue with concurrency that optionally | ||
* only adds unique tasks. | ||
* A really simple queue with concurrency. | ||
* | ||
@@ -24,4 +23,4 @@ * @param {Function(Object, Function)} worker | ||
*/ | ||
push() { | ||
this.tasks.push(arguments); | ||
push(item, callback) { | ||
this.tasks.push({ item, callback }); | ||
this._next(); | ||
@@ -36,5 +35,3 @@ } | ||
if (this.active >= this._concurrency || !this.tasks.length) { return; } | ||
let task = this.tasks.shift(); | ||
let item = task[0]; | ||
let callback = task[1]; | ||
const { item, callback } = this.tasks.shift(); | ||
let callbackCalled = false; | ||
@@ -41,0 +38,0 @@ this.active++; |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"repository": { | ||
@@ -35,8 +35,8 @@ "type": "git", | ||
"mocha": "^5.0.0", | ||
"nock": "^9.3.2" | ||
"nock": "^10.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=6" | ||
}, | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16737
411