Search code examples
javascriptc#uwplottieuno-platform

Uncaught Type JavaScript Error In Uno.Lottie WebAssembly


I have an AnimatedVisualPlayer on my Page for playing a Lottie:

<winui:AnimatedVisualPlayer
    x:Name="player"
    AutoPlay="true" Width="150" Height ="150" PlaybackRate="1.5">

    <lottie:LottieVisualSource
        UriSource="ms-appx:///Lottie/waiter.json" />
</winui:AnimatedVisualPlayer>

I installed these packages:

  • Microsoft.Toolkit.Uwp.UI.Lottie (for theLottieVisualSource)
    • Microsoft.UI.Xaml (for the AnimatedVisualPlayer)
    • Uno.UI.Lottie (for the LottieVisualSource)
    • Uno.UI (for the AnimatedVisualPlayer)

I did it also:

On WASM, iOS and macOS, you can put the Lottie .json files directly in a folder of the shared project (for example "Lottie/myanimation.json") and set their Build action as Content.

UWP can play the Lottie seamlessly:

enter image description here

However, WASM cannot play Lottie with this error:

enter image description here

Error 55

Nuget Package Version(s):

Nuget Package:

Package Version(s):

  • Uno.UI.RemoteControl {2.4.0}
  • Newtonsoft.Json {12.0.3}
  • Uno.UI.Lottie {2.4.0}
  • Uno.Wasm.Bootstrap {1.2.0}
  • Uno.Wasm.Bootstrap.DevServer {1.2.0}
  • ACM_Search_AdminApps.Shared {1.1.0}
  • Microsoft.Extensions.Logging.Filter {1.1.2}
  • Microsoft.Extensions.Logging.Con... {1.1.1}
  • NETStandard.Library {2.0.3}
  • Uno.UI {2.4.0}
  • ACM_Search_AdminApps.Shared {1.1.0}
  • Microsoft.NETCore.UniversalWindo... {6.2.10}
  • Microsoft.Extensions.Logging.Con... {1.1.1}
  • Microsoft.Extensions.Logging.Filter {1.1.2}
  • Microsoft.Toolkit.Uwp.UI.Lottie {6.0.0}
  • Microsoft.UI.Xaml {2.4.2}
  • Newtonsoft.Json {12.0.3}
  • Uno.Core {2.0.0}
  • Microsoft.Toolkit.Uwp.UI.Lottie {6.0.0}

How can I fix this ? Thanks.


Solution

  • This is a bug in the Lottie add-in for Uno-Wasm, caused by the fact you were using the PlaybackRate and you're running in a non-english context with a culture where the decimal are serialized using a comma and not a dot.

    This PR #3257 should fix the problem.

    UPDATE: This PR has been merged and the fix will be available in Uno v3.0.0-dev.135.