595👍
You must ensure the URL contains embed rather watch as the /embed
endpoint allows outside requests, whereas the /watch
endpoint does not.
<iframe width="420" height="315" src="https://www.youtube.com/embed/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>
91👍
The YouTube URL in src
must have and use the embed
endpoint instead of watch
, so for instance let’s say you want to embed this YouTube video: https://www.youtube.com/watch?v=P6N9782MzFQ
(browser’s URL).
You should use the embed
endpoint, so the URL now should be something like https://www.youtube.com/embed/P6N9782MzFQ
. Use this value as the URL in the src
attribute inside the iframe tag in your HTML code, for example:
<iframe width="853" height="480" src="https://www.youtube.com/embed/P6N9782MzFQ" frameborder="0" allowfullscreen ng-show="showvideo"></iframe>
So just replace https://www.youtube.com/watch?v=
with https://www.youtube.com/embed/
and of course check for your video’s ID. In this sample, my video ID is P6N9782MzFQ
.
- [Django]-In Django 1.4, do Form.has_changed() and Form.changed_data, which are undocumented, work as expected?
- [Django]-How do I match the question mark character in a Django URL?
- [Django]-Django FileField upload is not working for me
28👍
You only need to copy <iframe> from the YouTube Embed section (click on SHARE below the video and then EMBED and copy the entire iframe).
- [Django]-Django.contrib.auth.logout in Django
- [Django]-Can I access constants in settings.py from templates in Django?
- [Django]-How to combine multiple QuerySets in Django?
5👍
If embed no longer works for you, try with /v
instead:
<iframe width="420" height="315" src="https://www.youtube.com/v/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>
- [Django]-Django middleware difference between process_request and process_view
- [Django]-How to combine multiple QuerySets in Django?
- [Django]-Django models.py Circular Foreign Key
2👍
Along with the embed, I also had to install the Google Cast extension in my browser.
<iframe width="1280" height="720" src="https://www.youtube.com/embed/4u856utdR94" frameborder="0" allowfullscreen></iframe>
- [Django]-Explicitly set MySQL table storage engine using South and Django
- [Django]-Best practice for Django project working directory structure
- [Django]-Django development IDE