Why does my GIF not play every time it appears?

The first time my GIF appears, it plays. Subsequently, it appears, but remains static (as if played). Sometimes, when an input leading up to the GIF appearance is different, it plays again. What may cause this behavior?


Thanks!

Hi YS Yeo,

(Edit: thanks for your observation Kilian Hekhuis)

An alternative to the solution assif_tiger wrote here, you could also use an external image editing program, to change the GIF's looping settings. 

For example in Photoshop open the gif, go to the Window tab and select timeline, set option "Forever".

I hope this helps, regards!


@Marco: I think the OP means an animated GIF not playing, not that it repeats across the page ;)

YS Yeo wrote:

The first time my GIF appears, it plays. Subsequently, it appears, but remains static (as if played). Sometimes, when an input leading up to the GIF appearance is different, it plays again. What may cause this behavior?


Thanks!

Hi,

you can also add a ?+Math.random() to the end of the picture src and it'll reload the .gif.

img.src = "your_image_url.gif"+"?a="+Math.random();

Thanks! Where do I put +"?a="+Math.random()?

Here?:

YS Yeo wrote:

Thanks! Where do I put +"?a="+Math.random()?

Here?:

RuntimePath is a variable. Add below to append the variable. So in the code where you're calling the variable, just append it.

+"?a="+Math.random();



Hi Swatantra,

Runtime Path is not editable, so your suggestion is invalid. Also, Math.random() is JavaScript, you can't add JavaScript to a Property like that!

Kilian Hekhuis wrote:

Hi Swatantra,

Runtime Path is not editable, so your suggestion is invalid. Also, Math.random() is JavaScript, you can't add JavaScript to a Property like that!


This is what I've mentioned, RuntimePath is a variable. While Math.random() is a javascript, so it has to be appended where variable is being called. 

Hi Swatantra,

Kilian was pointing that the image posted by the OP is of the properties of the gif, under the Images folder in the Interface tab.
You can't change this value, and it is not a variable.

You could tell to use an Image Widget with an external image and set the URL with the Math.random(). Again this would not work, because this would be interpreted as a part of the name of the image, not as a JavaScript instruction.

To do what you and Assif are proposing, you would have to use an expression and place an image tag in it, in the page. Too much trouble.

Using a gif (in an Image widget) with a looping count of 1, every time I enter the page with the GIF, it is played and stops at the end. If I open the page again, it plays one time. I tested both in Chrome and Opera.

If this is not what one wants (and you want to play the gif indefinitely, change the looping count as Marco already told at the beginning. You can do this online here: https://ezgif.com/maker

Cheers.

Thanks all for the explanations.

@Eduardo, I am not trying to make the gif play indefinitely. I want the gif to play once every time it is rendered. Sadly, it only plays the first time it is rendered for each app session.

Hi YS,

1. Mobile or Web?

2. What browser or device did you test?

Cheers.

Eduardo Jauch wrote:

Hi YS,

1. Mobile or Web?

2. What browser or device did you test?

Cheers.


Mobile. Android Samsung. (: