Jump to content

PIXI.gif.AnimatedGIF.fromBuffer


aporokizzu
 Share

Recommended Posts

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:

fromBufferError.PNG.8433891f38286c6bc12e180c65b4e2eb.PNG

 

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...