Giphy onebox for animated gifs

(Robert) #1

Hey all,

I know some people were working on a gif plugin. However, I suggest to add support to the onebox plugin as long as we do not have a proper plugin (and we might want to keep it for later as well).

Giphy provides all (most?) gifs as well as mp4. Unfortunately, the mp4 url does not end on mp4, but on html5. So that is why it does not work automatically.


Instead of oneboxing Giphy, I’d almost be more interested in seeing installation-local support for looping short videos:

  • Discourse (plugin) would transcode mp4 / webm versions of gifs and attach them to the post. When viewing the post, only one of the formats—the best one supported by the browser—would actually be rendered.
  • Animated gifs from Giphy and elsewhere would automatically be downloaded and attached, the same as ordinary images. Within the bounds of sanity checking, the various formats from upstream would be grabbed instead of transcoding locally and potentially worsening quality.

This is almost certainly a very low priority feature, but It’d still be nice to have. :slight_smile:

This old thread is related, but misses a key point of what I’d like to see. That being ideally these looping videos should have a user experience that is exactly identical to directly attaching a .gif, aside from automagically consuming less bandwidth (and/or being higher quality).

Showing video player controls and invoking “video” presentation semantics is… very :grimacing:.

(Robert) #3

In the meanwhile I suggest to embed giphy gifs. It cannot be so difficult to
write a plugin for onebox. The data is already there:

Have a look at the opengraph.


(Robert) #4

I prepared a giphy html5 video version, but it does not work due to the being stripped out autoplay at some point for any reason. Also, I do not know if autoplay would be a good idea performance wise in topics with many autoplay videos…

(Alex Garnett) #5

It looks like the current giphy support in Discourse might be broken? On my site, this plays correctly for five minutes as long as it’s pointing to an external host, then when Discourse tries to mirror it in S3 locally after 5 minutes as normal with image uploads, it won’t animate anymore.

(Jeff Atwood) #6

Nope, that is new functionality. Any external image larger than (x) will be blocked as a bandwidth hog (for mobile, etc) unless you explicitly allow it in your site settings.

You will see a placeholder and have to click through on it to see the giant 40 megabyte plus image, rather than having it hotlinked live.

(Alex Garnett) #7

Ah, OK! thanks for the quick response; that makes sense.

Would it be easier to not try to mirror images beyond a certain size threshold in that case?

(Michael Howell) #8

“Bandwidth hog” doesn’t just mean for the forum. It’s mostly for the user’s benefit.