0

我使用 react-player 并得到一个错误

<ReactPlayer
          width="100%"
          height="100%"
          autoPlay={false}
          url="https://www.youtube.com/embed/fAGToLx-cek"
          config={
            youtube: {
              playerVars: { showinfo: 1, controls: 1 },
            },}
        />

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('https://localhost').

生成代码 iframe

<iframe frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" width="100%" height="100%" src="https://www.youtube.com/embed/fAGToLx-cek?autoplay=0&amp;mute=0&amp;controls=1&amp;origin=https%3A%2F%2Flocalhost&amp;playsinline=1&amp;showinfo=1&amp;rel=0&amp;iv_load_policy=3&amp;modestbranding=1&amp;enablejsapi=1&amp;widgetid=1" id="widget2"></iframe>
4

0 回答 0