Corporal
Corporal

Reputation: 157

Embedding Youtube video in an iframe

I am working on a web application in which I have to embed a youtube video related to a specific key word in an iframe. I am using the following HTML code for it:

<iframe id="ytplayer" type="text/html" width="640" height="360"
    src="https://www.youtube.com/embed/?listType=search&list=essay"
    frameborder="0" allowfullscreen>

When I run the code video is not loaded in the ifame. Can anyone let me know whats wrong with this code?

Upvotes: 0

Views: 1354

Answers (2)

Tharaka Nuwan
Tharaka Nuwan

Reputation: 782

<iframe width="640" height="360" src="//www.youtube.com/embed/nWqMQ26Gqi4" frameborder="0" allowfullscreen></iframe>

this is your video and this will work fine. your code is ok. but browser is the problem. most probably in firefox your video will work. but my code will work anyware.

If you want to add dynamic address to play use this

<iframe width="320" height="240" src="http://www.youtube.com/embed/'. $vedio_id.'?autoplay=1" frameborder="0"></iframe>

where $vedio_id is your dynamic word.

Upvotes: 1

daR
daR

Reputation: 250

try this :

  <iframe width="640" height="360"      
     src="//www.youtube.com/embed/sLAEg5aTXAE?feature=player_detailpage"
     frameborder="0" allowfullscreen>
 </iframe>

Upvotes: 0

Related Questions