title: JavaScript recognize when audio get paused or finished playing with using If Statement
body: <p>I am currently making a website using JavaScript on Canvas.
  (my English is not very good so I hope you guys understand my situation)</p>
  
  <p>Basically when website runs, the background music plays. (let say bg music is "A")
  And if mouse pointer is over an image, it plays button sound effect. (let say button music is "B")</p>
  
  <p>So, if Mouse Pointer is over an image it plays "B" audio and "A" audio reduce the volume by doing A.volume=0.5;  (and this works) 
  However if "B" audio is finished or get paused, it would not bring "A" audio's volume back to normal.</p>
  
  <p>I coded like following:</p>
  
  <pre><code>function recognizeSoundIsFinished(){
  if(B.currentTime == 0){
        A.volume = 1;
  }setTimeout("recognizeSoundIsFinished()",30);}
  </code></pre>