React-player: Support for `controlsList` attribute missing

Created on 11 Sep 2017  路  2Comments  路  Source: cookpete/react-player

As I would like to prevent showing the download icon in the player, I need to add controlsList='nodownload' attribute to <video> element. As far as I can see, there is no support for this right now...

Most helpful comment

You can use the config prop to add additional attributes to the file player:

<ReactPlayer
  url='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
  controls
  config={{ file: { attributes: { controlsList: 'nodownload' }}}}
/>

However, controlsList is currently stripped by React and so this will only work when https://github.com/facebook/react/issues/9594 lands, which apparently will be in 15.6.2. Until then this will not work, and there is a console warning:

Warning: Unknown prop controlsList on <video> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

All 2 comments

You can use the config prop to add additional attributes to the file player:

<ReactPlayer
  url='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
  controls
  config={{ file: { attributes: { controlsList: 'nodownload' }}}}
/>

However, controlsList is currently stripped by React and so this will only work when https://github.com/facebook/react/issues/9594 lands, which apparently will be in 15.6.2. Until then this will not work, and there is a console warning:

Warning: Unknown prop controlsList on <video> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

Thanks, Pete!

Was this page helpful?
0 / 5 - 0 ratings