Skip to content

Commit

Permalink
fix: Calculate timeToFirstByte before fire the event 'downloadheaders…
Browse files Browse the repository at this point in the history
…received' (#7605)

Fixes #7604
  • Loading branch information
vlazh authored Nov 15, 2024
1 parent d8a14b0 commit 0fc5316
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/net/networking_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,12 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
}
};
const headersReceived = (headers) => {
if (this.onHeadersReceived_) {
this.onHeadersReceived_(headers, request, type);
}
headersReceivedCalled = true;
request.timeToFirstByte = Date.now() -
/** @type {number} */ (request.requestStartTime);
if (this.onHeadersReceived_) {
this.onHeadersReceived_(headers, request, type);
}
};
request.requestStartTime = Date.now();

Expand Down

0 comments on commit 0fc5316

Please sign in to comment.