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

FilePlayer: Autoplay attribute is changing every time the user click on play/pause button.

Open hamanovich opened this issue 2 years ago • 3 comments

Current Behavior

When you use FilePlayer (html5) each time the user click on play - autoplay attribute is added. And versa, clicking in pause - autoplay attribute is removed.

Expected Behavior

Autoplay attribute should not rely on 'playing' props.

Steps to Reproduce

It even reproduces on official demo page

  1. Go to https://cookpete.com/react-player/
  2. Click on controls (to ensure you can manipulate with built-it buttons)
  3. Choose mp4 format
  4. Look at the console: autoplay attribute is added every time you click on play button and removed when you pause video.

If I look at the code, I see in file https://github.com/cookpete/react-player/blob/master/src/players/FilePlayer.js line 359 autoPlay={playing || undefined}, which does exactly what was described. However, this is not how autoplay should work by default.

It cause many issues with analytics tracking, when you have lazy video loading and disabled autoplay. User clicks on play - autoplay attribute is added.

hamanovich avatar Aug 03 '23 11:08 hamanovich