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

JSON string is interpreted as URL #200

Open
iwo-strzebonski opened this issue Feb 27, 2023 · 3 comments
Open

JSON string is interpreted as URL #200

iwo-strzebonski opened this issue Feb 27, 2023 · 3 comments

Comments

@iwo-strzebonski
Copy link

Hello,
I'm currently working with Frontify Brand SDK and Typescript React and I wanted to use the LottiePlayer with a JSON string loaded from the file input, however I receive an error suggesting that the player tries to use that string as URL instead of a JSON.

I tried passing a parsed JSON, without success.

@samuelOsborne
Copy link
Member

hi @iwo-strzebonski Could you share how you tried passing a parsed json?

Also, are you aware of https://github.com/LottieFiles/lottie-react ? This could be helpful, cheers!

@iwo-strzebonski
Copy link
Author

iwo-strzebonski commented Feb 27, 2023

@samuelOsborne the JSON is shown correctly in the console
Also I see now that I receive an error "lottiePlayer.load() is not a function", though the element itself exists

const lottiePlayer = document.querySelector('lottie-player') as any

if (!lottiePlayer) {
   return
}

console.debug(JSON.parse(src))
lottiePlayer.load(JSON.parse(src))

@samuelOsborne
Copy link
Member

Hi @iwo-strzebonski What framework are you using? I've tried to reproduce here but seems to be working as intended, let me know if theres a difference with your code

https://codepen.io/Osbro/pen/ExeEeav

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

2 participants