0 votes
asked by (210 points)
I have a project in Sugarcube v2, and I can't get any of the audio to play in Internet Explorer or Microsoft Edge. To test the issue, I made a simple story that just caches a single audio file using the <<cacheaudio>> macro and tries to play it back. The audio plays seamlessly in Firefox and Chrome, but when I open the file in Edge or IE, I get the following error:

"Your browser either lacks or has disabled the Web Storage API, so this game is running in a degraded mode. You may be able to continue, however, some parts may not work properly."

No sound plays. This doesn't seem to be a problem with my specific browser configuration, since I've found other Sugarcube games online that include audio that work fine in my instances of IE and Edge. Any advice? What can I do to get my sound working in these browsers?

2 Answers

0 votes
answered by (59.8k points)
If you're running your game from the file system, IE (and Edge, maybe) will give you a lot of trouble. They generally block a lot of stuff and have incredibly tight security when running from the file system. I'd recommend getting another browser to test with.
0 votes
answered by (60.1k points)

The warning about the Web Storage API has no bearing at all on whether media can be played; the two are completely unrelated.  I know that, in general, audio will play in both IE and Edge with local files, so that's not an issue either.

So, questions:

  1. Are you opening the file from the exact same location in all browsers?
  2. What audio format are you attempting to play?
  3. What does your <<cacheaudio>> invocation look like and within what passage did you place it?
  4. What does your <<audio>> macro invocation look like and within what passage did you place it?
  5. How are you invoking the <<audio>> macro?  E.g. Just loose within the passage, within a <<link>> macro, etc.
commented by (210 points)
Let's see:

1. The file is opened from the same location in all browsers.

2. Neither .ogg or .mp3 files are playing.

3. My <<caucheaudio>> command is invoked in a separate StoryInit passage. It reads:

<<cacheaudio "glass_music" "file:///C:/[path omitted]/glass_music.ogg" "file:///C:/[path omitted]/glass_music.mp3">>

4. My <<audio>> command is in its own, untitled passage that is set as the starting point of the story. It reads:

<<audio glass_music play>>

5. The <<audio>> macro is loose within the passage. The only content of this story is a StoryInit passage with a single cache command, and a separate passage with an audio macro invocation.

 

Thanks!
commented by (59.8k points)
reshown by
Try putting quotes around the track name in the <<audio>> call.
commented by (131k points)

My <<caucheaudio>> command is invoked in a separate StoryInit passage. It reads:

Those are Fully Referenced URL's and as such may not work on other people's machines.

commented by (60.1k points)

I'm going to assume the absolute file URLs were just for testing because that's not going to work anywhere but on your computer.  If not, then you'll need to change those before you distribute your project's published HTML file.

Nothing you've mentioned should keep audio from playing in either IE or Edge.  A similar setup works just fine for me in both.  I'm at a loss here.

Can you publish a sample HTML file someplace?

 

PS:  Attempting to play audio in the starting passage is probably not a good idea in general. Mobile browsers have long required user interaction before allowing playback.  Somewhat more recently, Chrome has followed suit and implemented the same restriction.  See the warnings (no. 2 in particular) under Audio Macros for more information.   To be clear, this shouldn't be an issue for IE or Edge, just a general heads up.

commented by (210 points)
This is very interesting&mdash;I uploaded my sample to a website, and the sound plays fine in IE/Edge when hosted on an external server, just not when opened directly from my computer.

 

The sample is here: http://jonsorce.com/testers/sugarcube_sound_test/tester.html
commented by (60.1k points)
I meant so that it could be tested locally (since that's what the issue is about).

Regardless.  I downloaded both the HTML file and the MP3, recreated your directory structure, and tested the HMTL file directly from the filesystem in both IE and Edge.  Both played the audio without issue, so at this point I can only assume that your issue is something unique to your setup.
...