在React组件中,我有一个iframe:
<iframe
css={styles.videoIframe}
width="853"
height="480"
src={embedlink}
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title={title}
/>当我检查DOM时,我看到src已更改为data-src
<iframe width="853" height="480" data-src="http://www.youtube.com/embed/youtube-id-here" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" title="The title"></iframe>我看不到呈现的嵌入式YouTube视频?这可能是因为将属性更改为data-src
发布于 2021-02-17 20:17:34
为此,我最终使用了无cookie嵌入。将我的embed变量更改为:
const embedLink = `https://www.youtube-nocookie.com/embed/${youtubeId}`;另请参阅this应答。
https://stackoverflow.com/questions/66240349
复制相似问题