Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Issues getting a webm animation to play after setting it via the API?

So I've created a .webm animation, uploaded it to my library, and confirmed it works (when dragged-and-dropped to the sandbox).

I'd like to be able to control it via the API somehow.  The current method I'm using is:

  1. Turn it off by setting the imgsrc to a blank png.
  2. Turn it on by setting the imgsrc to the webm file, using the "https://s3.amazonaws.com/files.d20.io/imag..." filename from my library.

When I do this, only the very first frame of the animation appears; the animation doesn't start to play until I manually hit the Play button.

Is this the right way to do this, or is there another method that will give the same result?

I found an earlier reply that said using createObj was the only way to do it.  I tried that, with the following command:

const animObj = createObj("graphic", {
left: 200,
top: 200,
height: 200,
width: 200,
layer: "objects"
})
console.log(`Animation Object: ${JSON.stringify(animObj)}`)


... and I get "UNDEFINED".  For some reason, the object isn't being created. (I've tried it using both "med.webm" and "thumb.webm", neither of which work.)

July 29 (6 years ago)

Edited July 29 (6 years ago)

Ey there!

I ran into this exact issue while trying to get some auto-switching animated character tokens working. (After asking here.)

The short answer is that this is a bug on Roll20's end, and there is absolutely nothing you can do from the back-end / API to fix it. (Creating a brand new object with createObj is one of the many, many things I tried.)

I would love to be proven wrong, so please let me know if you discover anything. Otherwise, I recommend bumping / +1'ing the bug report thread linked above, to bring some more attention to it.

I ended up "solving" the problem with a front-end hack (I injected javascript into my client that looks for the "stuck" tokens and toggles their pause/play commands), but this solution is unreliable, ugly, definitely not Roll20-approved, and shouldn't be necessary in the first place. It also means that it only works if the DM is willing to install a javascript injector and run injection code at all times, and if the DM can't see the tokens (for instance, if the players are on a different map, or if the DM is offline), they break. Not good.