MP3 Playback 503 Error using Chromium-based browsers on mobile

265 views Asked by At

I am trying to play a MP3 file on our server on my Android. It plays fine in Chrome on Desktop, but when I use Chrome on Android, it throws back a 503 Service Unavailable error.

When I access the file directly on Chrome on Android, and using the 'Network' tab in Google Dev tools (using remote debugging), I see two HTTP requests:

Android
=======
(1)
Status: 200 OK
Type: audio/mpeg
Size: 1.3KB (the file should be around 36kB)

(2)
Status: 503 Service Unavailable
Type: text/html

Sometimes, the error throws a Varnish cache error instead.

On Desktop, we get the two expected response:

DESKTOP
=======
(1)
Status: 200 OK
Type: audio/mpeg
Size: 2.8KB

(2)
Status: 206 Partial Content
Type: audio/mpeg
Size: 36.9KB

I tried to access a different MP3 file on another website (http://www.noiseaddicts.com/samples/3711.mp3) using Android Chrome and that works fine and throws no error.

I tried using Firefox on Android and it works fine now. I tried using Safari on iOS, but it also doesn't play.

What can I do to get that MP3 file to play on these Chromium-based browsers?

UPDATE (UTC 0225 25 NOV 2014) I've been reading this thread which suggets encoding may be relevant, so using ffmpeg (not the libav version), I get this output (don't know if it's relevant):

Duration: 00:00:03.11, start: 0.000000, bitrate: 96 kb/s
Stream #0:0: Audio: mp3, 22050 Hz, mono, s16p, 96 kb/s

I was able to play this file in Chrome:

Duration: 00:00:07.87, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s

UPDATE (UTC 0406 25 NOV 2014) I used sox to convert the files to the same bitrate, stereo, Hz. But the first file still doesn't play while the second one does.

Someone also suggested it had something to do with AudioContext...so I am reading up on that.

1

There are 1 answers

0
dayuloli On BEST ANSWER

This problem probably had to do with some server settings I am unaware of, as moving the file to another server (our staging server) allowed it to be played without any problems.

I do not understand why, but by making the audio file longer than 5 seconds allowed it to be played back on the Android Chrome browser from the original server.

Hope this helps somebody! It sure is strange!