Users reported that oneboxed Gfycat videos on Discourse played at a slower frame rate than embedded versions, prompting investigation. Falco confirmed Gfycat intentionally serves mobile-optimized versions via oEmbed. A fix was proposed using custom logic instead of Gfycat’s official library, creating a <video> tag with loop and conditional autoplay based on file size and device. nbianca implemented the changes, which were merged. Autoplay was enabled by default for Gfycat clips — which lack audio — but capped at 10MB for desktop and mobile (with mobile also requiring viewport visibility). The updated onebox now supports additional metadata (title, author, tags, favicon) and multiple URL formats. twaith noted Gfycat’s iframe API can further optimize performance by adapting to browser, OS, and network conditions, though it wasn’t integrated. The final implementation balances performance, user experience, and bandwidth efficiency.
Is this intentional for the sake of network resources, or is it a bug? I notice that the direct (second) link is on fat.gfycat.com instead of gfycat.com, so I’m not sure if maybe gfycat updated their backend and Discourse hasn’t adjusted yet.
I see that the official gfycat.js library requires a piece of code (the library loader, a simple <script> tag from their README.md) to be included just once for all videos. Is there any way of achieving that in OneBox?
Any chance autoplay could be enabled by default for the gfycat onebox instead? Gfycat clips are essentially glorified gifs (even limited to 15 seconds), so preferably they’d behave similarly. There shouldn’t be an issue with bandwidth because webm files are substantially smaller than their gif equivelants which already autoplay (the one in the OP is 1/6th the size of the equivalent gif).
I made the changes. Probably, the most bandwidth savings would be made if we used the low quality source. However, there is no way we can actually switch between sources and I am not sure if the browser can do that by itself (taking into consideration bandwidth, if on desktop or mobile, etc.)
Using this documentation here (we recently published it on our docs) will make all shared Gfycats faster regardless of browser. There is logic in there that detects factors like browser, OS, network speed, etc. and we also provide users the option to toggle between high quality and lower resolution. https://developers.gfycat.com/iframe/