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: filosofo Owned by: filosofo
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)

15490.diff (5.3 KB) - added by 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.
15490.2.diff (5.0 KB) - added by helen 3 months ago.

Download all attachments as: .zip

Change History (18)

  • Cc justin@… added

Related: #11552

Last edited 4 months ago by helen (previous) (diff)

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.

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   jtsternberg4 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?

comment:6 in reply to: ↑ 5 ; follow-ups: ↓ 7 ↓ 9   DrewAPicture4 months ago

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.

comment:7 in reply to: ↑ 6 ; follow-up: ↓ 10   helen4 months ago

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.

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   jtsternberg3 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.

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   jtsternberg3 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)

helen3 months ago

  • Cc gregory@… added

.2 is working nicely for me at embedding/previewing from the modal.

Last edited 3 months ago by sabreuse (previous) (diff)

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.
  • Summary changed from Better Remote Video Insert to Preview oEmbed results when using the media modal to insert from URL
  • Cc xoodrew@… added

comment:16   ryan5 days ago

  • Milestone changed from 3.6 to Future Release
Note: See TracTickets for help on using tickets.