-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow async modifications to requests. #3957
Comments
Duplicate of #3758. @ElasticPencil Is this something you can work on and provide as a pull request? |
I will look into when I get time to focus on our improved video playback. |
Here is a PR with a potential solution, which I've tested locally and verified it works. (Hide the whitespace to see the changes more clearly): https://github.com/Dash-Industry-Forum/dash.js/pull/4024/files?diff=unified&w=1 @dsilhavy To avoid trashing too many files, this solution adds a new optional method to the
I'm open to feedback. |
I left some comments in the PR. I like the pattern you implemented. With regards to the stats, I don't have a strong opinion. I think it is a little odd that the time is started before synch modifiers but doesn't include async modifiers. That said I don't think it will affect the system overall. It may be better to leave it the way it is. One thing that could be done, is move the timing before, but don't call the utility modifyRequest unless there is a handler setup. This would mean the time effectively wouldn't change for existing code. It would only be impacted when a modifyRequest handler was added. |
Implemented, sample available here: https://reference.dashif.org/dash.js/nightly/samples/advanced/extend.html |
Is your feature request related to a problem? Please describe.
When requesting videos from the service we need to provide an authorization header. This is a standard Bearer token and it has a reasonably short lifetime (1 hour). When we begin playing we may have a valid token but it can expire while playing and requesting new buffers requires a new token. This means we need to make an initial request to refresh the token.
Describe the solution you'd like
Allowing request modifiers to return a promise, or passing in a callback that can be used to signal the modification is complete would allow this type of behavior.
Describe alternatives you've considered
The only alternative I know would be to generate a new token just before playing and pre-generate new ones before the time comes up.
The text was updated successfully, but these errors were encountered: