Sound with iOS HTML5

I can’t seem to get audio working on iOS HTML5 when using recent versions of OpenFL. I’ve tried using both .mp3 and .wav files. I’ve added the play command to an onMouseDown event, as I’m aware that iOS browsers require this for the audio system to be unmuted. I’ve tried using OpenFL and more directly through Lime. I’ve tried with the audio embedded, and not.

The problem doesn’t appear to exist in older versions of OpenFL, as I’ve found some older projects that do play audio, though nothing recent.

Any help would be appreciated!

Example Code

class Main extends Application {
	private var soundA:AudioSource;

	public function new () {
		super ();
	public override function onMouseDown (_, _, _, _):Void {
			soundA = new AudioSource (Assets.getAudioBuffer ("assets/sound.mp3")); ();

An update to this, I was able to resolve the issue by editing the fromFile function in AudioBuffer.hx in the lime library and changing

audioBuffer.__srcHowl = new Howl ({ src: [ path ], preload: false });


audioBuffer.__srcHowl = new Howl ({ src: [ path ], html5:true, preload: false });

Forcing howlerjs to use html5 audio over web audio.

1 Like