How to Play a GIF Only Once Per Screen Transition

Some users have asked how to control GIF playback so that the gif does only loops once, but still plays every time a certain screen is shown.

While there are a few ways to perform this, some are more practical than others.

For example, if you are using a gif, this means that you are using either an Image or Video Render Extension.

These render extensions don't provide any real playback control like play, pause, etc.

So realistically the best way is to take advantage of the utilities that do provide playback control, like FFMpeg and GStreamer. Keep in mind though that currently FFmpeg only ships with support for WebM video format and Ogg Vorbis audio format.

However there is one way you could implement the desired behavior using the Image or Video Render Extension. It's not as flexible as using the added media actions that the aforementioned alternatives would provide, but it's possible.

First, we should refer to the approach outlined in this article

Using this approach, instead of hooking the Start and Stop functionality into button presses, you would instead hook the functionality into gre.screenshow.pre/post and gre.screenhide.pre/post, whichever better suited your application's design.

When it comes to using the Video Render Extensiothough, you will also have to set the FPS parameter to 0 when stopping playback and then set it to the desired framerate when you wish to begin playback again.

An additional option outside of the ones already presented is to use a flipbook animation instead.

This type of animation means exporting your gif as an image sequence, and then importing those images into Storyboard. You could then insert those images into an animation and adjust it to the appropriate framerate.

This would allow you to control it with all of the tools provided by the animation suite.

As you can see there are many ways to approach this, it just all depends on your needs and constraints.

0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post