beep.js icon indicating copy to clipboard operation
beep.js copied to clipboard

Continuously holds the same notes when tab/window is inactive.

Open DylanDavidson opened this issue 10 years ago • 1 comments

I noticed in Chrome 41 on Windows, that if I played the sample score from the demo and then switched tabs when a note was playing it would just continue playing that note continuously until I went back to the tab.

I imagine that it would be preferred for the score to continue playing when the user changes tabs/minimizes the window.

I believe this issue is tied to using requestAnimationFrame, as almost all browsers seem to pause this method when the tab is inactive, as explained in this StackOverflow post.

An alternate solution is to just stop the score temporarily if the tab is inactive, which should be easier.

DylanDavidson avatar Apr 07 '15 05:04 DylanDavidson

Hi Dylan. I see what you mean. My plan is to replace my poor excuse for a scheduling system with something that relies on either a continuous square wave oscillator (so I can change its frequency and thereby smoothly change speed) or anything else more accurate than what I’m doing right now. Sounds like part of that upgrade will require giving up on requestAnimationFrame as well. And yup—I do want the music to continue when a user switches tabs or windows or even applications because this would allow you to operate multiple Beep windows, other music applications, recording software, etc. I’m finishing up some other bits first but I’ll get to that shortly. (And thank you for pointing this out!)

stewdio avatar Apr 07 '15 14:04 stewdio