question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

YouTube urls with `/embed/` in the url fail to embed

See original GitHub issue

Issue Summary

Using an Embed block in a streamfield, we are able to embed videos from youtube.com like this https://youtu.be/2MW6CrxScLk or like this https://www.youtube.com/watch?v=2MW6CrxScLk but not like this https://youtube.com/embed/2MW6CrxScLk

Steps to Reproduce

Grab a youtube url by clicking on a link that says “Embed”.

Technical details

  • Python version: 3.4
  • Django version: 1.11.
  • Wagtail version: 1.13.1
  • Browser version: Chrome 62 (but it’s a backend thing)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lb-commented, Dec 17, 2017

I have a working version (needs tests/docs before I put in a PR) of the templates idea.

See the revised oembed code here: https://github.com/lb-/wagtail/blob/4127_embed_youtube_url/wagtail/embeds/finders/oembed.py

A working template that here: https://github.com/lb-/wagtail/blob/e7b8315f80a68b7b07ff83dce43ee20fe5b48f52/wagtail/embeds/oembed_providers.py#L29-L31

Would love some feedback if it is worth adding this feature, happy to add tests / document this correctly.

0reactions
cjoshmartincommented, Mar 18, 2022

Hello y’all I was looking for answer for days but I found it here: https://docs.wagtail.org/en/stable/topics/writing_templates.html#responsive-embeds

for some reason it did not show up on google 🤔

Short of it is:

  1. in your base settings file add this WAGTAILEMBEDS_RESPONSIVE_HTML = True
  2. In the template file you are using the embed with add these styles:
.responsive-object {
    position: relative;
}

.responsive-object iframe,
.responsive-object object,
.responsive-object embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

and BOOM responsive embeddeds

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Video unavailable error on an embedded URL
Normal youtube link works, but embed link shows "Video Unavailable".
Read more >
Wagtail video embed fails for some YouTube URLs but not ...
A small portion of YouTube video URLs fail when attempting to embed, despite appearing to allow embedding. If I call get_embed directly, I...
Read more >
Youtube embed not working; instead get link View On The ...
I have been embedding Youtube Live stream video links in WP for a couple of years. And now this morning I am getting...
Read more >
The 5 most common errors when embedding videos - Mynd
If you insert your link without the "https://" part, you may receive the error message", The file or directory could not be found.”...
Read more >
Why is it when I enter a url for a Youtube Video to add to the ...
However when I add the video link I receive the error above. ... only accepts YouTube links, you can definitely still embed links...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found