Skip to content

fix(android): make play() start the configured state machine on cold start - #343

Merged
mfazekas merged 2 commits into
mainfrom
fix/android-play-cold-start-state-machine
Jul 16, 2026
Merged

mfazekas merged 2 commits into
mainfrom
fix/android-play-cold-start-state-machine

Conversation

@mfazekas

Copy link
Copy Markdown
Collaborator

On Android, calling play() on a view mounted with autoPlay={false} didn't start the configured state machine: nothing is instanced at that point, so the wrapper fell through to rive-android's no-arg controller.play(), which starts the artboard's first raw animation plus its first state machine (ignoring stateMachineName). The result was wrong content (two timelines fighting) and, because the wrapper sampled the active state machine name before anything existed, subsequent input writes threw "View not configured. Could not find active state machine name". Reported in the follow-up of #332 ("play/playIfNeeded didn't work"); iOS was unaffected.

play() now starts the configured state machine explicitly on cold start (falling back to the artboard's first, matching what autoplay does) and records it as active. The no-arg resume path is kept for pause()/play() cycles and for animation-only files.

Includes a harness test that fails without the fix ("View not configured") and passes with it; verified on the Android emulator harness (full suite green) and on iOS (passes before and after).

Refs #332

@mfazekas
mfazekas force-pushed the fix/android-play-cold-start-state-machine branch 5 times, most recently from a058360 to 5de09ba Compare July 16, 2026 10:48

@HayesGordon HayesGordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So annoying that the old Rive Android API is like this ☹️

Excited to get all of this out. Thanks for the fix!

mfazekas added 2 commits July 16, 2026 23:26
…d state machine

Fails on Android: the legacy wrapper's play() falls through to rive-android's
no-arg controller.play() (first raw animation + first state machine, not the
configured one) and never records the active state machine name, so input
writes afterwards throw "View not configured". Matches the reporter's
follow-up on issue #332. Control case (autoPlay=true) passes.
…start

With autoPlay=false nothing is instanced yet, and rive-android's no-arg
controller.play() starts the artboard's first raw animation plus its first
state machine, ignoring the configured stateMachineName — wrong content
renders and the wrapper never records the active state machine, so input
writes throw "View not configured" (issue #332 follow-up). Start the
configured state machine explicitly on cold start (falling back to the
artboard's first, matching autoplay), and keep the no-arg resume path for
paused instances and animation-only files.
@mfazekas
mfazekas force-pushed the fix/android-play-cold-start-state-machine branch from 5de09ba to 2ec489b Compare July 16, 2026 21:26
@mfazekas
mfazekas enabled auto-merge (squash) July 16, 2026 21:26
@mfazekas
mfazekas merged commit 99344d8 into main Jul 16, 2026
8 of 9 checks passed
@mfazekas
mfazekas deleted the fix/android-play-cold-start-state-machine branch July 16, 2026 21:54
mfazekas pushed a commit that referenced this pull request Jul 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.4.19](v0.4.18...v0.4.19)
(2026-07-16)


### Bug Fixes

* **android:** make play() start the configured state machine on cold
start
([#343](#343))
([99344d8](99344d8)),
closes
[#332](#332)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mfazekas added a commit that referenced this pull request Jul 20, 2026
play-after-autoplay-false came from main (#343, a legacy fix) and drives
the state machine via SMI inputs, which the experimental backends reject
by design.
mfazekas pushed a commit to Nodonisko/rive-nitro-react-native that referenced this pull request Oct 6, 2026
The deferAutoPlay branch in configure() used the no-arg play(), which on
a cold start also starts the artboard's first raw timeline animation.
That timeline then draws over the data-bound state machine, showing the
wrong state. Same bug class as rive-app#332, already fixed for the public
play() in rive-app#343 - this applies the same explicit start to the internal
call site.

Co-Authored-By: Claude <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

2 participants