Problems embedding YouTube videos

Hi there!

I’m building a course in GitHub using Course-in-a-Box, and I’m having trouble embedding some YouTube videos. I’ve tried copying and pasting the available code in the “Markdown & Media” submodule, and I end up with a message that “YouTube refused to connect” on my course page. Is something broken? Is there something extra I need to do? This is all very new, so I’m unsure what I even need to troubleshoot.

Thanks all!

Hi Heidy!

I think I found the problem—the URL to the YouTube video needs to be changed from the normal website link to the “embed” version. If you generate the embed code directly from YouTube, it does this for you, but if you copy the text from Course-in-a-Box and replace only the URL, that might be why you’re seeing that error. (So confusing! We’ll update the documentation to cover this.)

Example: instead of using this URL in the embed code in your site
https://www.youtube.com/watch?v=XGCTtDgNty4

Manually replace watch?v= with embed/ so you’re using the following url instead:
https://www.youtube.com/embed/XGCTtDgNty4

I think that should fix it! Let me know if it doesn’t and I’ll send someone more technically-inclined to answer your question. :stuck_out_tongue: Your course is looking great so far!

1 Like