Skip to content

Conversation

@peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Jul 24, 2025

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 (in core/fetchers) for the pending request only. The result is much more satisfying:

after.mp4

@peaBerberian peaBerberian added this to the 4.4.0 milestone Jul 24, 2025
@peaBerberian peaBerberian added the thumbnails Relative to image thumbnails label Jul 24, 2025
// 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;
Copy link
Collaborator Author

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);
Copy link
Collaborator Author

@peaBerberian peaBerberian Jul 24, 2025

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

@peaBerberian peaBerberian force-pushed the misc/store-pending-thumbnail-request branch 2 times, most recently from 8831149 to 394b54b Compare July 25, 2025 12:50
@canalplus canalplus deleted a comment from github-actions bot Jul 25, 2025
@canalplus canalplus deleted a comment from github-actions bot Jul 25, 2025
@peaBerberian peaBerberian force-pushed the misc/store-pending-thumbnail-request branch from 394b54b to 68e8549 Compare July 25, 2025 13:36
@github-actions
Copy link

✅ Automated performance checks have passed on commit 2a8a725c38773892a75a6a21b4a8c083ea3647bc with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 20.51ms -> 20.50ms (0.004ms, z: 0.89808) 28.35ms -> 28.35ms
seeking 19.97ms -> 13.96ms (6.008ms, z: 1.65895) 11.10ms -> 11.10ms
audio-track-reload 26.89ms -> 26.81ms (0.082ms, z: 1.05417) 39.30ms -> 39.30ms
cold loading multithread 47.76ms -> 46.85ms (0.917ms, z: 10.45026) 70.50ms -> 69.45ms
seeking multithread 53.23ms -> 57.92ms (-4.689ms, z: 0.28409) 10.20ms -> 10.05ms
audio-track-reload multithread 26.70ms -> 26.53ms (0.163ms, z: 1.47045) 39.00ms -> 39.00ms
hot loading multithread 16.35ms -> 16.24ms (0.108ms, z: 2.47928) 23.70ms -> 23.55ms

@peaBerberian peaBerberian force-pushed the misc/store-pending-thumbnail-request branch from 68e8549 to 3468357 Compare July 25, 2025 15:50
@github-actions
Copy link

✅ Automated performance checks have passed on commit 96008789fdce88bfdb586a2e005467efa2b9c606 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.97ms -> 20.26ms (-0.283ms, z: 0.46872) 27.75ms -> 27.60ms
seeking 15.23ms -> 18.61ms (-3.387ms, z: 0.67499) 11.10ms -> 11.10ms
audio-track-reload 26.31ms -> 26.42ms (-0.115ms, z: 0.40538) 38.55ms -> 38.55ms
cold loading multithread 46.69ms -> 45.90ms (0.788ms, z: 14.18823) 68.85ms -> 67.50ms
seeking multithread 43.83ms -> 35.15ms (8.675ms, z: 0.80734) 10.20ms -> 10.20ms
audio-track-reload multithread 26.10ms -> 26.00ms (0.101ms, z: 1.75663) 38.40ms -> 38.25ms
hot loading multithread 15.42ms -> 15.25ms (0.168ms, z: 5.27386) 22.35ms -> 22.05ms

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.
@peaBerberian peaBerberian force-pushed the misc/store-pending-thumbnail-request branch from 3468357 to 5c5b194 Compare July 31, 2025 13:37
@github-actions
Copy link

✅ Automated performance checks have passed on commit 824db25eec18af5861926f37feeb625ef59fb3ba with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.82ms -> 19.87ms (-0.050ms, z: 1.23960) 27.30ms -> 27.30ms
seeking 17.89ms -> 15.15ms (2.738ms, z: 0.42015) 11.10ms -> 10.95ms
audio-track-reload 26.16ms -> 26.29ms (-0.132ms, z: 1.26434) 38.25ms -> 38.40ms
cold loading multithread 46.57ms -> 45.84ms (0.725ms, z: 13.75311) 68.70ms -> 67.50ms
seeking multithread 42.49ms -> 35.10ms (7.383ms, z: 1.33772) 10.05ms -> 10.05ms
audio-track-reload multithread 26.01ms -> 25.94ms (0.067ms, z: 0.90536) 38.25ms -> 38.10ms
hot loading multithread 15.09ms -> 15.12ms (-0.028ms, z: 2.23806) 22.05ms -> 21.90ms

@peaBerberian peaBerberian merged commit 3366b99 into dev Jul 31, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

thumbnails Relative to image thumbnails

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants