alamminsalo / orion

Cross platform Twitch.tv client
GNU General Public License v3.0
313 stars 60 forks source link

Gif emotes don't move #234

Open sum01 opened 6 years ago

sum01 commented 6 years ago

The BTTV gif emotes display as a static image instead of a moving gif.

On Linux, installed through the AUR.

rakslice commented 6 years ago

Most chat images are loaded on the C++ side and then provided to the UI via QQuickImageProviders. This is so that they can be cached at predetermined locations on the disk between runs without a lot of fuss. Qt's QImage infrastructure, which is used to load images for the image providers, works with GIFs, and Qt's AnimatedImage QML type can display animated GIFs, however AnimatedImage doesn't work with QQuickImageProvider (or at least it didn't back when this was first implemented in Qt 5.6-5.8 or so). To get around this, I just fed the original image URL to the UI, and for images that we knew were going to be animated (e.g. bits images), had the UI switch to an AnimatedImage and put in the original GIF URL for the UI to load directly. This isn't ideal performance-wise but at least the animation works.

The solution to animating emotes would be to rework the handling of emotes that will be coming in as animated GIFs and have them use the same code path as is currently used for bits images.

The view side of this stuff is in ChatMessage.qml.