danielstern/ngAudio

Won't playback on iOS 9

davidrhoderick opened this issue · 1 comments

I realize there are similar errors as per #70 and #147 but I am not using autoplay so this should work. Here is the code (it's old and not the best but I am trying to wrap up a project from my n00b times):

function loadAudio() {
  var audioFiles = [
    '1-soundscape-quiet.mp3',
    '2-soundscape-treesgrowing.mp3',
    '3-soundscape-treesbirds.mp3',
    '4-soundscape-fullforestbirds.mp3'
  ];

  for(var i = 0; i < audioFiles.length; i++) {
    $scope.sounds.push(ngAudio.load('sounds/' + audioFiles[i]));
    $scope.sounds[i].volume = 0;
    $scope.sounds[i].loop = true;
    $scope.sounds[i].play();
  }

  $scope.sounds[0].volume = 1;
}

loadAudio() is called after an "NGREPEATCOMPLETE" event, which is occurring (just checked).

And then I change the volume based of each using a mixing function (which I can put up if necessary). Basically, I'm getting no sound even from the first play() call. Any ideas? Is this still webkit stopping playback?

EDIT
I was able, on very few occasions, to get audio to playback on iOS but I can't yet figure out how I did it nor why it started.

Try setting unlock to true (see docs)