Skip to content

manifest.manifestUpdate event listeners been added many times for live events #1778

@KunXi-Fox

Description

@KunXi-Fox

Hi there,

I noticed that manifest.addEventListener('manifestUpdate', () => {}) been added for many times without clear previous listeners. Which will eventually lead to unexpected resource (CPU/Memory) usage.

Code block as below:

manifest.addEventListener(
"manifestUpdate",
(updates) => {
for (const element of updates.updatedPeriods) {
if (element.period.id === period.id) {
for (const updated of element.result.updatedAdaptations) {
if (updated.adaptation === adaptation.id) {
for (const rep of updated.removedRepresentations) {
if (rep === representation.id) {
if (fnCancelSignal.isCancelled()) {
return;
}
return callbacks.waitingMediaSourceReload({
bufferType: adaptation.type,
period,
timeOffset: 0,
stayInPeriod: true,
});
}
}
}
}
} else if (element.period.start > period.start) {
break;
}
}
},
fnCancelSignal,
);
}

Reproduce steps

  1. Make sure you're using single mode
  2. Play any live events
  3. Check rxPlayerInstance._priv_contentInfos.manifest._listeners.manifestUpdate been increased timely
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions