LC GIF Player
This tiny project borned since I had the necessity to create a GIF player for my product documentations.
GIFs are easy to be implemented and maintained, then sometimes are better than videos.
So.. here it is! A reponsive GIF player featuring preloader, prev/next commands and a fullscreen mode.
Supports modern browsers (IE 10+)
How to use
Easiest way to get started is to play with the demo.html file. Here's the code used:
lc_gif_player function has got one mandatory and 3 optional parameters:
DOM element selector (string) (mandatory)
whatever you may target through querySelectorAll javasctipt function
true if you want to autoplay the GIF once loaded. By default is false
Extra classes (string)
you may need to add extra classes to player's wrapper. Just write them together in a single string
Hidden commands (array)
you can hide prev/next and fullscreen comands by inserting move and fullscreen keywords inside an array
Here's a complete example
One last thing: same-domain origin
The gif has to be on the same domain (and port and protocol) as the page you're loading.
The library works by parsing gif image data in js, extracting individual frames, and rendering them on a canvas element. There is no way to get the raw image data from a normal image load, so this library does an XHR request for the image and forces the MIME-type to "text/plain". Consequently, using this library is subject to all the same cross-domain restrictions as any other XHR request.
Copyright © Luca Montanari (aka LCweb)