hls-fetcher
Advanced tools
Comparing version 2.0.2 to 2.1.0
{ | ||
"name": "hls-fetcher", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "Fetch HLS segments from an m3u8 playlist", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"docs:toc": "doctoc README.md", | ||
"lint": "vjsstandard", | ||
"pretest": "npm run lint", | ||
"test": "NODE_ENV=test mocha --opts test/opts/unit.opts test/unit" | ||
"test": "NODE_ENV=test mocha --opts test/opts/unit.opts test/unit", | ||
"update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", | ||
"preversion": "npm test", | ||
"version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", | ||
"prepublishOnly": "vjsverify --skip-es-check" | ||
}, | ||
@@ -30,3 +35,3 @@ "bin": { | ||
"bluebird": "^3.4.0", | ||
"m3u8-parser": "^4.2.0", | ||
"m3u8-parser": "^4.3.0", | ||
"mkdirp": "^0.5.1", | ||
@@ -38,6 +43,49 @@ "pessimist": "^0.3.5", | ||
"devDependencies": { | ||
"conventional-changelog-cli": "^2.0.1", | ||
"conventional-changelog-videojs": "^3.0.0", | ||
"doctoc": "^1.3.1", | ||
"husky": "^1.0.0-rc.13", | ||
"lint-staged": "^7.2.2", | ||
"mocha": "^5.2.0", | ||
"nock": "^9.3.3", | ||
"videojs-standard": "^6.0.2" | ||
"not-prerelease": "^1.0.1", | ||
"videojs-standard": "^7.0.1", | ||
"npm-merge-driver-install": "^1.0.0", | ||
"videojs-generator-verify": "~1.0.4" | ||
}, | ||
"generator-videojs-plugin": { | ||
"version": "7.3.2" | ||
}, | ||
"browserslist": [ | ||
"defaults", | ||
"ie 11" | ||
], | ||
"vjsstandard": { | ||
"ignore": [ | ||
"dist", | ||
"docs", | ||
"test/dist" | ||
] | ||
}, | ||
"files": [ | ||
"CONTRIBUTING.md", | ||
"docs/", | ||
"src/", | ||
"test/" | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"vjsstandard --fix", | ||
"git add" | ||
], | ||
"README.md": [ | ||
"npm run docs:toc", | ||
"git add" | ||
] | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
# HLS-FETCHER | ||
@@ -9,6 +10,2 @@ | ||
A plugin that displays user-friendly messages when Video.js encounters an error. | ||
Lead Maintainer: Brandon Casey [@brandonocasey](https://github.com/brandonocasey) | ||
Maintenance Status: Stable | ||
@@ -18,2 +15,11 @@ | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* | ||
- [Installation](#installation) | ||
- [Command Line Usage](#command-line-usage) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## Installation | ||
@@ -20,0 +26,0 @@ |
@@ -16,3 +16,3 @@ /* eslint-disable no-console */ | ||
parse.pathname = path.join(parse.pathname, relative); | ||
parse.pathname = path.resolve(parse.pathname, relative); | ||
return url.format(parse); | ||
@@ -82,3 +82,3 @@ }; | ||
manifest.content = new Buffer(manifest.content.toString().replace( | ||
manifest.content = Buffer.from(manifest.content.toString().replace( | ||
key.uri, | ||
@@ -115,3 +115,3 @@ path.relative(path.dirname(manifest.file), key.file) | ||
// remove the key from the manifest | ||
manifest.content = new Buffer(manifest.content.toString().replace( | ||
manifest.content = Buffer.from(manifest.content.toString().replace( | ||
new RegExp('.*' + key.uri + '.*'), | ||
@@ -174,3 +174,3 @@ '' | ||
// replace original uri in file with new file path | ||
parent.content = new Buffer(parent.content.toString().replace(uri, path.relative(path.dirname(parent.file), manifest.file))); | ||
parent.content = Buffer.from(parent.content.toString().replace(uri, path.relative(path.dirname(parent.file), manifest.file))); | ||
} | ||
@@ -207,2 +207,11 @@ | ||
const initSegments = []; | ||
manifest.parsed.segments.forEach(function(s) { | ||
if (s.map && s.map.uri && !initSegments.some((m) => s.map.uri === m.uri)) { | ||
manifest.parsed.segments.push(s.map); | ||
initSegments.push(s.map); | ||
} | ||
}); | ||
const playlists = manifest.parsed.playlists.concat(mediaGroupPlaylists(manifest.parsed.mediaGroups)); | ||
@@ -229,3 +238,3 @@ | ||
} | ||
manifest.content = new Buffer(manifest.content.toString().replace( | ||
manifest.content = Buffer.from(manifest.content.toString().replace( | ||
s.uri, | ||
@@ -232,0 +241,0 @@ path.relative(path.dirname(manifest.file), s.file) |
@@ -88,2 +88,47 @@ /* eslint-env mocha */ | ||
it('should return correct paths for m3u8', function(done) { | ||
nock(TEST_URL) | ||
.get('/test/test.m3u8') | ||
.replyWithFile(200, `${process.cwd()}/test/resources/path-testing.m3u8`); | ||
const options = {decrypt: false, basedir: '.', uri: TEST_URL + '/test/test.m3u8', requestRetryMaxAttempts: 0}; | ||
walker(options) | ||
.then(function(resources) { | ||
assert.equal(resources[0].uri, `${TEST_URL}/test/test.m3u8`); | ||
assert.equal(resources[1].uri, `${TEST_URL}/test/chunk_0.ts`); | ||
assert.equal(resources[2].uri, `${TEST_URL}/test/chunk_1.ts`); | ||
assert.equal(resources[3].uri, `${TEST_URL}/test/test/chunk_2.ts`); | ||
assert.equal(resources[4].uri, `${TEST_URL}/test/chunk_3.ts`); | ||
done(); | ||
}); | ||
}); | ||
it('should return fmp4/ts segments and init segment for fmp4 m3u8', function(done) { | ||
nock(TEST_URL) | ||
.get('/test.m3u8') | ||
.replyWithFile(200, `${process.cwd()}/test/resources/fmp4.m3u8`); | ||
const options = {decrypt: false, basedir: '.', uri: TEST_URL + '/test.m3u8', requestRetryMaxAttempts: 0}; | ||
walker(options) | ||
.then(function(resources) { | ||
// m3u8 and 13 segments | ||
const setResources = new Set(resources); | ||
assert.equal(setResources.size, 13); | ||
setResources.forEach(function(item) { | ||
assert( | ||
item.uri.includes('.ts') || | ||
item.uri.includes('.m3u8') || | ||
item.uri.includes('.mp4') || | ||
item.uri.includes('.m4s') | ||
); | ||
}); | ||
done(); | ||
}); | ||
}); | ||
it('should follow http redirects for simple m3u8', function(done) { | ||
@@ -90,0 +135,0 @@ nock(TEST_URL) |
Sorry, the diff of this file is not supported yet
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
45453
21
913
46
11
Updatedm3u8-parser@^4.3.0