Bump @justinribeiro/lite-youtube from 0.9.0 to 0.9.1 in /build/javascript (#273)
* Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript (#265) * Trying a new github workflow to install javascript packages * Bump tailwindcss from 1.9.2 to 1.9.4 in /build/javascript (#266) Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 1.9.2 to 1.9.4. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v1.9.2...v1.9.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript Bumps [preact](https://github.com/preactjs/preact) from 10.5.4 to 10.5.5. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.4...10.5.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owncast <owncast@owncast.online> * Bump @justinribeiro/lite-youtube in /build/javascript Bumps [@justinribeiro/lite-youtube](https://github.com/justinribeiro/lite-youtube) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/justinribeiro/lite-youtube/releases) - [Commits](https://github.com/justinribeiro/lite-youtube/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
201
build/javascript/node_modules/mpd-parser/test/segment/segmentBase.test.js
generated
vendored
Normal file
201
build/javascript/node_modules/mpd-parser/test/segment/segmentBase.test.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
import QUnit from 'qunit';
|
||||
import {
|
||||
segmentsFromBase,
|
||||
addSegmentsToPlaylist
|
||||
} from '../../src/segment/segmentBase';
|
||||
import errors from '../../src/errors';
|
||||
|
||||
QUnit.module('segmentBase - segmentsFromBase');
|
||||
|
||||
QUnit.test('sets segment to baseUrl', function(assert) {
|
||||
const inputAttributes = {
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: { sourceURL: 'http://www.example.com/init.fmp4' }
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('sets duration based on sourceDuration', function(assert) {
|
||||
const inputAttributes = {
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: { sourceURL: 'http://www.example.com/init.fmp4' },
|
||||
sourceDuration: 10
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
duration: 10,
|
||||
timeline: 0,
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
// sourceDuration comes from mediaPresentationDuration. The DASH spec defines the type of
|
||||
// mediaPresentationDuration as xs:duration, which follows ISO 8601. It does not need to
|
||||
// be adjusted based on timescale.
|
||||
//
|
||||
// References:
|
||||
// https://www.w3.org/TR/xmlschema-2/#duration
|
||||
// https://en.wikipedia.org/wiki/ISO_8601
|
||||
QUnit.test('sets duration based on sourceDuration and not @timescale', function(assert) {
|
||||
const inputAttributes = {
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: { sourceURL: 'http://www.example.com/init.fmp4' },
|
||||
sourceDuration: 10,
|
||||
timescale: 2
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
duration: 10,
|
||||
timeline: 0,
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('sets duration based on @duration', function(assert) {
|
||||
const inputAttributes = {
|
||||
duration: 10,
|
||||
sourceDuration: 20,
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: { sourceURL: 'http://www.example.com/init.fmp4' },
|
||||
periodIndex: 0
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
duration: 10,
|
||||
timeline: 0,
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('sets duration based on @duration and @timescale', function(assert) {
|
||||
const inputAttributes = {
|
||||
duration: 10,
|
||||
sourceDuration: 20,
|
||||
timescale: 5,
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: { sourceURL: 'http://www.example.com/init.fmp4' },
|
||||
periodIndex: 0
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
duration: 2,
|
||||
timeline: 0,
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('translates ranges in <Initialization> node', function(assert) {
|
||||
const inputAttributes = {
|
||||
duration: 10,
|
||||
sourceDuration: 20,
|
||||
timescale: 5,
|
||||
baseUrl: 'http://www.example.com/i.fmp4',
|
||||
initialization: {
|
||||
sourceURL: 'http://www.example.com/init.fmp4',
|
||||
range: '121-125'
|
||||
},
|
||||
periodIndex: 0
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromBase(inputAttributes), [{
|
||||
duration: 2,
|
||||
timeline: 0,
|
||||
map: {
|
||||
resolvedUri: 'http://www.example.com/init.fmp4',
|
||||
uri: 'http://www.example.com/init.fmp4',
|
||||
byterange: {
|
||||
length: 5,
|
||||
offset: 121
|
||||
}
|
||||
},
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('errors if no baseUrl exists', function(assert) {
|
||||
assert.throws(() => segmentsFromBase({}), new Error(errors.NO_BASE_URL));
|
||||
});
|
||||
|
||||
QUnit.module('segmentBase - addSegmentsToPlaylist');
|
||||
|
||||
QUnit.test('generates playlist from sidx references', function(assert) {
|
||||
const baseUrl = 'http://www.example.com/i.fmp4';
|
||||
const playlist = {
|
||||
sidx: {
|
||||
map: {
|
||||
byterange: {
|
||||
offset: 0,
|
||||
length: 10
|
||||
}
|
||||
},
|
||||
duration: 10,
|
||||
byterange: {
|
||||
offset: 9,
|
||||
length: 11
|
||||
}
|
||||
},
|
||||
segments: []
|
||||
};
|
||||
const sidx = {
|
||||
timescale: 1,
|
||||
firstOffset: 0,
|
||||
references: [{
|
||||
referenceType: 0,
|
||||
referencedSize: 5,
|
||||
subsegmentDuration: 2
|
||||
}]
|
||||
};
|
||||
|
||||
assert.deepEqual(addSegmentsToPlaylist(playlist, sidx, baseUrl).segments, [{
|
||||
map: {
|
||||
byterange: {
|
||||
offset: 0,
|
||||
length: 10
|
||||
}
|
||||
},
|
||||
uri: 'http://www.example.com/i.fmp4',
|
||||
resolvedUri: 'http://www.example.com/i.fmp4',
|
||||
byterange: {
|
||||
offset: 20,
|
||||
length: 5
|
||||
},
|
||||
duration: 2,
|
||||
timeline: 0,
|
||||
number: 0
|
||||
}]);
|
||||
});
|
||||
553
build/javascript/node_modules/mpd-parser/test/segment/segmentList.test.js
generated
vendored
Normal file
553
build/javascript/node_modules/mpd-parser/test/segment/segmentList.test.js
generated
vendored
Normal file
@@ -0,0 +1,553 @@
|
||||
import QUnit from 'qunit';
|
||||
import {
|
||||
segmentsFromList
|
||||
} from '../../src/segment/segmentList';
|
||||
import errors from '../../src/errors';
|
||||
|
||||
QUnit.module('segmentList - segmentsFromList');
|
||||
|
||||
QUnit.test('uses segmentTimeline to set segments', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}, {
|
||||
media: '3.fmp4'
|
||||
}, {
|
||||
media: '4.fmp4'
|
||||
}, {
|
||||
media: '5.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
const inputTimeline = [{
|
||||
t: 1000,
|
||||
d: 1000,
|
||||
r: 4
|
||||
}];
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/3.fmp4',
|
||||
timeline: 0,
|
||||
uri: '3.fmp4',
|
||||
number: 3
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/4.fmp4',
|
||||
timeline: 0,
|
||||
uri: '4.fmp4',
|
||||
number: 4
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/5.fmp4',
|
||||
timeline: 0,
|
||||
uri: '5.fmp4',
|
||||
number: 5
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
'truncates if segmentTimeline does not apply for all segments',
|
||||
function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}, {
|
||||
media: '3.fmp4'
|
||||
}, {
|
||||
media: '4.fmp4'
|
||||
}, {
|
||||
media: '5.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
const inputTimeline = [{
|
||||
t: 1000,
|
||||
d: 1000,
|
||||
r: 1
|
||||
}];
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}]);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
'if segment timeline is too long does not add extra blank segments',
|
||||
function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}, {
|
||||
media: '3.fmp4'
|
||||
}, {
|
||||
media: '4.fmp4'
|
||||
}, {
|
||||
media: '5.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
const inputTimeline = [{
|
||||
t: 1000,
|
||||
d: 1000,
|
||||
r: 10
|
||||
}];
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes, inputTimeline), [{
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/3.fmp4',
|
||||
timeline: 0,
|
||||
uri: '3.fmp4',
|
||||
number: 3
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/4.fmp4',
|
||||
timeline: 0,
|
||||
uri: '4.fmp4',
|
||||
number: 4
|
||||
}, {
|
||||
duration: 1000,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/5.fmp4',
|
||||
timeline: 0,
|
||||
uri: '5.fmp4',
|
||||
number: 5
|
||||
}]);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('uses duration to set segments', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}, {
|
||||
media: '3.fmp4'
|
||||
}, {
|
||||
media: '4.fmp4'
|
||||
}, {
|
||||
media: '5.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
duration: 10,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 50,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes), [{
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}, {
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/3.fmp4',
|
||||
timeline: 0,
|
||||
uri: '3.fmp4',
|
||||
number: 3
|
||||
}, {
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/4.fmp4',
|
||||
timeline: 0,
|
||||
uri: '4.fmp4',
|
||||
number: 4
|
||||
}, {
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/5.fmp4',
|
||||
timeline: 0,
|
||||
uri: '5.fmp4',
|
||||
number: 5
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('uses timescale to set segment duration', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}, {
|
||||
media: '3.fmp4'
|
||||
}, {
|
||||
media: '4.fmp4'
|
||||
}, {
|
||||
media: '5.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
duration: 10,
|
||||
timescale: 2,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 25,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes), [{
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}, {
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/3.fmp4',
|
||||
timeline: 0,
|
||||
uri: '3.fmp4',
|
||||
number: 3
|
||||
}, {
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/4.fmp4',
|
||||
timeline: 0,
|
||||
uri: '4.fmp4',
|
||||
number: 4
|
||||
}, {
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/5.fmp4',
|
||||
timeline: 0,
|
||||
uri: '5.fmp4',
|
||||
number: 5
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('timescale sets duration of last segment correctly', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
duration: 10,
|
||||
timescale: 1,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 15,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes), [{
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 5,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/2.fmp4',
|
||||
timeline: 0,
|
||||
uri: '2.fmp4',
|
||||
number: 2
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test('segmentUrl translates ranges correctly', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4',
|
||||
mediaRange: '0-200'
|
||||
}, {
|
||||
media: '1.fmp4',
|
||||
mediaRange: '201-400'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
duration: 10,
|
||||
timescale: 1,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 20,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes), [{
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
byterange: {
|
||||
length: 201,
|
||||
offset: 0
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 10,
|
||||
byterange: {
|
||||
length: 200,
|
||||
offset: 201
|
||||
},
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 2
|
||||
}]);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
'throws error if more than 1 segment and no duration or timeline',
|
||||
function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}],
|
||||
duration: 10,
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
timescale: 1,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 20,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
const inputTimeline = [{
|
||||
t: 1000,
|
||||
d: 1000,
|
||||
r: 4
|
||||
}];
|
||||
|
||||
assert.throws(
|
||||
() => segmentsFromList(inputAttributes, inputTimeline),
|
||||
new Error(errors.SEGMENT_TIME_UNSPECIFIED)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('throws error if timeline and duration are both defined', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '2.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4' },
|
||||
timescale: 1,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 20,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.throws(
|
||||
() => segmentsFromList(inputAttributes),
|
||||
new Error(errors.SEGMENT_TIME_UNSPECIFIED)
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test('translates ranges in <Initialization> node', function(assert) {
|
||||
const inputAttributes = {
|
||||
segmentUrls: [{
|
||||
media: '1.fmp4'
|
||||
}, {
|
||||
media: '1.fmp4'
|
||||
}],
|
||||
initialization: { sourceURL: 'init.fmp4', range: '121-125' },
|
||||
duration: 10,
|
||||
timescale: 1,
|
||||
periodIndex: 0,
|
||||
startNumber: 1,
|
||||
sourceDuration: 20,
|
||||
baseUrl: 'http://example.com/'
|
||||
};
|
||||
|
||||
assert.deepEqual(segmentsFromList(inputAttributes), [{
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4',
|
||||
byterange: {
|
||||
length: 5,
|
||||
offset: 121
|
||||
}
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 1
|
||||
}, {
|
||||
duration: 10,
|
||||
map: {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4',
|
||||
byterange: {
|
||||
length: 5,
|
||||
offset: 121
|
||||
}
|
||||
},
|
||||
resolvedUri: 'http://example.com/1.fmp4',
|
||||
timeline: 0,
|
||||
uri: '1.fmp4',
|
||||
number: 2
|
||||
}]);
|
||||
});
|
||||
1405
build/javascript/node_modules/mpd-parser/test/segment/segmentTemplate.test.js
generated
vendored
Normal file
1405
build/javascript/node_modules/mpd-parser/test/segment/segmentTemplate.test.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
94
build/javascript/node_modules/mpd-parser/test/segment/urlType.test.js
generated
vendored
Normal file
94
build/javascript/node_modules/mpd-parser/test/segment/urlType.test.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
import QUnit from 'qunit';
|
||||
import {
|
||||
urlTypeToSegment as urlTypeConverter,
|
||||
byteRangeToString
|
||||
} from '../../src/segment/urlType';
|
||||
|
||||
QUnit.module('urlType - urlTypeConverter');
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl only', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({ baseUrl: 'http://example.com' }), {
|
||||
resolvedUri: 'http://example.com',
|
||||
uri: ''
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl and source', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({
|
||||
baseUrl: 'http://example.com',
|
||||
source: 'init.fmp4'
|
||||
}), {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4'
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl, source and range', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({
|
||||
baseUrl: 'http://example.com',
|
||||
source: 'init.fmp4',
|
||||
range: '101-105'
|
||||
}), {
|
||||
resolvedUri: 'http://example.com/init.fmp4',
|
||||
uri: 'init.fmp4',
|
||||
byterange: {
|
||||
offset: 101,
|
||||
length: 5
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl, source and indexRange', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({
|
||||
baseUrl: 'http://example.com',
|
||||
source: 'sidx.fmp4',
|
||||
indexRange: '101-105'
|
||||
}), {
|
||||
resolvedUri: 'http://example.com/sidx.fmp4',
|
||||
uri: 'sidx.fmp4',
|
||||
byterange: {
|
||||
offset: 101,
|
||||
length: 5
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl and range', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({
|
||||
baseUrl: 'http://example.com',
|
||||
range: '101-105'
|
||||
}), {
|
||||
resolvedUri: 'http://example.com',
|
||||
uri: '',
|
||||
byterange: {
|
||||
offset: 101,
|
||||
length: 5
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('returns correct object if given baseUrl and indexRange', function(assert) {
|
||||
assert.deepEqual(urlTypeConverter({
|
||||
baseUrl: 'http://example.com',
|
||||
indexRange: '101-105'
|
||||
}), {
|
||||
resolvedUri: 'http://example.com',
|
||||
uri: '',
|
||||
byterange: {
|
||||
offset: 101,
|
||||
length: 5
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.module('urlType - byteRangeToString');
|
||||
|
||||
QUnit.test('returns correct string representing byterange object', function(assert) {
|
||||
assert.strictEqual(
|
||||
byteRangeToString({
|
||||
offset: 0,
|
||||
length: 100
|
||||
}),
|
||||
'0-99'
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user