Home > other >  How expensive are videos in Flutter?
How expensive are videos in Flutter?

Time:01-29

Normally, if a widget has to rebuild many times or requires a lot of GPU resources, it is expensive. So, how about videos?

For example, consider the two following scenarios:

  1. A screen with a black star shape (made of a widget like ClipPath or similar) animated on the screen.
  2. Exactly the same thing as item 1, but instead of the star being made with a widget, the screen is actually a full screen video of a black star being animated.

Which alternate would probably be more expensive?

I know this is a broad question, but having a sense of what approaches are relatively costly would be very useful. I’m not very knowledgeable about the deep workings of Flutter, so I’m hoping someone could give me a better sense about the costs of videos.

CodePudding user response:

Widget rebuild is very fast and not expensive. It is intended be to rebuilt very frequently. You can rebuild and animate hundreds of widget every frame without lagging.

Video player are implemented in native language, and the performance are very different on different devices

For simple animation, you should use widget, using video won't improve performance, but for very complex animation or 3D animation, using pre-rendered video could be useful

  • Related