While developing an HTML5 web page with audio functionality using JavaScript, I encountered an issue. Initially, the basic version of my webpage successfully loaded and played audio files in different formats (e.g., ogg vs mp3) across various OS/browser combinations such as OSX (Safari, Chrome, Firefox), iOS 5 and 6 (Safari), Windows 7 (Firefox, Chrome), and Android 4.2 (Firefox). This basic version consisted of only one JavaScript file.
Upon integrating the audio code into the production version of the website, which includes other JavaScript libraries like jQuery, jQuery UI, and flot, I faced a problem specifically on iOS devices (tested on iPad2 and iPad3 running iOS 5 and 6). The error message displayed was:
INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.
The error occurred when trying to set the current time of the sound object based on a specific sprite data:
mySound.currentTime = spriteData[currentSound].start;
Interestingly, the same code ran without errors on the iOSSimulator for both iOS 5 and 6 simulations.
Seeking advice on how to debug this issue, any suggestions or insights would be greatly appreciated as I'm unsure where to focus my efforts. Thank you.