Skip to content

Commit

Permalink
Clear list of resource timing entries once buffer is full (#4263)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy authored Aug 17, 2023
1 parent 7b8f9fb commit fddf65d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/streaming/controllers/ThroughputController.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,28 @@ function ThroughputController() {

function _registerEvents() {
eventBus.on(MediaPlayerEvents.METRIC_ADDED, _onMetricAdded, instance);

if (performance) {
performance.addEventListener(
'resourcetimingbufferfull',
_onResourceTimingBufferFull,
);
}
}

function _resetEvents() {
eventBus.off(MediaPlayerEvents.METRIC_ADDED, _onMetricAdded, instance);

if (performance) {
performance.removeEventListener(
'resourcetimingbufferfull',
_onResourceTimingBufferFull,
);
}
}

function _onResourceTimingBufferFull() {
performance.clearResourceTimings();
}

/**
Expand Down

0 comments on commit fddf65d

Please sign in to comment.