HTML: trying to embed youtube video

五迷三道 提交于 2020-12-13 04:32:09

问题


When I'm embedding a Youtube video into my website, the following error occurs:

An error occurred. Please try again later. (Playback ID: 044VSn6cAs2PR3y3) Learn More

My index.html contains the following markup snippet:

<div class="mu-about-us-right">
    <a id="mu-abtus-video" href="https://www.youtube.com/embed/watch?v=lWz-46NPqdk" target="youtube-video">
        <img src="assets/img/about-us.jpg" alt="img">
    </a>
</div>

I can't understand what is the error in my code. I have tried with some other videos as well so it's not a fault of Youtube server.

PS: I'm running my website on localhost


回答1:


Try embedding the video using an iframe like so:

<div class="mu-about-us-right">
   <iframe width="560" height="315" src="https://www.youtube.com/embed/lWz-46NPqdk" frameborder="0" allowfullscreen></iframe>
</div>

You can't use an anchor tag to embed videos.




回答2:


My browsers were blocking the embedded content until I used this extension.


Install

pip install sphinxcontrib.yt

conf.py

extensions = [
    , 'sphinxcontrib.yt'
]

file.rst

.. youtube:: bmbnPvSHcu4


来源:https://stackoverflow.com/questions/55556087/html-trying-to-embed-youtube-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!