phetsims / reactants-products-and-leftovers

"Reactants, Products and Leftovers" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 4 forks source link

Sound on Reward Screen Plays Before Image - iPad 2 #60

Closed KatieWoe closed 6 years ago

KatieWoe commented 6 years ago

Test device: iPad 2 Operating System: iOS 9.3.5 Browser: Safari 9 Problem description: For phetsims/QA/issues/162 When a level of the Game screen is beaten the sound effect of cheering will play a few seconds before the actual victory screen is shown. Steps to reproduce:

  1. On an iPad 2 iOS 9, enter the Game screen and choose a level. This was done on level 1.
  2. Input the correct answers for all 5 questions.
  3. After getting the correct answer on the last question, select next
  4. Sound effects will begin playing before the screen changes

Screenshots: https://drive.google.com/file/d/1eWhVYMHk6unaqzWwaCpXTuitRhIwVbyO/view?usp=sharing

pixelzoom commented 6 years ago

This has not been a problem in the past, and this sim has had no changes. So I suspect that it's related to @jbphet's recent changes to sound. Let's get him involved.

pixelzoom commented 6 years ago

@KatieWoe Does this problem occur in other sims that have a similar reward screen? E.g. run BCE master with ?showAnswers, play a perfect game, and see if the sound plays before the reward is displayed.

jbphet commented 6 years ago

+1 on what @pixelzoom just said - it will save me time in tracking this down if we know whether it happens on other sims on master as well as currently published sims.

KatieWoe commented 6 years ago

Just tested this on BCE master. It doesn't seem to occur, or if it does the victory screen appeared quickly enough that I didn't notice it.

pixelzoom commented 6 years ago

Playing the game reward sound (cheer.mp3) is initiated by sim-specific code, by calling gameOverPerfectScore in VEGAS/GameAudioPlayer, and should do so after showing the reward.

BCE has things in the correct order. See GameScreenView line 106:

      // game reward, shown for perfect score (or with 'reward' query parameter)
      if ( this.model.isPerfectScore() || BCEQueryParameters.showReward ) {
        this.rewardNode = new BCERewardNode( level );
        this.rootNode.addChild( this.rewardNode );
      }
...
      // Play the appropriate audio feedback.
      if ( this.model.isPerfectScore() ) {
        this.audioPlayer.gameOverPerfectScore();
      }
      else {
        this.audioPlayer.gameOverImperfectScore();
      }

RPAL does things in the incorrect order. See ResultsNode line 43:

        if ( model.isPerfectScore() ) {

          audioPlayer.gameOverPerfectScore();

          self.rewardNode = new RPALRewardNode( model.levelProperty.get() );
          self.addChild( self.rewardNode );
        }

So... I'll try changing the order in RPAL, and see if that fixes the problem.

pixelzoom commented 6 years ago

User interface components (LevelCompletedNode and RewardNode) are now added to the scenegraph before initiating the "cheer" sound. See above commits to master.

@KatieWoe can you please re-test on the device that exhibits the problem?

KatieWoe commented 6 years ago

Seems fixed in master

pixelzoom commented 6 years ago

Thanks @KatieWoe. I'll proceed with patching the 1.2 branch.

pixelzoom commented 6 years ago

1.2 branch has been patched. Labeling for regression testing in 1.2.0-rc.2.

KatieWoe commented 6 years ago

Looks much better