Mambo vipi, fellow devs-
I was wondering if anybody here has any experience with Pixi.js's PIXI.gif.AnimatedGIF runtime object, and its fromBuffer() method in particular?
I have the following code:
let gif = null;
const _onError = () => { console.log(`error!`); };
const xhr = new XMLHttpRequest();
xhr.open(`GET`, `img/gifs/wp.gif`);
xhr.responseType = `arraybuffer`;
xhr.onload = () => {
if (xhr.status < 400) {
gif = PIXI.gif.AnimatedGIF.fromBuffer(xhr.response);
} else {
_onError();
};
};
xhr.onerror = _onError.bind(this);
xhr.send();
However, when executed, I receive the following error:
Now, according to the fromBuffer() documentation, it accepts two arguments- buffer and options. Buffer's type is ArrayBuffer, which is what I thought I was passing, so I am not really sure what is going on or whether I have to do something to xhr.response before I pass it?
Any information or help would be much appreciated!
Asante sana in advance