Animation pause issue (JS Runtime)

  // rive
  const { rive, RiveComponent } = useRive({
    src: '/rive/ball.riv',
    stateMachines: 'State Machine 1',
    autoplay: true,
    layout: new Layout({
      fit: Fit.Fill,
    }),
    onPause: () => {
      rive?.play();
    },
  });

In Chrome or any web browser, when I switch tabs or the screen is not visible, the animation pauses and requestAnimationFrame stops running. I need the animation to keep running in the background even when the screen is not visible. How can I achieve this?