1

Playing audio definitely needs user interaction on mobiles but, my question is does loading audio also need user interaction?

If yes, what I want to do is preload the audio so when the user taps the play button, the audio can start playing faster, as it has already started loading.

Parth
  • 1,114
  • 3
  • 16
  • 25
  • to play it especially on iOS you need user click, yeah – trainoasis Feb 23 '16 at 08:18
  • Yes, but can I preload it and then when user clicks it starts playing? – Parth Feb 23 '16 at 08:19
  • I think you should be able to - see http://stackoverflow.com/questions/8375903/problems-preloading-audio-in-javascript and http://stackoverflow.com/questions/31060642/preload-multiple-audio-files – trainoasis Feb 23 '16 at 08:20
  • Let me try and I'll get back... – Parth Feb 23 '16 at 08:28
  • OK. So the audio can be loaded using XMLHttpRequest without user interaction, and one user interaction is required to start playing. I needed to play other audios without user interaction, so changing the src attribute of the audio element works – Parth Mar 03 '16 at 12:35
  • From iOS 10 onwards you can autoplay video without user interaction as long as it's muted: https://webkit.org/blog/6784/new-video-policies-for-ios/ – Tim Wachter Jan 05 '17 at 10:59
  • @TimWachter: Thanks for the info. However, the question was targetted towards audio rather than video. From this, it seems playing audio without user interaction would not be allowed obviously. – Parth Jan 06 '17 at 06:32
  • 1
    @Parth: True, you can get around that by using a touchmove event, but this is kinda hacky and will be disallowed in chrome 56 if I recall correctly – Tim Wachter Jan 12 '17 at 13:08

1 Answers1

0

User interaction need to load and play the audio or video in mobile device, Mobile device avoiding auto play on audio and video for bandwidth limitation. Sorry i cant comment that's why i post in answer.

mmativ
  • 1,414
  • 14
  • 25