我使用 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&mute=0&controls=1&origin=https%3A%2F%2Flocalhost&playsinline=1&showinfo=1&rel=0&iv_load_policy=3&modestbranding=1&enablejsapi=1&widgetid=1" id="widget2"></iframe>