0

I am trying to include videos in my react project for that I am using ReactPlayer by cookpete.

Now the problem is it doesn't correctly parses or make us of, whatever, the url of the video inside the browser's html video tag where in the src attribute I can see src(unknown) is written. The weird thing is it once in a while behaves normally as it is expected to do. When I change the src attribute's value to the video's URL manually by inspecting the browsers html it starts getting played and I can do normal stuff with it. Here is the code which I have written.

<ReactPlayer
            playing={isPlaying}
            url="https://media.w3.org/2010/05/sintel/trailer_hd.mp4"
            width="100vw - 69vw"
            height="100vh - 65vh"
          />

The isPlaying stuff is a boolean which is being mantained inside React.useState() with intial value set to false.

  • Is working fine for me. weird. Check if you can find anything here: https://github.com/cookpete/react-player/issues/1165 – anurag-dhamala Nov 19 '22 at 16:12
  • I can't find I can't find anything similar here. – Ishtiaq Naqi Nov 19 '22 at 16:47
  • Those width and height values don't seem to be valid. – jme11 Nov 19 '22 at 23:06
  • @jme11 Nope they are perfectly fine – Ishtiaq Naqi Nov 24 '22 at 16:51
  • @IshtiaqNaqi I still don't understand the width and height values you're supplying. Can you point to something to explain them? – jme11 Nov 25 '22 at 15:35
  • @jme11 I wanted the mini player to take 31% of the total width of the screen viewing my app and the same about height 35% of the screen height, therefore I used the metrics to achieve my goal, they are working perfectly fine for me. Is there any problem using them? – Ishtiaq Naqi Nov 26 '22 at 18:00

1 Answers1

1

The issue is a bug with React.StrictMode. A url with .mp4 extension isn't reloaded on the second reload induced by StrictMode.

jme11
  • 17,134
  • 2
  • 38
  • 48