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

fix: MPD not refreshed if minimumUpdatePeriod is 0 #954

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all 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
30 changes: 23 additions & 7 deletions src/dash-playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,31 @@ export default class DashPlaylistLoader extends EventTarget {
// Clear existing timeout
window.clearTimeout(this.minimumUpdatePeriodTimeout_);

const minimumUpdatePeriod = this.master && this.master.minimumUpdatePeriod;

if (minimumUpdatePeriod >= 0) {
const createMUPTimeout = (mup) => {
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => {
this.trigger('minimumUpdatePeriod');
// We use the target duration here because a minimumUpdatePeriod value of 0
// indicates that the current MPD has no future validity, so a new one will
// need to be acquired when new media segments are to be made available
}, minimumUpdatePeriod || this.media().targetDuration * 1000);
}, mup);
};

const minimumUpdatePeriod = this.master && this.master.minimumUpdatePeriod;

if (minimumUpdatePeriod > 0) {
createMUPTimeout(minimumUpdatePeriod);

// If the minimumUpdatePeriod has a value of 0, that indicates that the current
// MPD has no future validity, so a new one will need to be acquired when new
// media segments are to be made available. Thus, we use the target duration
// in this case
} else if (minimumUpdatePeriod === 0) {
// If we haven't yet selected a playlist, wait until then so we know the
// target duration
if (!this.media()) {
this.one('loadedplaylist', () => {
createMUPTimeout(this.media().targetDuration * 1000);
});
} else {
createMUPTimeout(this.media().targetDuration * 1000);
}
}
}

Expand Down