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

Load Latency Stats When Using PreloadManager #6871

Closed
yyamaguchi93 opened this issue Jun 20, 2024 · 3 comments · Fixed by #6890 or #6724
Closed

Load Latency Stats When Using PreloadManager #6871

yyamaguchi93 opened this issue Jun 20, 2024 · 3 comments · Fixed by #6890 or #6724
Assignees
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@yyamaguchi93
Copy link

Have you read the Tutorials?
Yes

Have you read the FAQ and checked for duplicate open issues?
Yes

If the question is related to FairPlay, have you read the tutorial?

N/A

What version of Shaka Player are you using?
v4.9.3

What browser and OS are you using?
MacOS Sonoma 14.5 Chromium

Please ask your question
It seems that the load latency statistics are misleading when the PreloadManager is used to load the player. Specifically, if there is a delay between when the preload is initiated and when the PreloadManager is actually loaded into the player, the load latency is significantly increased. This behavior does not align with the comment in stats.js.

  /**
   * Record the time it took between the user signalling "I want to play this"
   * to "I am now seeing this".
   *
   * @param {number} seconds
   */
  setLoadLatency(seconds) {
    this.loadLatencySeconds_ = seconds;
  }

Is this discrepancy intentional? I rely on the load latency from player.getStats() to monitor the player's performance and expected to see improved load latency when using preload.

Here is a pseudo code example demonstrating the issue:

await player.load(...);
preloadMgr = await player.preload(...);
await sleep(5); // Simulating a delay
await player.load(preloadMgr);
await waitForEvent("loadedmetadata");
player.getStats().loadLatency; // preload start time - loadedmetadata event time

Could you clarify how load latency should be interpreted when using the PreloadManager and whether there are any plans to adjust this metric to better reflect the intended timing?

@yyamaguchi93 yyamaguchi93 added the type: question A question from the community label Jun 20, 2024
@avelad
Copy link
Member

avelad commented Jun 20, 2024

@theodab can you review it? Thanks!

@shaka-bot
Copy link
Collaborator

@yyamaguchi93 Does this answer all your questions? If so, would you please close the issue?

@shaka-bot shaka-bot added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 24, 2024
@avelad avelad removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jun 24, 2024
@theodab
Copy link
Contributor

theodab commented Jun 24, 2024

That's a good point. It probably makes more sense to start measuring the load latency from when the preload manager is used by load, rather than from when it is made.
I'll make a PR for it.

@avelad avelad added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround and removed type: question A question from the community labels Jun 24, 2024
@avelad avelad added this to the v4.10 milestone Jun 24, 2024
theodab added a commit to theodab/shaka-player that referenced this issue Jun 24, 2024
Previously, when preloading, we would measure startTimeOfLoad based
on when the PreloadManager was created.
This meant that if a PreloadManager was created and then not used
for a while, it would lead to the load latency stats reporting an
extreme load latency.
This changes the startTimeOfLoad to instead record when the
PreloadManager is consumed by the player.

Fixes shaka-project#6871
@avelad avelad closed this as completed in 878bf62 Jun 24, 2024
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Aug 23, 2024
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
4 participants