问题描述
我的主页上有一个 AnimatedVisualPlayer 用于玩乐蒂:
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>
我安装了这些软件包:
- Microsoft.Toolkit.Uwp.UI.Lottie(用于LottieVisualSource)
- Microsoft.UI.Xaml(用于 AnimatedVisualPlayer)
- Uno.UI.Lottie(用于 LottieVisualSource)
- Uno.UI(用于 AnimatedVisualPlayer)
我也这样做了:
在 WASM、iOS 和 macOS 上,可以直接将 Lottie .json 文件放入共享项目的文件夹(例如Lottie/myanimation.json")并将其构建操作设置为内容.
UWP 可以无缝播放 Lottie:
UWP can play the Lottie seamlessly:
但是,WASM 无法播放 Lottie 并出现此错误:
However, WASM cannot play Lottie with this error:
Nuget 软件包版本:
Nuget 包:
软件包版本:
- 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.
推荐答案
这是 Uno-Wasm 的 Lottie 加载项中的一个错误,由您使用
PlaybackRate
和您'在非英语环境中运行,其中小数点使用逗号而不是点进行序列化.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.这个 PR #3257 应该可以解决这个问题.
This PR #3257 should fix the problem.
更新:此 PR 已合并,修复程序将在 Uno v
3.0.0-dev.135
.UPDATE: This PR has been merged and the fix will be available in Uno v
3.0.0-dev.135
.这篇关于Uno.Lottie WebAssembly 中未捕获的类型 JavaScript 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!