react-player icon indicating copy to clipboard operation
react-player copied to clipboard

Changing the URL Not Clears Older Media New and Old Media Plays at the Same Time on React 19

Open e-senturk opened this issue 1 year ago • 3 comments

Current Behavior React Player is not switching audio; instead, it starts a new audio instance and also plays old audio at the same time. It happens %80 of the time sometimes it works as intended.

Expected Behavior Audio should switch every time I switch the url variable.

Steps to Reproduce

  1. It was working before I just updated to react 19 It was working perfectly before.
  2. Downgrading solves the issue.

Environment URL attempting to play: Internal URL addresses contain a wav file. Browser: Google Chrome 131.0.6778.205 Operating system: OSX 15.1.1

e-senturk avatar Dec 31 '24 06:12 e-senturk

Experiencing this as well. Makes loading direct links to files and local files practically unusable.

hauxir avatar Jan 04 '25 22:01 hauxir

Experiencing this as well. Are you both using Next.JS?

dawi avatar Jan 07 '25 11:01 dawi

I am using vanilla React

e-senturk avatar Jan 30 '25 17:01 e-senturk

Is this still an issue in v3? Could you provide a Codesandbox or similar, thanks!

luwes avatar Jun 27 '25 22:06 luwes

`js

const closeModal = () => {

   setURlToPlayer(undefined);

   setPlaying(false);

   setPlayerKey(`${props.camera?.name}_stop`);

   props.closeModal();

}

`

<MediaPlayerComp key={playerKey} muted={muted} type={type} playing={playing} style={{ width: "40em" }} ref={setPlayerRef} label={labelPlayerText} source={urlToPlayer} />

An example of my use of the component in a React application (Vite), when closing a modal window I want to stop the HLS, but the sound continues and the player plays the video, even if the player is visually destroyed, how exactly to stop the broadcast?

SupershadowTH avatar Sep 08 '25 12:09 SupershadowTH

@SupershadowTH just pause and remove the src before closing the modal.

luwes avatar Sep 19 '25 18:09 luwes