diff --git a/lib/net/networking_engine.js b/lib/net/networking_engine.js index b9cb20d55c..15e8257204 100644 --- a/lib/net/networking_engine.js +++ b/lib/net/networking_engine.js @@ -565,12 +565,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();