rive-app / rive-app/rive-android

Pause function hide animation when the app launched

Open
#364 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
538
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Description

I try to show rive animation ( pause mode ) when the app launch on the first app screen . I think the pause() function hide the rive animation

Provide a Repro
enum class EngineState {
    Idle, Loading, Ready, Playing, Paused
}
when (it) {
EngineState.Playing -> binding.ravEqualizer.play()
else -> binding.ravEqualizer.pause()       
  • set riveAnimationView property autoplay to false
  • send different state in state flow ( Loading , Ready ) when the app launch
  • collect this state flow in First Fragment or First Activity
  • the rive animation (mode pause) not visible
First try
        viewModel.playerState
            .flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED).collectLatest {
                when (it) {
                    EngineState.Playing -> binding.ravEqualizer.play()
                  
                    else -> {
                        if (binding.ravEqualize.isPLaying) {
                            binding.ravEqualizer.pause()
                        }

                    }
                }

On the app launch (MainActivity or MainFragment), the rive animation property IsPlaying not return true when i set autoPlay property to false in XML declaration

For test i removed binding.ravEqualizer.pause() i haven't the problem , is the good behavior . Maybe pause() is the cause ???

Expected behavior

the rive Animation ( pause mode ) is visible

Screenshots

Bad behavior :

Image

Good behavior :

Image
Device & Versions (please complete the following information)

Emulator :

Image

All TV

Fix Resolution temporary

le state begin by Loading and Ready but when the state ready is collected the "RiveView.isPlaying" property is true . Why ?

// STATE ( IDLE, LOADING,READY,PAUSE )

        viewModel.playerState
            .flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED).collectLatest {
                when (it) {
                    EngineState.Playing -> {
                        riveFirstLaunch = true
                        binding.ravEqualizer.play()
                    }
                    else -> {
                        if (riveFirstLaunch) {
                            binding.ravEqualizer.pause()
                        }

                    }
                }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in the first Activity or Fragment using the provided EngineState flow, autoplay=false, and the play()/pause() calls on RiveView. Compare startup with and without pause(), and inspect the isPlaying result; done means a paused animation remains visible on launch without breaking the Playing transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.