【问题标题】:Hide Something in Video in React在 React 中隐藏视频中的内容
【发布时间】:2021-06-27 01:38:10
【问题描述】:

我需要隐藏下图中圈出的图标吗?我该如何隐藏它?我正在使用react-player

请检查此代码框 CLICK HERE

<ReactPlayer
      url="https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"
      playing={true}
      volume={1}
      width="100%"
      height="100%"
      controls
/>

【问题讨论】:

    标签: html reactjs react-hooks html5-video react-player


    【解决方案1】:

    HTML5 &lt;Video /&gt; 标记支持通过 disablepictureinpicture 属性禁用此功能。这仍是一项实验性功能,可能不适用于所有浏览器。

    通过 ReactPlayer 的配置传递 disablePictureInPicture html 属性。如果画中画控件没有消失,请尝试设置controlsList: 'nodownload'

    const config = {
      attributes: {
        disablePictureInPicture: true,
        controlsList: 'nodownload'
      }
    };
    
    const App = () => (
      <div style={styles}>
        <ReactPlayer
          url="https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"
          playing={true}
          volume={1}
          width="100%"
          height="100%"
          config={config}
          controls
        />
        <h2>Start editing to see some magic happen {'\u2728'}</h2>
      </div>
    );
    

    【讨论】:

    • 你好。我已经在这里应用了它codesandbox.io/s/video-player-with-slider-forked-comoz。在第一个滑块上,它不会出现,但在第二个滑块上,它会出现
    • 这是一个实验性功能。更新的答案也解决了这个问题。
    • 好的。谢谢奥利
    • 你好。我在控制台中看到了这个错误。 Invalid DOM property disablepictureinpicture. Did you mean disablePictureInPicture
    • 欢迎您再次光临。这对我来说也很有教育意义:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-07
    • 1970-01-01
    相关资源
    最近更新 更多