Open Hanzalah-Adalan opened 6 years ago
currently here's my noob solution: -> Reload the Json file altogether to start fresh otherwise I got those canvas's IClosable, IDisposable error stuffs..
public async void PlayLottieDownload()
{
await LottieDownloadAnimation.SetAnimationAsync("Assets/Lottie/file_download.json");
LottieDownloadAnimation.AutoPlay = true;
LottieDownloadAnimation.PlayAnimation();
}
public async void StopLottieDownload()
{
await LottieDownloadAnimation.SetAnimationAsync("Assets/Lottie/file_download.json");
LottieDownloadAnimation.Progress = 0.5f;
}
What code did you use to try to pause and set the progress? And were that being called from the UI thread?
I try to pause & set new progress value while it is active (animating) triggered by AutoPlay property set to True on App launch..
and Yes, that were being called from the UI thread.
I guess this is because there are two separate animations going on in this scenario, one from the AutoPlay trigger and another one from method call to pause and set the new value..
I also found this problem, some lottie files will crash if you change the Slider Value on LottieUWP.Sample. This bug is related to the CurrentDrawingSession of BitmapCanvas. I modified the Progress setter of LottieDrawable to avoid this bug. @azchohfi If a crash Lottie file is needed, I can provide it.
public float Progress
{
get => _animator.AnimatedValueAbsolute;
set
{
if (_composition == null)
{
_lazyCompositionTasks.Add(c => { Progress = value; });
return;
}
//added code
lock (this)
{
_bitmapCanvas?.Dispose();
_bitmapCanvas = new BitmapCanvas(Width, Height);
}
Frame = MiscUtils.Lerp(_composition.StartFrame, _composition.EndFrame, value);
}
}
You are disposing the bitmapcanvas every frame change? I don't think that is a good solution.
You are disposing the bitmapcanvas every frame change? I don't think that is a good solution.
The Progress setter of LottieDrawable is called only you changed the Slider value manually,and I didn't solve the bug, I just found a way to avoid it.
Unspecified error
Attempting to close a CanvasActiveLayer that is not top of the stack. The most recently created layer must be closed first.