0

Recently, some code that has been working fine for months started to run unexpectedly. That code is just a media files loading JavaScript function, that uses jQuery. It's pretty long, but in essence it is like this:

var $audio=$('<audio>');
$audio.on('canplaythrough',function(e){
    $audio[0].play();
});
$audio.attr('src','song.ogg');

Basically, the file only loads sometimes, and sometimes stops loading with a suspend or even an abort event.

I have uploaded a little testing HTML to http://www.joanbotella.com/tests/loading , where you can see what's happening. You can download the test files from http://www.joanbotella.com/tests/loading/loadingTest.zip for local testing.

I have just checked that opening the test index.html file directly into Firefox, and not through my localhost Apache server, makes the audio files perfectly playable. So, I assume, my hosting and I have the Apache server misconfigured for serving media files.

My software versions are: Apache 2.2.22-1ubuntu1.7 , Mozilla Firefox 31.0 , Chromium 36.0.1985.125 and jQuery 1.11.0.

Edit: My Apache server configuration is very basic. I have just installed the package for my Linux Mint 13, alongside the php mod, and modified very little on the conf file. I think the problem is not related to my specific configuration, and many other people would be able to reproduce it on they own. Any extra info you would need for helping me, please, ask for it.

Edit: I have just checked that opening the test index.html file directly into Firefox, and not through my localhost Apache server, makes the audio files perfectly playable. So, I assume, my hosting and I have the Apache server misconfigured for serving media files. Some advices?

Edit: The user dan asked me to post my Apache mime types configuration. I think it is on the /etc/mime.types file, loaded through the mime.conf from the mod_mime . The file is too big to paste it in here, but you can check it on http://pastebin.com/sNs0kGAv.

Anyway, the ogg and mp3 related lines are like these:

audio/ogg                   oga ogg spx
video/ogg                   ogv
application/ogg                 ogx
audio/mpeg                  mpga mpega mp2 mp3 m4a
  • Works for me...if I open the debugger! Otherwise no. Maybe you've found a bug in Firefox. – Michael Hampton Aug 24 '14 at 21:16
  • I have tried to play the song locally and remotely, with the Firebug console opened and closed, using Firefox and Chromium, and the problem still appears. I don't think it is a browser issue. – Joan Botella Aug 24 '14 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.