嵌入的YouTube代码无法在HTML中使用 [英] Embed Youtube code is not working in HTML
问题描述
我正在尝试在HTML中使用嵌入的youtube代码,但是当我按播放按钮时,它说该视频不可用".我正在使用以下HTML代码:
I am trying to use embed youtube code in HTML but when I press play button it say "This video is unavailable". I am using the following HTML code for it:
<iframe width="560" height="315" src="https://www.youtube.com/embed/JfJYHfrOGgQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
有人可以帮我吗?我也尝试了其他嵌入的youtube视频,但仍然说了同样的话.我正在使用Chrome.
Can anyone help me out with this? I have tried other embed youtube videos too, still says same thing. I am using Chrome.
推荐答案
我最近遇到了同样的问题,与视频所有者的嵌入设置无关.显然,YouTube禁止在没有公共域的情况下将某些视频嵌入到本地主机环境中,但是您可以通过公共域/子域完全嵌入视频:将@PStarczewski的答案中JSFiddle中的src值替换为视频链接,它将工作正常.
I had the same issue recently and it had nothing to do with video owners embedding settings. Apparently YouTube forbids embedding some videos in a localhost environment without a public domain, but your video can be embedded with no issue whatsoever through a public domain/subdomain: Replace the src value in the JSFiddle from @PStarczewski's answer with your video link and it will work properly.
这篇关于嵌入的YouTube代码无法在HTML中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!