如何在播放mp4文件时修改React Player的控件。我希望禁用下载选项
How to modify the controls of React Player while playing the mp4 file. I want the option of getting downloaded be disabled
I want to remove the option of the marked circle in the image from the player so that video can't be downloaded
您可以将controlsList="nodownload"
添加到video
元素,下载按钮将在Chrome中消失。
请记住,如果人们确实愿意,他们仍然可以下载视频。另一个预防措施是禁止右键单击视频元素:
<ReactPlayer
// Disable download button
config={{ file: { attributes: { controlsList: 'nodownload' } } }}
// Disable right click
onContextMenu={e => e.preventDefault()}
// Your props
url="https://media.w3.org/2010/05/sintel/trailer_hd.mp4"
className="react-player"
controls
width="100%"
height="100%"
/>
I want to remove the option of the marked circle in the image from the player so that video can't be downloaded
您可以将controlsList="nodownload"
添加到video
元素,下载按钮将在Chrome中消失。
请记住,如果人们确实愿意,他们仍然可以下载视频。另一个预防措施是禁止右键单击视频元素:
<ReactPlayer
// Disable download button
config={{ file: { attributes: { controlsList: 'nodownload' } } }}
// Disable right click
onContextMenu={e => e.preventDefault()}
// Your props
url="https://media.w3.org/2010/05/sintel/trailer_hd.mp4"
className="react-player"
controls
width="100%"
height="100%"
/>