Sign in to follow this  
mattbrand

Sound doesn't loop in Internet Explorer

Recommended Posts

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?

Share this post


Link to post
Share on other sites
On 8/10/2017 at 3:25 AM, samme said:

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?

Share this post


Link to post
Share on other sites
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. :(

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.