0

I am unable to play the video, the link was taken from YouTube, the code is as follows:

<!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>
nourza
  • 2,215
  • 2
  • 16
  • 42

3 Answers3

2

That is not the correct way to embed a YouTube video.

You need to use YouTube's official embedding method, which would look like this:

<iframe src="https://www.youtube.com/embed/Et2HGG_Hfdk?start=3" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Moshe Katz
  • 15,992
  • 7
  • 69
  • 116
0

Check this out. You can put your youtube video inside iframe

<iframe width="560" height="315" src="https://www.youtube.com/watch?v=Et2HGG_Hfdk&t=3s" frameborder="0" autoplay allowfullscreen></iframe>
nourza
  • 2,215
  • 2
  • 16
  • 42
0

You need to embed the video in html using iframe

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

for more information on embedding youtube videos follow the link https://developers.google.com/youtube/youtube_player_demo

Lakshmipathi
  • 121
  • 3
  • 13