Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video stream isn't closed on Player component removal #1478

Open
bdvorianov opened this issue Jul 18, 2022 · 7 comments
Open

Video stream isn't closed on Player component removal #1478

bdvorianov opened this issue Jul 18, 2022 · 7 comments

Comments

@bdvorianov
Copy link

bdvorianov commented Jul 18, 2022

Current Behavior

Video stream isn't closed when we stop player and remove component.

Expected Behavior

Component either closes the stream on removal phase or has the method for this.

Steps to Reproduce

  1. Open player with video stream and remove component.
  2. Check in network that stream still fetches the video.

Environment

Nothing special about environment. Current machine I have this one is: MacBook Pro M1, Chrome. But this can be found on demo page of this project as well. UPD. It occurs with FLV.

@kutuzovpetia
Copy link

Have the same behaviour, this seem critical

@Knyazik01
Copy link

faced this issue for flv format

@DevTakao
Copy link

Having the same issue with webm-format HTTP streams. The connection doesn't close even if I reset the url to empty state inside useEffect() return as an unmount cleanup.

@hellofrontendxxx
Copy link

I have the same problem, has anyone fixed this?

@alolis
Copy link

alolis commented Feb 21, 2025

Any luck with this?

@knewman23
Copy link

Also having the same issue

@knewman23
Copy link

Setting the src on the video element seems to work as a workaround, we were using this in a modal so we set the src on close

onClose={() => {
       // try to stop an MP4 video from playing when the modal closes
       // react-player doesnt have a way to pass id so we get the video tag here
       const videoElem = hdVideoRef?.current?.wrapper?.lastChild;
       if (videoElem && videoElem.src) {
           videoElem.src = '';
       }
    ...
}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants