Skip to content

Commit

Permalink
refactor: rename SegmentInfo property from timeline to segmentTimeline (
Browse files Browse the repository at this point in the history
#140)

This change helps avoid confusion between VHS-JSON timeline property and the DASH
SegmentTimeline attribute.
  • Loading branch information
gesinger authored Jul 27, 2021
1 parent a972b8c commit 1601467
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/inheritAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const buildBaseUrls = (referenceUrls, baseUrlElements) => {
* @typedef {Object} SegmentInformation
* @property {Object|undefined} template
* Contains the attributes for the SegmentTemplate node
* @property {Object[]|undefined} timeline
* @property {Object[]|undefined} segmentTimeline
* Contains a list of atrributes for each S node within the SegmentTimeline node
* @property {Object|undefined} list
* Contains the attributes for the SegmentList node
Expand Down Expand Up @@ -90,7 +90,7 @@ export const getSegmentInformation = (adaptationSet) => {

const segmentInfo = {
template,
timeline: segmentTimeline &&
segmentTimeline: segmentTimeline &&
findChildren(segmentTimeline, 'S').map(s => parseAttributes(s)),
list: segmentList && merge(
parseAttributes(segmentList),
Expand Down
2 changes: 1 addition & 1 deletion src/toPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const generateSegments = ({ attributes, segmentInfo }) => {
return segmentsInfo;
}

const segments = segmentsFn(segmentAttributes, segmentInfo.timeline);
const segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);

// The @duration attribute will be used to determin the playlist's targetDuration which
// must be in seconds. Since we've generated the segment list, we no longer need
Expand Down
2 changes: 1 addition & 1 deletion test/inheritAttributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ QUnit.test('gets SegmentTemplate and SegmentTimeline attributes', function(asser
};
const expected = {
template: { media: 'video.mp4' },
timeline: [{ d: 10 }, { d: 5 }, { d: 7 }]
segmentTimeline: [{ d: 10 }, { d: 5 }, { d: 7 }]
};

assert.deepEqual(
Expand Down

0 comments on commit 1601467

Please sign in to comment.