StratosDrop Posted June 5, 2015 Share Posted June 5, 2015 I'm having trouble getting sound to play on an iphone (safari browser). I've tried .ogg, .mp3 and .m4a with no luck. I'm trying to limit filesize by loading the format according to device type. Here is the relevant code - if ( this.game.device.desktop || this.game.device.android){ this.load.audio('titleMusic', ['Audio/mainMenu.mp3']); } else if (this.game.device.iOS) { this.load.audio('titleMusic', ['Audio/mainMenu.ogg']); } Is this ok? Link to comment Share on other sites More sharing options...
rich Posted June 5, 2015 Share Posted June 5, 2015 You should use m4a for iOS. Also make sure the bitrate isn't too high or it won't play at all, or will play corrupted. clark 1 Link to comment Share on other sites More sharing options...
StratosDrop Posted June 5, 2015 Author Share Posted June 5, 2015 I tried m4a as well, but it didn't play (as opposed to .ogg which didn't get past the preloader). What do you suggest as the ideal bitrate? My m4a has a bitrate of 145, but again, no sound when the game loads. Link to comment Share on other sites More sharing options...
rich Posted June 5, 2015 Share Posted June 5, 2015 You should provide both formats: m4a and ogg, and neither above 44100 Hz. Phaser will load the format it knows it can play on the device. Link to comment Share on other sites More sharing options...
Recommended Posts