iphonehtmlipadipod

Is there anyway to autoplay online content audio file on ipad


I want to play audio file on ipad which is located on some server. but thing is I want to autoplay audio file using HTML5. Please suggest me the way.

Thanks


Solution

  • The autoplay attribute is purposely disabled on iPhone and iPad:

    In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.

    Having said that there are some hacks for iOS 3 and iOS 4 to work around this with JavaScript. On iOS 3 you can create a link element and then simulate a click event to trigger the media element to play; on iOS4 you can simply call the load() and play() methods directly on the element.