Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: HTML5 media loading sometimes suspends or aborts |
|
Author |
|
Hitmark7
Joined: 28 Aug 2014 Posts: 3
|
Posted: Fri 29 Aug '14 19:28 Post subject: HTML5 media loading sometimes suspends or aborts |
|
|
Recently, some code on a web application 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:
Code: | 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: Linux Mint 13, Apache 2.2.22-1ubuntu1.7 , Mozilla Firefox 31.0 , Chromium 36.0.1985.125 and jQuery 1.11.0.
My Apache server configuration is very basic. I have just installed the package, 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.
I have checked the Apache error.log after a suspended loading, but nothing was added to it. Any extra info you would need for helping me, please, ask for it.
Could you help me? Thanks in advance! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 01 Sep '14 11:33 Post subject: |
|
|
Only for the directory these files are served from, try adding:
EnableSendfile On |
|
Back to top |
|
Hitmark7
Joined: 28 Aug 2014 Posts: 3
|
Posted: Wed 03 Sep '14 22:50 Post subject: |
|
|
I have done as you said, on my global .conf first, and then on a .htaccess, but nothing worked. I have restarted the service after each change, of course.
The official Apache documentation at http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile says that the default value for that directive is On, so I have tried also setting it off. Nothing changes.
Have you been able to reproduce the problem? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 04 Sep '14 22:21 Post subject: |
|
|
Yes/No
Different browsers (IE & FF tested) have different success rates.
2.2.29 Win32 vs. 2.2.24 Unix also have different success rates.
IE never wavered, it does not do ogg file but for island.mp3 it never failed.
I think it's the browser. With Firefox changing all the time, I think I would point at it as being the culprit in my testing and how it deals with the jquery as a simple html5 audio tag never failed on it. |
|
Back to top |
|
Hitmark7
Joined: 28 Aug 2014 Posts: 3
|
Posted: Mon 08 Sep '14 21:48 Post subject: |
|
|
I've been running the test on several browsers on a Wampserver 2.5 , on a Windows Vista:
Internet Explorer 9.0.8112 : The mp3 always plays.
Chrome 37.0.2062.103 : It plays everything, flawless.
Firefox 32 : Random results, as the Linux version.
Opera 24 : The ogg always plays.
Safari 5.1.7 : The mp3 always plays.
I think you are right, and Apache is not the responsible of this behaviour.
Please, keep me posted if you test on other systems and configurations.
Thanks. |
|
Back to top |
|
|
|
|
|
|