-
Notifications
You must be signed in to change notification settings - Fork 424
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: Update minimumUpdatePeriod handling #942
Changes from 4 commits
abf2b41
b6785bd
2d05724
bf3b8c0
99b416b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,10 @@ export const updateMaster = (oldMaster, newMaster) => { | |
} | ||
}); | ||
|
||
if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) { | ||
noChanges = false; | ||
} | ||
|
||
if (noChanges) { | ||
return null; | ||
} | ||
|
@@ -646,6 +650,16 @@ export default class DashPlaylistLoader extends EventTarget { | |
} | ||
} | ||
|
||
updateMinimumUpdatePeriodTimeout_() { | ||
const minimumUpdatePeriod = this.master && this.master.minimumUpdatePeriod; | ||
|
||
if (minimumUpdatePeriod >= 0) { | ||
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => { | ||
this.trigger('minimumUpdatePeriod'); | ||
}, minimumUpdatePeriod || this.media().targetDuration * 1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a comment here saying why the default is target duration. |
||
} | ||
} | ||
|
||
/** | ||
* Handler for after client/server clock synchronization has happened. Sets up | ||
* xml refresh timer if specificed by the manifest. | ||
|
@@ -657,17 +671,7 @@ export default class DashPlaylistLoader extends EventTarget { | |
this.media(this.master.playlists[0]); | ||
} | ||
|
||
// TODO: minimumUpdatePeriod can have a value of 0. Currently the manifest will not | ||
// be refreshed when this is the case. The inter-op guide says that when the | ||
// minimumUpdatePeriod is 0, the manifest should outline all currently available | ||
// segments, but future segments may require an update. I think a good solution | ||
// would be to update the manifest at the same rate that the media playlists | ||
// are "refreshed", i.e. every targetDuration. | ||
if (this.master && this.master.minimumUpdatePeriod) { | ||
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => { | ||
this.trigger('minimumUpdatePeriod'); | ||
}, this.master.minimumUpdatePeriod); | ||
} | ||
this.updateMinimumUpdatePeriodTimeout_(); | ||
} | ||
|
||
/** | ||
|
@@ -766,11 +770,8 @@ export default class DashPlaylistLoader extends EventTarget { | |
|
||
// Clear & reset timeout with new minimumUpdatePeriod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be worth creating a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup makes sense. Done |
||
window.clearTimeout(this.minimumUpdatePeriodTimeout_); | ||
if (this.master.minimumUpdatePeriod) { | ||
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => { | ||
this.trigger('minimumUpdatePeriod'); | ||
}, this.master.minimumUpdatePeriod); | ||
} | ||
|
||
this.updateMinimumUpdatePeriodTimeout_(); | ||
|
||
// TODO: do we need to reload the current playlist? | ||
this.refreshMedia_(this.media().id); | ||
|
@@ -789,11 +790,8 @@ export default class DashPlaylistLoader extends EventTarget { | |
|
||
// Clear & reset timeout with new minimumUpdatePeriod | ||
window.clearTimeout(this.minimumUpdatePeriodTimeout_); | ||
if (this.master.minimumUpdatePeriod) { | ||
this.minimumUpdatePeriodTimeout_ = window.setTimeout(() => { | ||
this.trigger('minimumUpdatePeriod'); | ||
}, this.master.minimumUpdatePeriod); | ||
} | ||
|
||
this.updateMinimumUpdatePeriodTimeout_(); | ||
}); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also make sense to add the clearing of the old one here too.