I noticed that $('audio') keeps being reinitialized. You should probably set it once somewhere and then reference that one.