mattbrand Posted January 30, 2017 Share Posted January 30, 2017 Hey all! I add a music track that I want to loop using this code: music = new Phaser.Sound(game, "music", 1, true); It loops correctly everywhere except on IE. Has anyone has this issue? Is the work-around to have an event fire on sound complete? Link to comment Share on other sites More sharing options...
ozdy Posted August 9, 2017 Share Posted August 9, 2017 Happens to me too. Link to comment Share on other sites More sharing options...
samme Posted August 10, 2017 Share Posted August 10, 2017 Check http://phaser.io/examples/v2/audio/loop? Link to comment Share on other sites More sharing options...
ozdy Posted September 27, 2017 Share Posted September 27, 2017 On 8/10/2017 at 3:25 AM, samme said: Check http://phaser.io/examples/v2/audio/loop? I spent a whole day wondering why my code doesn't work but this does. It turns out it wasn't my code, it was the mp3 - the 7 seconds mp3 in the sample works with my code too, but a 1 minute music mp3 doesn't I tried .ogg too without success. Anyone else experience this? Link to comment Share on other sites More sharing options...
abhivaidya Posted January 2, 2018 Share Posted January 2, 2018 Any luck with this? I am having the same problem. Link to comment Share on other sites More sharing options...
samme Posted January 2, 2018 Share Posted January 2, 2018 @marcusfenix does examples/v2/audio/loop work in your IE? Link to comment Share on other sites More sharing options...
abhivaidya Posted January 3, 2018 Share Posted January 3, 2018 12 hours ago, samme said: @marcusfenix does examples/v2/audio/loop work in your IE? It does work for me.... I guess it is a problem with my mp3 file just like @ozdy Not sure if there is something to do with the encoding of the mp3 file. Any idea @samme? Edit: Update When I use the same sound from the Phaser example in my project, it does not loop. Link to comment Share on other sites More sharing options...
samme Posted January 3, 2018 Share Posted January 3, 2018 Are you using loopFull? Link to comment Share on other sites More sharing options...
abhivaidya Posted January 4, 2018 Share Posted January 4, 2018 Yes I am using loopFull. However, I have observed a couple of things here: Think loopFull uses the same play function with loop being set to true. Just made sure that my mp3 is similar to the one the example. By that I mean, the mp3 encoding is Mono, at 96bps and 44100KHz. This is a very IE specific issue. When I hosted the same game on another web host, the looping works and also, the looping events are fired. I compared the headers from both hosts and they are different. I am still investigating into this issue and will post an update once I have an answer. Link to comment Share on other sites More sharing options...
alex_h Posted January 4, 2018 Share Posted January 4, 2018 IE doesn't support web audio, it has to use HTML tag audio playback instead, hence not looping. https://caniuse.com/#feat=audio-api Link to comment Share on other sites More sharing options...
abhivaidya Posted January 4, 2018 Share Posted January 4, 2018 33 minutes ago, alex_h said: IE doesn't support web audio, it has to use HTML tag audio playback instead, hence not looping. https://caniuse.com/#feat=audio-api That's right @alex_h However, this is not related to Web Audio or HTML Audio, because some sounds loop fine. So it is related to how it is encoded and the response header is what I think as of now. Link to comment Share on other sites More sharing options...
alex_h Posted January 4, 2018 Share Posted January 4, 2018 Oh yeah, I didn't see your post about different response headers from different hosts. Do you see the same effect on those two hosts if you use other audio formats, ie .ogg and .m4a? If not then maybe avoiding the mp3 format is a good way to work around the issue? {Edit} ok I also just noticed Ozdy above says the same thing happened with .ogg too... doh! Link to comment Share on other sites More sharing options...
abhivaidya Posted January 4, 2018 Share Posted January 4, 2018 Ok I got it working!! IE needs to read the "Content-Length" in the header to trigger events like onLoop. My server being Apache, compresses the files being served using gzip. Disabling this through an .htaccess file in my sounds folder fixed this issue. You can do that by creating one and inserting SetEnv no-gzip 1 This however will disable gzip for the whole folder so please use it accordingly. Hope this helps someone. Tilde and samme 1 1 Link to comment Share on other sites More sharing options...
samme Posted January 4, 2018 Share Posted January 4, 2018 That's interesting. I wonder if you could also wait for the Phaser.Sound#onDecoded signal. By then IE must have the complete sound and should know its length. Link to comment Share on other sites More sharing options...
abhivaidya Posted January 5, 2018 Share Posted January 5, 2018 It wasn't getting the Content-Length and hence duration as 0. I guess that explains the problem. Link to comment Share on other sites More sharing options...
Recommended Posts