Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAyub Muhammad
Courses Plus Student 4,345 PointsVideo not working
<video src="https://www.youtube.com/watch?v=SZjyk4fak2s" controls /> This is my video tag. But when I preview the video does not come up! Please help and explain why it is not working
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! As I understand it, YouTube does not support the playback of videos in this manner. To show the video you need to create an IFrame and have it play back the video with the code gotten from the video on YouTube. To do this, right-click the video in question and then copy the "embed code".
This should work for you:
<iframe width="600" height="400" src="https://www.youtube.com/embed/SZjyk4fak2s" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Hope this helps!