-
Notifications
You must be signed in to change notification settings - Fork 136
Thumbnails: Cache pending thumbnail request #1718
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
Conversation
| // load thumbnail after a timer to avoid doing too many requests when the | ||
| // user quickly moves its pointer or whatever is calling this | ||
| loadThumbnailTimeout = window.setTimeout(() => { | ||
| loadThumbnailTimeout = null; |
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.
Here I just moved the setTimeout so it only applies to when the thumbnail is loaded through the VideoThumbnailLoader
| cmcdPayload: undefined, | ||
| }; | ||
|
|
||
| log.debug("TF: Beginning thumbnail request", thumbnail.time); |
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.
Everything here moved to the new doFetch inner function
8831149 to
394b54b
Compare
394b54b to
68e8549
Compare
|
✅ Automated performance checks have passed on commit DetailsPerformance tests 1st run outputNo significative change in performance for tests:
|
68e8549 to
3468357
Compare
|
✅ Automated performance checks have passed on commit DetailsPerformance tests 1st run outputNo significative change in performance for tests:
|
When I demoed how DASH thumbnail worked in the RxPlayer demo, I was unhappy to realize that there was a noticeable delay when quickly moving the mouse over the seekbar. This is both because we have a timer in our demo of a few milliseconds before doing the actual thumbnail request, and even much more importantly because the RxPlayer cancel the last thumbnail request when the application decides to fetch one from a new position instead. Yet positions that are sufficiently close (which is frequent when moving the mouse over a seekbar) are often going to lead to the same thumbnail request. Here cancelling the last one is unfortunate: we should reuse the same request. --- We already have a thumbnail cache but sadly enough it is only populated once the request is done. If the request is still pending and an application ask a thumbnail for a new position, we're going to run a new request even if it leads to the same thumbnail. Our "last loaded" cache was in main thread, which does not even know the relation between the wanted time and the corresponding thumbnail, so this new logic cannot be added there. Instead I added another level of "cache" in our `ThumbnailFetcher` (in `core/fetchers`) for the pending request only. The result is much more satisfying.
3468357 to
5c5b194
Compare
|
✅ Automated performance checks have passed on commit DetailsPerformance tests 1st run outputNo significative change in performance for tests:
|
When I demoed how DASH thumbnails worked in the RxPlayer demo, I was unhappy to realize that there was a noticeable delay when quickly moving the mouse over the seekbar.
thumb-before.mp4
Video: how thumbnails displayed before in our demo page. It's slow and, especially for
tile5, we can see that it's requested multiple times.This is both because we have a timer in our demo of a few milliseconds before doing the actual thumbnail request, and even much more importantly because the RxPlayer cancel the last thumbnail request when the application decides to fetch one from a new position instead.
Yet positions that are sufficiently close (which is frequent when moving the mouse over a seekbar) are often going to lead to the same thumbnail request. Here cancelling the last one is unfortunate: we should reuse the same request.
We already have a thumbnail cache but sadly enough it is only populated once the request is done. If the request is still pending and an application ask a thumbnail for a new position, we're going to run a new request even if it leads to the same thumbnail.
Our "last loaded" cache was in main thread, which does not even know the relation between the wanted time and the corresponding thumbnail, so this new logic cannot be added there.
Instead I added another level of "cache" in our
ThumbnailFetcher(incore/fetchers) for the pending request only. The result is much more satisfying:after.mp4