Closed KatieWoe closed 5 years ago
I just ran a test with some debug code and found that the audio context is being placed in the "interrupted" state in this case. This is also what we saw sometimes when going into full screen mode in Safari, see https://github.com/phetsims/resistance-in-a-wire/issues/190.
Since this problem was occurring on mobile Safari, I wanted to make sure that it wasn't happening on the non-mobile version. I tested on PhET's MacBook Pro "Dirac" running 10.11.6 "El Capitan" and Safari version 11.1.2, and the problem did not occur. In other words, I could switch between tabs, play sound on both, and it continued to work on both.
The title of this issue is a little misleading. The problem only occurs if you open a sonified sim in both tabs. Specifically (and these sequences were done on the iPad 2 "Tycho"), if I open RIAW in one tab and then open a 2nd tab and go to Google, then switch back to the original RIAW screen, sound still works fine. I also tested the same scenario but instead of Google I opened a non-sonified PhET sim (acid-base-solutions in this case), and again, sound worked fine upon returning to the RIAW tab. However, when I loaded the currently published version of John Travoltage in the 2nd tab, sound was gone when returning to the RIAW tab. It would seem the using sound in a 2nd tab is what kills it for the first.
I've added code that resumes the audio context if it is in the "interrupted" state when the sim becomes visible after being made not visible. This seems to improve the situation quite a bit, though I could still make the audio go away on iOS 11 after a lot of switching between tabs.
I'm going to call this fixed because I believe it fixes the scenario described in https://github.com/phetsims/resistance-in-a-wire/issues/199#issue-384503266, because lots of tab switching between sound-generating sims is probably a fairly rare use case, because a reload fixes the issue, and because I'm not sure there's much else we could do.
Fixed (more or less) in 1.6.0-rc.2, unassigning while we await the results of the RC test.
I had this happen once in rc.2 though I haven't gotten it to happen again. iOS 12. @jbphet
I think it's reasonable to close this at this point.
Device iPad OS iOS 9 and 11 at least Browser Safari Problem Description For https://github.com/phetsims/QA/issues/219. Found by @jbphet on iOS 9 device. When two tabs of resistance in a wire are open and one plays sound this disables the other tab's sound. This only occurs if the tabs have been in landscape mode. In portrait this does not occur. I did not reproduce this on Mac OS safari. The published version of John Travoltage did not seem to exhibit this behavior. Steps to reproduce