在 react-player 中,如何禁用全屏按钮?

In react-player, how can I disable the FullScreen button?

这是我当前用于渲染 react-player 视频的代码

<div className="player">
                    <ReactPlayer url={result.url}
                                 playing={false}
                                 width={275}
                                 height={150}
                                 onPlay={playVideo}
                                 onEnded={stopVideo}
                                 onPause={pauseVideo}
                                 controls={true}
                    />
                </div>

您可以尝试将 controls 属性 设置为 false,但它可能会隐藏一些您不想隐藏的控件。

如果你的 url 是 Vimeo url,你可以尝试这样做:

<ReactPlayer
   url='http://vimeo.com/...'
   vimeoConfig={{ iframeParams: { fullscreen: 0 } }}
/>

如果是 youtube url 试试这个:

<ReactPlayer
    url='https://www.youtube.com/watch?v=mFJZ0HaYYB8'
    config={{
        youtube: {
             playerVars: { modestbranding: 1 }
        }
    }}
/>

查看 Config prop 部分下的 this page, it might help as well, or in the official component page :)

<ReactPlayer
      width={"100%"}
      height={"100%"}
      url="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"
      muted={true}
      playing={true}
      controls
      config={{
        file: {
          attributes: {
            controlsList: "nofullscreen",
          },
        },
      }}
    />