-
Notifications
You must be signed in to change notification settings - Fork 0
Lottie files from assets_dir are not displayed on Windows #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same problem with local Rive file. |
Please share the code you are using and the organization of your files. |
@ndonkoHenri My simple sample code is here. My local Lottie file is here : https://lottie.host/f38acda7-c5f1-4d79-8fe8-9e97db1b0518/sIOtOddtgl.json Code is here :
|
I tried it and it worked both on desktop and web mode: The issue should be in the organisation of your files: https://flet.dev/docs/controls/image#src I am unsure of this, but another possibility might be that the control is too large. Try giving the Lottie control a size(width/height) or set Let me know which one works. |
@ndonkoHenri My code is as follows, and I will try it on Ubuntu and come back. Thank you.
I've tried it now on Ubuntu 22.04. But not work... ㅠ_ㅠ... |
I have it working in WSL ubuntu 22.04 as per flet-dev/flet#3083 where my issue is with APK on android # --------------------------------------------------------
# Assets folder tree view
# --------------------------------------------
# assets
# ├── B.json
# ├── icon.png
# └── images
# ├── B.json
# └── photo.png
# presume assets and assets/images already exist with `assets/icon.png` and `assets/images/photo.png`
# wget https://raw.githubusercontent.com/xvrh/lottie-flutter/master/example/assets/Mobilo/B.json" -O assets/B.json
# cp ./assets/B.json ./assets/B.json
# cp ./assets/B.json ./assets/images/B.json
# Following work in ✅ WSL but Fail with ❌ APK
# see full code at https://gist.github.com/auphof/32f4f22328374d4e13ebc5a28206fb13
lottie_card_b2 = create_lottie_card("B2", src="B.json")
lottie_card_b5 = create_lottie_card("B5", src="/B.json")
lottie_card_b6 = create_lottie_card("B6", src="/images/B.json") One slight difference and I tested both versions . my call is If I changed the assets dir in do check your file permissions |
also check the downloaded lottie json is valid, I use the following playground to drop in JSON |
@auphof Here is my all code and Lottie local file... -> TryLottiePlz.zipIt has only one python scrpit and one asset file. |
@blackCmd That worked on my WSL2 Ubuntu22.04 see |
@blackCmd you could try and debug step into |
👏👏 @blackCmd well done, great find! , Would a solution be to raise exception if encoding is incorrect ? |
@auphof There might be various solutions, but if an exception occurred when a Lottie local file failed to load, as in my case, it would be easy for anyone to resolve the issue. |
@auphof |
Happy to know you can now move on. Concerning the issue with the korean path, it is possible that the Lottie package used by Flet has an issue with this. (I however found no related issue on their repo) |
@ndonkoHenri |
Hi, OS - Windows10 22H2 please help me out, thanks in advance. |
Can you try different path combinations as seen here? |
Same here on English version of windows 11. No special characters in path and folders. Local Lottie and vine in default |
I have tried but no success. please help me out |
This might be a windows related issue. |
with open("assets/empty.json", "r", encoding="utf-8") as json_file: ft.Lottie(src_base64=self.json_base64), |
Oh.. is it works?! |
Same |
same |
I had the same problem and this worked for me, I just made an adjustment for my import flet as ft
from flet_lottie import Lottie
import base64
#...
with open("src/assets/todo_lottie.json", "r", encoding="utf-8") as json_file:
json_data = json_file.read()
self.json_base64 = base64.b64encode(json_data.encode('utf-8')).decode('utf-8')
Lottie(
src_base64=self.json_base64,
expand=True,
height=300,
)
#... |
@luanmarcal, (note that, 'self' parameter was not used) |
Attention Flet developers... |
Can't play animation with Lottie and Rive local file.
I tried to download a
.json
file from Lottie and load it using ft.Lottie(), but it did not load.The same thing happened with the
.lottie
file.The Lottie animation only works properly with
link
notlocal file
.My lottie json file link is here -> https://lottie.host/f38acda7-c5f1-4d79-8fe8-9e97db1b0518/sIOtOddtgl.json
ENV.
Windows11.
flet 0.24.
2024.11.26
Works local Lottie.json file on
Ubuntu
.not Work local Lottie.json file on
Windows
.This bug has not been fixed for a long time.
The text was updated successfully, but these errors were encountered: