Opened 3 years ago
Last modified 5 days ago
#15490 new enhancement
Preview oEmbed results when using the media modal to insert from URL
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | justin@…, gregory@…, xoodrew@… |
Description
If you insert a video URL via the "Add media file from URL" popup, it should do the following:
- Determine whether the URL is oEmbed-able, and if so, insert the appropriate shortcode into the post.
- Create a corresponding attachment with something indicating that it's a video in the post_mime_type field (even though we're not really dealing with true MIME types). That way, we can query video attachments, agnostic of where the actual video file exists.
Attachments (2)
Change History (18)
comment:1
jtsternberg — 4 months ago
- Cc justin@… added
comment:2
jtsternberg — 4 months ago
A feature discussed in [IRC today]https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2013-01-31&sort=asc#m544868 that would be a nice addition: Showing a preview in the modal if an oembed url is added.
- Milestone changed from Future Release to 3.6
On the "Insert from URL" panel in the media modal:
nacin: so, A) detect oEmbed provider URLs, B) showing a preview of said video in the process, C) ensuring it gets inserted on its own line (force a line break) would complete this feature.
comment:4
jtsternberg — 4 months ago
And one more reference link: [pre 3.6 post format overhaul user-testing]http://make.wordpress.org/ui/2013/01/31/have-made-it-through-the-second-round-of/
comment:5
follow-up:
↓ 6
jtsternberg — 4 months ago
Should this same functionality apply to all supported and applicable oEmbed urls? i.e. Tweets, slideshare, polldaddy, etc. Or should this only apply to the traditional "media" types like video/audio?
Replying to jtsternberg:
Should this same functionality apply to all supported and applicable oEmbed urls? i.e. Tweets, slideshare, polldaddy, etc. Or should this only apply to the traditional "media" types like video/audio?
I feel like it would be a nice-to-have but may fall outside the scope of the ticket. Setting it up for video-only at least initially would be a good test case.
Replying to DrewAPicture:
I feel like it would be a nice-to-have but may fall outside the scope of the ticket.
Without actually functionally writing code, I can't promise this, but it seems to me that if we're already detecting if it's an oEmbed provider and retrieving the response, it doesn't matter whether it's video, audio, a tweet, or something else.
comment:8
jtsternberg — 3 months ago
I implemented very similar functionality with Custom Metaboxes and Fields for WordPress and plan on using that as a base for incorporating to WP for this ticket, but if anyone wants to take a look at the code and take a stab at it before I get time, hopefully that will help point you in the right direction.
comment:9
in reply to:
↑ 6
jtsternberg — 3 months ago
Replying to DrewAPicture:
Replying to jtsternberg:
Should this same functionality apply to all supported and applicable oEmbed urls? i.e. Tweets, slideshare, polldaddy, etc. Or should this only apply to the traditional "media" types like video/audio?
I feel like it would be a nice-to-have but may fall outside the scope of the ticket. Setting it up for video-only at least initially would be a good test case.
In the case of the CMB script, it really made no difference what the oembed content was, so I THINK we can do the same here.
jtsternberg — 3 months ago
This successfully displays an oembed preview when an oembed url is detected. Still needs a proper nonce passed for the ajax action.
comment:10
in reply to:
↑ 7
jtsternberg — 3 months ago
- Keywords has-patch added; needs-patch removed
As Helen pointed out in IRC, I think the next item to tackle is to remove the auto-linking when adding to a post via the media window. (which keeps the oEmbed from working on the front-end)
comment:11
gcorne — 3 months ago
- Cc gregory@… added
comment:12
sabreuse — 3 months ago
.2 is working nicely for me at embedding/previewing from the modal.
comment:13
helen — 3 months ago
Two things I want to see, besides nonce and removing auto-linking when a valid response is returned:
- Testing usage of the Ajax action outside of the modal (looks like it'll work just fine, but would still like a test).
- Thoughts on how we can deal with caching the retrieved data to stay away from rate limit problems. Right now all oEmbed caches are dumped on pre_post_update and then re-requested, which already makes it extremely easy to hit, say, Twitter's rate limit of 150 per hour per IP, especially on shared hosting. May very well be outside the scope of this ticket itself, but would at least like to see what thoughts might be.
comment:14
helen — 2 months ago
- Summary changed from Better Remote Video Insert to Preview oEmbed results when using the media modal to insert from URL
comment:15
DrewAPicture — 2 months ago
- Cc xoodrew@… added
comment:16
ryan — 5 days ago
- Milestone changed from 3.6 to Future Release

Related: #11552