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

RiveAnimationView.Builder ignores playback if autoplay is set to false #345

Open
jordanMadrigal opened this issue Nov 26, 2024 · 0 comments

Comments

@jordanMadrigal
Copy link

<-- Thanks for using Rive!

If something isn't working like you expected, please:

If you think you found a bug or if you can't find what you're looking for
in our docs, fill out the template below.

-->

Description

<-- A clear and concise description of what the problem is. -->

I may have found a bug. The RiveAnimationVew.Builder is ignoring playback when autoplay is set to false. However, when creating a RiveAnimationView object and setting rive resource with said object and same parameters as builder it works.

Provide a Repro

<--
Please provide the most minimal repro you can:

  • If the problem is small enough, paste a code snippet
  • Otherwise, you can attach a ZIP archive or paste a link to a GitHub repository with the app bundle
    that is reproducing the issue
// Composable wrapper around view
AndroidView(
            modifier = Modifier.align(Alignment.Center),
            factory = { context ->
                RiveAnimationView(context).apply {
                    setRiveResource(
                        resId = if (isDarkMode) R.raw.promo_bell_dark else R.raw.promo_bell_light,
                        animationName = BELL_ANIMATION_NAME,
                        autoplay = false
                    )
                }
                // The builder below won't play while the code above does play.
                /*RiveAnimationView.Builder(context)
                    .setResource(
                        if (isDarkMode) R.raw.promo_bell_dark else R.raw.promo_bell_light
                    )
                    .setAutoplay(false)
                    .setAnimationName(BELL_ANIMATION_NAME)
                    .build()*/
            },
            update = { view ->
                if (triggerAnimation) {
                    view.play(
                        animationName = BELL_ANIMATION_NAME,
                        loop = Loop.ONESHOT,
                    )
                    Log.d("ASDF", "Play animation ${view.controller.isActive}")
                } else {
                    Log.d("ASDF", "No op")
                }
            }
        )

-->

Source .riv/.rev file

<--
Attaching runtime-exported .riv file that reproduces the issue is immensely helpful for our team
to identify the problem as fast as possible and fix it.
Please also include the source (.rev)
by downloading a backup from the Editor.

N.B. Because GitHub only supports certain file types use a ZIP archive to upload .riv/.rev files
to this issue.

You can also privately share the .riv/.rev file with us at [email protected].
-->

Expected behavior

<-- A clear and concise description of what you expected to happen. -->

The RiveAnimationView.Builder should work the same as creating a RiveAnimationView object from scratch. What's the point of having a builder if it behaves differently than the object it was meant to create?

Screenshots

<-- If applicable, add screenshots to help explain your problem. -->

Screenshot

Device & Versions (please complete the following information)

  • Device: [e.g. Android Emulator, Pixel 4a]
  • SDK Level [e.g. Android SDK API Level 30]

-Device: Samsung Galaxy S10
-SDK Level: 12

Additional context

<-- Add any other context about the problem here. -->
Rive animation file.zip

rive-engineering pushed a commit that referenced this issue Dec 5, 2024
This pull request addresses the following GitHub issues and more:
- [rive-ios #345](rive-app/rive-ios#345)
- [rive-react-native #268](rive-app/rive-react-native#268)

Thanks to some help from @luigi-rosso, we discovered that the iOS runtime build scripts were _not_ including the Yoga renames, causing a collision when some frameworks were statically linked in React Native environments.

This has been tested locally, and works, but the real test will be the public.

Diffs=
437688c18e Add yoga renames to non-v2 lua build scripts (#8693)
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

1 participant