Is it possible to get consistent APNG support in modern browsers?

824 Views Asked by At

I have inherited a legacy project containing some 20+ APNG files that are considered instrumental to the design of the site. However, for whatever reason, Safari plays these APNG files twice where every other browser I have tested them in plays them only once because they were created with the loop count (num_plays) set to 1. This is standard because 0 means loop forever.

I understand APNG may be considered a thing of the past at this point; but, assuming I cannot change this part of the project, do I have any means of getting Safari to play the animations only once as designed? Or am I looking at some rancid Safari only fallback?

Here is an example of one of the images: enter image description here

Thanks!

2

There are 2 best solutions below

5
greg-tumolo On

If all of the images contain as few colors as the example, you could convert them to animated GIFs without loss of quality to avoid a Safari-only fallback (at which you are, indeed, looking without the conversion).

2
greg-tumolo On

You should modify the frame control chunk of the last frame by setting delay_num to 65535 and delay_den to 1 so that the first frame does not display again for 65535 s = 18.2 h!