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: expose suggestPresentationDelay if the type is dynamic #82

Merged
merged 4 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/parseAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,32 @@ export const parsers = {
return parseDuration(value);
},

/**
* Specifies the suggested presentation delay. Format is a
* duration string as specified in ISO 8601
*
* @param {string} value
* value of attribute as a string
* @return {number}
* The duration in seconds
*/
suggestedPresentationDelay(value) {
return parseDuration(value);
},

/**
* specifices the type of mpd. Can be either "static" or "dynamic"
*
* @param {string} value
* value of attribute as a string
*
* @return {string}
* The type as a string
*/
type(value) {
return value;
},

/**
* Specifies the duration of the smallest time shifting buffer for any Representation
* in the MPD. Format is a duration string as specified in ISO 8601
Expand Down
6 changes: 6 additions & 0 deletions src/toM3u8.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ export const toM3u8 = (dashPlaylists, sidxMapping = {}) => {
// grab all master attributes
const {
sourceDuration: duration,
type = 'static',
suggestedPresentationDelay,
minimumUpdatePeriod = 0
} = dashPlaylists[0].attributes;

Expand Down Expand Up @@ -270,6 +272,10 @@ export const toM3u8 = (dashPlaylists, sidxMapping = {}) => {
minimumUpdatePeriod: minimumUpdatePeriod * 1000
};

if (type === 'dynamic') {
master.suggestedPresentationDelay = suggestedPresentationDelay;
}

if (audioPlaylists.length) {
master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping);
}
Expand Down