On my page, I dynamically create an HTML5 Audio element in JavaScript:
bell = new Audio("alarmclock.mp3");
Later on (in response to a jQuery Countdown object expiring), I play it:
bell.play();
Results:
- Chrome (6.0.472.55) for Mac: The audio plays fine.
- OmniWeb (5.10.2): The audio plays fine.
- Safari (5.0.1) for Mac:
I hear nothing.The audio plays fine. (I don’t know why it didn’t work earlier.) - MobileSafari (iOS 3.1.3—the latest version for my device): I hear nothing.
How would I go about troubleshooting this? I’d really like to have it working in MobileSafari so my web app can be portable.
About iPhone Safari: It seems play() work when launched by an onclick event.
See http://groups.google.com/group/iphonewebdev/browse_thread/thread/91e31ba7ae25e6d4?hl=en