0

I'm trying to play MP3 or Ogg file, I create auto element (without appending it to DOM)

var $audio = $('<audio>', {preload: 'auto'}),
audio = $audio.get(0)

audio.src = "url/of/ogg/mp3 file"

audio.play()

Audio is not playing on iPad (it plays on desktop however)

WHITECOLOR
  • 24,996
  • 37
  • 121
  • 181

1 Answers1

0

If it's the same issue as with Video and I heavily think so:

The problem is, that on mobile iOS devices, Steve Jobs wants you to press play, before a video or audio file is loading. That stops kids from loading huge videos mobile without their explicit permission.

This is a business decicion of Apple. There are currently no workarounds the community is aware of.

Found another SO source: Duplicate Question

Community
  • 1
  • 1
nirazul
  • 3,928
  • 4
  • 26
  • 46
  • The problem is not in preload or autoplay. Even if I remove preload: auto or append element to DOM it doesn't work. audio.play() - is just command that I call when some button is clicked. I just don't understand why audio doesn't play at all on ipad. – WHITECOLOR Nov 19 '12 at 07:36
  • Try the same without js. Write a normal audio tag with source. And make sure that the iPad is not muted. – nirazul Nov 19 '12 at 08:48