[Solved] IOS Sound problems

I have trouble getting my openfl project to play sounds. I get an Error Null Object Reference error even though I know that it reads the files (when I change the name to something else it says cant find that sound)

So I am wondering if anyone can help me clear up a few things.

First of all, which sound format does IOS support? I’ve tried both mp3 and ogg without success. When I’m googling this some people say that ios support mp3 only, while others say ogg, so I’m confused.

Further on, is this the correct way to declare the path in project.xml?
<assets path=“assets/sounds” rename “sounds” include="*.ogg" type=“sound” if=“ios” />
or is this satisfactory:
<assets path=“assets/sounds” rename “sounds” />

I play the sounds like this (works on Android, flash)

mySound = new Sound();
mySound = Assets.getSound(“sounds/soundfile.ogg”);
mySound.play();

If anyone could help me it would be very appreciated!

Only flash has support for mp3, iOS need ogg.

Tip you can remove the line mySound = new Sound();.

What does Assets.getSound("sounds/soundfile.ogg"); returns? An object or null?
What about Assets.exists("sounds/soundfile.ogg"); true or false?

Thanks for helping me once again.

Well, this is weird. It looks like the result isn’t consistent. Usually I don’t get anything in return except Error Null Object Reference. But after changing the filename to something that doesnt exist and back again, it start to return values.

I then get that Assets.getSound(“sounds/soundfile.ogg”); returns null, while Assets.exists(“sounds/soundfile.ogg”); returns true. So I really don’t know whats going on. But as I type this, I realize that my soundfiles start with a capitol letter like sounds/Soundfile.ogg can that be the problem?
I’ll try changing it to see if that helps…

UPDATE: Removed capitol letters but same result.

I solved it. When i used -Dlegacy to build it instead of -Dhybrid everything works great.

Thanks again!