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

feat: support multi-period live DASH with changing periods #144

Closed
wants to merge 3 commits into from

Conversation

gesinger
Copy link
Contributor

In order to handle live DASH manifests where periods are changed, added,
and removed, merging is used to ensure that the new manifest is a
continuation of the last parsed manifest. In addition, playlists that
need to be excluded are identified in the returned object.

BREAKING CHANGE: the top level API of this module no longer returns the
manifest alone

In order to handle live DASH manifests where periods are changed, added,
and removed, merging is used to ensure that the new manifest is a
continuation of the last parsed manifest. In addition, playlists that
need to be excluded are identified in the returned object.

BREAKING CHANGE: the top level API of this module no longer returns the
manifest alone
Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, IE11 ruins all the fun.

README.md Outdated
Comment on lines 53 to 54
playlistsToExclude,
mediaGroupPlaylistsToExclude
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how bad would it be to include these properties on the returned manifest object directly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly with noop function even if lastMpd isn't passed to us, so that we are consistent.

Comment on lines 13 to 18
// TODO Decide if SegmentList be chosen ahead of SegmentBase.
//
// Judging by the specification (see the 2012 specification, section 5.3.9.2),
// SegmentBase seems to only be used as the strategy if there's no SegmentTemplate or
// SegmentList. However, the historical ordering here will use SegmentBase as the
// strategy before SegmentList. This ordering should be reconsidered.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the DASH profile specifies which of these will be used/available. Something to look into in the future.

/**
* Finds the media group playlist with the matching NAME attribute.
*
* @param {Object} config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully, to resolve linter issues

Suggested change
* @param {Object} config
* @param {Object} config options object

/**
* Returns any old playlists that are no longer available in the new playlists.
*
* @param {Object} config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully, to resolve linter issues

Suggested change
* @param {Object} config
* @param {Object} config options object

* Returns any old media group playlists that are no longer available in the new media
* group playlists.
*
* @param {Object} config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully, to resolve linter issues

Suggested change
* @param {Object} config
* @param {Object} config options object

* Goes through the provided segments and updates the appropriate sequence and timeline
* related attributes.
*
* @param {Object} config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully, to resolve linter issues

Suggested change
* @param {Object} config
* @param {Object} config options object

// a segment with a matching presentation time. These values should not change on
// refreshes.
const firstNewSegment = newSegments[0];
const oldMatchingSegmentIndex = oldSegments.findIndex((oldSegment) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findIndex isn't available on IE11, unfortunately. And we should avoid breaking it if we can.

// and the new playlist exists for periods/timelines after a certain point) then it will
// be available once it is no longer incomplete.
newManifest.playlists =
newManifest.playlists.filter((playlist) => !incompletePlaylists.includes(playlist));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.includes isn't available on IE11 either, unfortunately.

// matching presentation times in another playlist (or matching presentation time
// ranges within timelines) and sequencing from there.
newManifest.playlists =
newManifest.playlists.filter((playlist) => !addedPlaylists.includes(playlist));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.includes isn't available on IE11 either, unfortunately.


forEachMediaGroup(manifest, SUPPORTED_MEDIA_TYPES, (properties, type, group, label) => {
properties.playlists.forEach((playlist) => {
if (playlists.includes(playlist)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.includes isn't available on IE11 either, unfortunately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use .some in place of .includes

Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preliminary review. Still have to look more deeply at playlist-merge and the playlist-merge tests.

README.md Outdated
Comment on lines 53 to 54
playlistsToExclude,
mediaGroupPlaylistsToExclude
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly with noop function even if lastMpd isn't passed to us, so that we are consistent.


forEachMediaGroup(manifest, SUPPORTED_MEDIA_TYPES, (properties, type, group, label) => {
properties.playlists.forEach((playlist) => {
if (playlists.includes(playlist)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use .some in place of .includes

@@ -10,6 +10,12 @@ export const generateSegments = ({ attributes, segmentInfo }) => {
if (segmentInfo.template) {
segmentsFn = segmentsFromTemplate;
segmentAttributes = merge(attributes, segmentInfo.template);
// TODO Decide if SegmentList be chosen ahead of SegmentBase.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO Decide if SegmentList be chosen ahead of SegmentBase.
// TODO: Decide if SegmentList be chosen ahead of SegmentBase.

So that it shows up in the linter

@gesinger
Copy link
Contributor Author

Closing in favor of #152

@gesinger gesinger closed this Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants