muxinc / media-chrome

Custom elements (web components) for making audio and video player controls that look great in your website or app.

Home Page:https://media-chrome.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detached HTMLVideoElements leaks when used with react

HermanBilous opened this issue · comments

Steps to reproduce:

  1. Modify examples/nextjs-with-typescript/pages/index.tsx by adding a button that mounts and unmounts e.g:
const [mounted, setMounted] = useState(false);
return (
....
      <button onClick={() => setMounted(prev => !prev)}>
          {mounted ? "Unmount": "Mount"}
      </button>
      {mounted && (<MediaController />)}
....
  1. Run example and open it in chrome.
  2. Click on button a few times to mount and unmount controller
  3. Create memory snapshot with devtools memory tab. Search for "video" in class filter

Actual result:
Observe a list that looks like this
image

Note: number of Detached HTMLVideoElements will be equal to number of times "unmount" is clicked + 1.

Expected result:
Only one Detached HTMLVideoElement is present in snapshots. Clicking on button won't change the number of Detached HTMLVideoElements.

thanks for reporting this! we will investigate

Double thank you @HermanBilous for the easy to repro report of this memory leak