Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1.6 KB

README.md

File metadata and controls

28 lines (21 loc) · 1.6 KB

LottieExportDemo

Demo project with Lottie-animation export with both AVAssetExportSession and AVAssetWriter. AVAssetWriter works fine, but AVAssetExportSession DOESN'T. We plan to use this method to export videos with any content inside: images, videos, animations and sound.

What is happening

We have a Lottie-animations and we need to export it as video on iPhone. Our current AVAssetWriter implementation and frame-by-frame rendering is too slow, so we want to make it faster.

What is the problem

We have AVAssetExportSession export implementation, but it works wrong because of lottie-ios architecture.

How our AVAssetExportSession works

We create AVMutableVideoComposition and add AnimationView.layer (CALayer) on it by AVVideoCompositionCoreAnimationTool. Then just export it with AVAssetExportSession:

layer.addSublayer(animationLayer)

What's wrong with it

Timings are broken for AVAssetExportSession and animation is much slower on result video.

More details

Why does it even run? (important)

I removed this line from AnimationView:

guard self.window != nil else { waitingToPlayAimation = true; return }