#41201 closed defect (bug) (fixed)
Youtube Embed URL is not working in video widget
Reported by: | kakshak | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.8 |
Component: | Media | Keywords: | has-screenshots has-patch |
Focuses: | Cc: |
Description
This problem occurs when you try to upload the embed youtube video URL in video widget. The video widget is working fine with other Youtube and Vimeo URLs but it's not working with only embed link of youtube.
Below is the screenshot attached.
Attachments (1)
Change History (27)
#1
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#3
@
7 years ago
- Component changed from Media to General
- Resolution duplicate deleted
- Status changed from closed to reopened
Hello @swissspidy
Thanks for looking into it.
It's not the duplicate of #41186 ticket. Because the ticket says "youtu.be" URL is not working. But actually, it's working for "youtu.be".
The widget is not working for only embed youtube URL. Other than that it's working fine.
Please look over it.
Thanks,
Kakshak
#4
@
7 years ago
- Component changed from General to Media
- Keywords has-screenshots added
- Milestone set to Awaiting Review
I can confirm that inserting YouTube embed URLs doesn't work here, nor does it work when adding media in the post editor.
#5
@
7 years ago
- Keywords needs-patch added
Hello @DrewAPicture
Thanks for looking into it.
Please confirm that YouTube embed URLs are not working.
Thank you.
This ticket was mentioned in Slack in #core by kakshak. View the logs.
7 years ago
#7
@
7 years ago
- Keywords close added
The reason for this is that the /embed/
endpoint is intended as a link to the actual video player source, and as such does not have oEmbed discovery on YouTube's end.
I would say it's expected behavior that we can't embed it since discovery doesn't exist, to sort it we would have to start stripping content from URLs and re-testing, I feel like we shouldn't be modifying the URLs a user supplies?
In light of this being expected behavior from the YouTube side of things, I'm in favor of wontfix
.
#8
@
7 years ago
- Keywords close removed
How are you getting this URL? It seems a bit unusual for a user to paste this.
Still, it definitely seems like something we can fix.
#9
@
7 years ago
- Keywords close added
The close
keyword was removed accidentally due to an edit conflict.
#10
@
7 years ago
The process of getting the embed URL is not straight forward, so far I only know of one place to get it:
- Go into the video of your chosing
- Select Share
- Pick
Embed
as the share method - Manually copy the
src
attribute from the iframe string
#11
@
7 years ago
- Keywords needs-patch removed
- Version 4.8 deleted
As far as I know, Youtube embed URLs, for clarity: the ones with "embed" in the URL e.g. https://www.youtube.com/embed/FclScfPoKes are not supposed to work in the media, not even when inserting media in a post. Only the following Youtube URL types are supported:
youtube.com/watch...
youtube.com/playlist...
youtu.be/...
This ticket was mentioned in Slack in #core-customize by melchoyce. View the logs.
7 years ago
#13
@
7 years ago
Thanks for reporting this issue @kakshak. While working on the media widgets, one test we typically did was try to emulate the support of external URL formats as they work within the editor and/or the medial modal. In this scenario, using the https://www.youtube.com/embed/FclScfPoKes
embed URL via a paste in the editor, or in the media modal both render the oembed as expected.
As such, I think we should support this embed format within the video widget too.
#14
@
7 years ago
https://www.youtube.com/embed/FclScfPoKes embed URL via a paste in the editor, or in the media modal both render the oembed as expected.
Not for me: doesn't work in the media modal, and I think it is not expected to work:
It does work when pasting in the editor, I think that is not expected ;)
#15
@
7 years ago
Hello @timmydcrawford
Yes, I also think that youtube embed URL should have to work in both (posts as well as in video widget).
#17
@
7 years ago
@kakshak sorry maybe I was not clear. The Youtube URLs with embed
are not allowed at the moment. The only one that should be allowed are listed here:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-oembed.php?marks=58,59,60#L55
The fact that it is working when pasting in the editor, it's arguable :)
#18
@
7 years ago
@afercia so you think we should not support the embed URL in this context? Even though it does work in the media modal and editor?
#19
follow-up:
↓ 20
@
7 years ago
@timmydcrawford it doesn't work in the media modal for me. Does it really work for you?
#20
in reply to:
↑ 19
@
7 years ago
Replying to afercia:
@timmydcrawford it doesn't work in the media modal for me. Does it really work for you?
So to clarify a bit, the preview in the media modal does not work, but you are still able to "insert" the embed URL in to the editor, and the embed is displayed as expected there.
Screen grab of the media modal insertion: https://cloudup.com/cIYzO8hiIc4
During this process, a 404 is returned from the oembed proxy endpoint, this is as expected due to the logic you listed above: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-oembed.php?marks=58,59,60#L55
FWIW, using the YouTube embed URL within the YouTube block in Gutenberg behaves the same was as the video widget... since it too uses to oembed/proxy endpoint which 404's on these embed URLs, the process fails there too.
So to fully "fix" this, we would have to add an embed url regex to the $providers
array.
#21
@
7 years ago
@timmydcrawford thanks for your investigation! :) Adding it to the providers list makes sense to me at first sight, so +1, but I'm definitely not an expert.
#22
@
7 years ago
So I apologize I spoke too soon on the simplicity of adding support for the embed url. It appears YouTube itself does not support using the embed url when making requests to their oembed endpoint. Take for example the following video:
url: https://www.youtube.com/watch?v=ea2WoUtbzuw
share url: https://youtu.be/ea2WoUtbzuw
embed url: https://www.youtube.com/embed/ea2WoUtbzuw
The first two URL's work properly against YouTube's oembed endpoint, which is what is ultimately called by WP_oEmbed->fetch
url: https://www.youtube.com/oembed?maxwidth=600&maxheight=788&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dea2WoUtbzuw
share: https://www.youtube.com/oembed?maxwidth=600&maxheight=788&url=https%3A%2F%2Fyoutu.be%2Fea2WoUtbzuw
Both return valid oembed objects, but using the embed url does not:
The URL is filterable via https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-oembed.php?#L505 so one route would be to watch for these embed URLs and transform them to the share url format, or standard YouTube url format. But to me that kind of feels hackish.
This is just like what happens in as @swissspidy pointed out in slack.
So after all of that, I'm kind of thinking that since the embed URLs are not supported by YouTube in the context of their oembed endpoint, not certain if we should support it either.
#23
@
7 years ago
PR with proposed fix at https://github.com/xwp/wordpress-develop/pull/242
#24
@
7 years ago
- Keywords has-patch added; close removed
- Milestone changed from Awaiting Review to 4.9
- Owner set to westonruter
- Status changed from reopened to accepted
- Version set to 4.8
#25
follow-up:
↓ 26
@
7 years ago
- Resolution set to fixed
- Status changed from accepted to closed
In 41179:
Duplicate of #41186.
Hi, and welcome to Trac!
This has recently been reported already, so I'm closing this ticket as a duplicate.