Skip to content
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

Play lottie example #6279

Closed
hoanglam9925 opened this issue May 26, 2024 · 9 comments
Closed

Play lottie example #6279

hoanglam9925 opened this issue May 26, 2024 · 9 comments

Comments

@hoanglam9925
Copy link

hoanglam9925 commented May 26, 2024

LVGL version

v9.1.1

What happened?

I tried running lv_example_lottie_1, which runs lottie from a .c file, after seeing this library upgrade recently to support play lottie. I can play other Lottie files nicely by doing this.
However, lv_example_lottie_2—which runs from a source—showed a blank screen and produced no error log. Does any flag need to be enabled?

How to reproduce?

No response

@kisvegabor
Copy link
Member

Hi,

Happy that at least it's working at least from an array 🙂

Do you try it on PC or an embedded system?

@hoanglam9925
Copy link
Author

hoanglam9925 commented May 26, 2024

I use an embedded system to operate. ESP32-S3 using an Arduino

@kisvegabor
Copy link
Member

Can you open the file for reading using normal file system functions?

@liamHowatt
Copy link
Collaborator

Lottie file loading uses stdio.h file functions. It doesn't use LVGL FS layer. Is that corret kisvegabor? I believe for loading Lottie files, the platform needs to support those stdio.h file interfaces.

Here is where the lottie file gets opened: https://github.com/lvgl/lvgl/blob/master/src/libs/thorvg/tvgLottieLoader.cpp#L202

And we document it here: https://docs.lvgl.io/master/widgets/lottie.html#set-a-source

Lottie animations can be opened from JSON files by using lv_lottie_set_src_file(lottie, "path/to/file.json"). Note that the Lottie loader doesn't support LVGL's File System interface but a "normal path" should be used without a driver letter.

Finally, make sure the path you use is either absolute, or relative to the "working directory", whatever that means on ESP32-S3 Arduino. When deployed on-device, the hardcoded path in lv_example_lottie_2 likely will need to be adjusted.

Does ESP32-S3 on Arduino have a filesystem that can be accessed through fopen, fread, fclose, etc?

@hoanglam9925
Copy link
Author

I'm currently using FATFS. I use the default fsdrv found in lvgl/src/libs/fsdrv in the lvgl lib. I can see that this file already uses f_open from ff.h, but when I try to load a lottie, it just displays a blank screen.
I can use this driver to load a gif.

@liamHowatt
Copy link
Collaborator

Ah, okay. Currently you cannot load Lotties from files with FATFS. Lottie files are not loaded through the LVGL filesystem abstraction so they cannot leverage anything in fsdrv. Lottie files are loaded by logic in lvgl/src/libs/thorvg which directly calls stdio.h functions such as fopen. Most everything else in LVGL uses fsdrv. Lottie is the exception.

We could start discuss making Lottie load from fsdrv.

@kisvegabor
Copy link
Member

With @becseya we were talking about adding LV_FS_DRIVER_FORCE 'A' config option. This way if a no driver letter is specified it will work with both LVGL file system and without it too. For example:

  • path/to/file if LVGL FS is not used: use normal C FS functions as they are in the 3rd party library (e.g. in Lottie)
  • path/to/file if LVGL FS is used: as the path doesn't start with letter + : the path will passed to the POSIX driver as it is

@becseya
Copy link
Contributor

becseya commented Jun 13, 2024

We added a detailed documentation on how to use the filesystem under ESP in #6367 (and also the DEFAULT_DRIVE_LETTER mentioned by @kisvegabor )

@hoanglam9925 you should try migrating to ESP's FATFS instead of LVGL's while following the documentation

@kisvegabor
Copy link
Member

If it's still not working please comment in #6367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants