Skip to content

AnimatedVisualPlayer keeps rendering loop active when hidden or stopped (Skia) #23189

Closed

Description

@MartinZikmund

Current behavior

On Skia, AnimatedVisualPlayer continues to drive the CompositionTarget.Rendering loop at full FPS even when the player is hidden (Visibility=Collapsed) or its parent is collapsed. Calling player.Stop() does not reliably bring the system framerate counter back down, and CPU load remains high.

Expected behavior

When the player becomes effectively invisible (collapsed, or removed from the tree), the underlying source should pause and the CompositionTarget.Rendering subscription should be released so the system rendering loop can idle. When the player becomes visible again, playback should resume automatically (matching native WinUI's AnimationPlay::OnHiding / OnUnhiding behavior). Stop() should reliably remove the subscription.

Why

LottieVisualSource on Skia drives the animation by subscribing to CompositionTarget.Rendering. Any subscriber to that event keeps Uno's render loop running at the display refresh rate. The native WinUI player explicitly pauses on hide for exactly this reason — its source comments call out "this is necessary to ensure that the animation doesn't keep running and causing DWM to wake up when the animation cannot be seen."

In addition, Uno wired the read-only DPs IsPlaying, IsAnimatedVisualLoaded, and Duration to the UpdateSourceOnChanged callback. WinUI registers callbacks only on input properties (Source, Stretch, AutoPlay, PlaybackRate, FallbackContent, AnimationOptimization). The unwanted callback on IsPlaying causes Stop() to reentrantly re-Update() the source while it is tearing down.

Repro

  1. Place an AnimatedVisualPlayer with AutoPlay=True and a LottieVisualSource on a Skia page.
  2. Observe the framerate counter — it sits at the display refresh rate.
  3. Either set player.Visibility = Visibility.Collapsed or call player.Stop().
  4. Framerate counter does not stabilize back to idle; CPU load remains.

Platform

Skia (Desktop, WebAssembly Skia, mobile-Skia).

Activity

  1. added 3 commits that reference this issue on May 5, 2026
    ed3ad9a
    7e0dfcf
    e845dec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions