aporokizzu Posted November 26, 2021 Share Posted November 26, 2021 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.