For context, I am trying to play a sound in Perspective when an alarm comes in. The Audio component I am using is part of the navigation banner view which is present on every page. I have noticed that when I have multiple pages open in a session, I will hear the alarm play twice, as there are two instances of the component loaded.
To fix this, I added a script transform that calls system.perspective.getSessionInfo() and only allows the sound to play if the audio component is in the first page in the session. While this did solve the initial problem, I’ve noticed that if you close whatever page is considered “first”, the sound doesn’t play, and if you call system.perspective.getSessionInfo() again, that page still appears in the pageIds list for that session.
With that in mind, I have a couple of questions:
- Is there a way to identify which pages are actually open in the browser and which are not despite showing up in the session info?
- Is there an easier way to ensure exactly one instance of a sound plays per session?
Thanks in advance