Manage sounds on multiple open tabs react

25 views Asked by At

I have react app that plays a sound when receiving a notification. When having many tabs open, the sound plays on all of them which is annoying. I know that there is 2 cases for this:

  1. When user has multiple tabs open, and one of my app tabs is active.
  2. When user has multiple different tabs open, and none of my app tabs is active.

The first case can be handled using Page Visibility API. But the second case I dont really know how to handle it, any thoughts?

I have seen people talking about handling that with a service worker.

0

There are 0 answers