Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound Disappears when two tabs are open in landscape #199

Closed
KatieWoe opened this issue Nov 26, 2018 · 7 comments
Closed

Sound Disappears when two tabs are open in landscape #199

KatieWoe opened this issue Nov 26, 2018 · 7 comments
Labels

Comments

@KatieWoe
Copy link
Contributor

KatieWoe commented Nov 26, 2018

Device
iPad
OS
iOS 9 and 11 at least
Browser
Safari
Problem Description
For phetsims/qa#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

  1. Make sure iPad is in portrait mode and keep there until instructed
  2. Open the sim
  3. Open a second tab and open the sim there
  4. Play with sliders on first tab
  5. Play with sliders on second tab
  6. Play with slider on first tab again
  7. Switch to landscape
  8. Play with sliders on first tab
  9. Play with sliders on second tab
  10. Play with slider on first tab again
@jbphet
Copy link
Contributor

jbphet commented Dec 11, 2018

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 #190.

@jbphet
Copy link
Contributor

jbphet commented Dec 11, 2018

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.

@jbphet
Copy link
Contributor

jbphet commented Dec 12, 2018

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.

@jbphet
Copy link
Contributor

jbphet commented Dec 12, 2018

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 #199 (comment), 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.

@jbphet
Copy link
Contributor

jbphet commented Dec 13, 2018

Fixed (more or less) in 1.6.0-rc.2, unassigning while we await the results of the RC test.

@jbphet jbphet removed their assignment Dec 13, 2018
@KatieWoe
Copy link
Contributor Author

I had this happen once in rc.2 though I haven't gotten it to happen again. iOS 12. @jbphet

@jbphet
Copy link
Contributor

jbphet commented Dec 28, 2018

I think it's reasonable to close this at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants