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

Android is off by one when specifying frame to play #1121

Open
thevoiceless opened this issue Oct 17, 2023 · 1 comment
Open

Android is off by one when specifying frame to play #1121

thevoiceless opened this issue Oct 17, 2023 · 1 comment

Comments

@thevoiceless
Copy link
Contributor

Description

The result of play(frame, frame) matches on iOS and web, but is off by +1 frame on Android.

Steps to Reproduce

  1. Create a barebones RN app
  2. Add lottie-react-native
  3. Update metro.config.js to include .lottie files
  4. Use play(frame, frame) to play a frame, using setTimeout() to ensure the animation is done loading

Expected behavior:
Same result on all platforms

Actual behavior:
iOS and web match, Android is off by +1

Example, playing frame 115 below on Android/web/iOS:
Screen Shot 2023-10-16 at 6 02 34 PM
Frame 116:
Screen Shot 2023-10-16 at 6 03 16 PM

Minimal reproduction

function App() {
  const animationRef = React.useRef<LottieView>(null);

  React.useEffect(() => {
    const timer = setTimeout(() => {
      animationRef?.current?.play(115, 115);
    }, 500);
    return () => clearTimeout(timer);
  }, []);

  return (
    <SafeAreaView>
      <LottieView
        ref={animationRef}
        source={require('./Lottie_OnOff_Microphone.lottie')}
        style={{width: 300, height: 300}}
      />
    </SafeAreaView>
  );
}

Lottie_OnOff_Microphone.lottie.zip

React Native Environment

Bare, 0.72.6

Lottie Version

6.3.1

@matinzd
Copy link
Collaborator

matinzd commented Oct 30, 2023

I tried looking into the source code but I couldn't find anything weird. Maybe it's better to test it on native apps and see if this behaviour exists on the native implementation as well.

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

No branches or pull requests

2 participants