html - 无法使用 YouTube 中的链接播放视频

标签 html video youtube

这个问题在这里已经有了答案:





Show Youtube video source into HTML5 video tag?

(8 个回答)



Unable to load youtube video using <video> tag where youtube url is inputted in textfield

(3 个回答)


1年前关闭。




我无法播放视频,链接取自 YouTube,代码如下:

<!DOCTYPE html>
<html>
  <head>
    <title>Audio & Video</title>
  </head>
  <body>  
    <h1></h1>  

    <video src="https://www.youtube.com/watch?v=Et2HGG_Hfdk&t=3s" controls autoplay>  
     Your Browser Does Not Support the Video Format   
    </video>

  </body>
</html>

最佳答案

这不是嵌入 YouTube 视频的正确方法。
您需要使用 YouTube 的官方嵌入方法,如下所示:

<iframe src="https://www.youtube.com/embed/Et2HGG_Hfdk?start=3" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

关于html - 无法使用 YouTube 中的链接播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63760766/

相关文章:

html - CSS 元素选择器比 HTML 属性更具体?

video - 如何连接具有不同属性的ffmpeg中的视频?

swift - 无法使用 swift 2 AVPlayerViewController 流式传输视频

ruby-on-rails - Youtube网络摄像头小部件-抓取VideoID

javascript - 播放嵌入式 youtube 视频 JS

html - Div ul 列表 css 菜单

php laravel 解析错误 : syntax error, 意外 'return' (T_RETURN)

python-3.x - ImageIO 中的质量损失

json - 405方法不允许-尝试使用Mootools从Youtube检索JSON提要的Firebug错误

javascript - 单击时更改搜索栏的位置