YAL-Haxe / openfl-bitfive

Alternative blitting-targeted HTML5 backend for OpenFL.
103 stars 19 forks source link

Safari hates OGG #25

Closed cauli closed 10 years ago

cauli commented 10 years ago

Sadly, Safari can't play OGG audio files (yes, it is free, open-source, webkit Chrome supported it and yet...)

For total cross-browser compatibility it is necessary to add a secondary audio format that Safari can play (like .mp3 or .wav ).

Is there a way to do that already somehow?

YellowAfterlife commented 10 years ago

The mechanism is as following - you include both MP3 and OGG versions of same sound in assets (e.g. assets/sound/mus.mp3 & assets/sound/mus.ogg; Don't forget to modify application.xml filter to only load OGGs on HTML5). Then, for the actual code, you just pretend that it is Flash and work with MP3 versions of sounds. If MP3 is not supported, OGG sounds will be loaded automatically. It is worth saying that audio support is very basic (you can tell from line count in Sound.hx), but should be sufficient to play music and few sounds in a mobile game as long as common rules are followed and sounds are played as result of interaction with the game.

cauli commented 10 years ago

Great, thank you!