JeffS
JeffS

Reputation: 2737

MediaElement.js audio not playing on some devices

I'm getting reports that our MediaElement.js audio player is not working on one particular Android phone. Edit: Some mp3 files work, others don't. The mp3 files are all Mono 128kbs CBR with no ID3 tags.

We have just one audio source, an mp3, with all default options.

The html is:

<audio src ="/path/to/a/file.mp3" type='audio/mp3'>

The phone is a HTC Incredible 2 running 2.3.4, in the default browser. The same page works on my 2.3.4 device I have for testing, and the android emulator (without Flash) for 2.3.3.

According to the user, the player loads correctly, and looks right, however, regardless of the audio file's actual length, the length is displayed as 1:40:00. Clicking play a second time often will start playback.

Anyone with ideas as to where to go from here?

Upvotes: 2

Views: 2711

Answers (1)

tkone
tkone

Reputation: 22748

The audio/video codec library implementation is unique to the hardware vendor in Android -- not all the devices use the same libraries for audio/video decoding since they use different hardware for these purposes.

Because of this, especially in older versions of Android, media playback is unreliable.

I spent six years at Viacom handling mobile video and audio delivery and this was one of the most vexing issues I've ever encountered because there's no equitable solution to the problem, especially since you can't force people to just have Flash (which, lets face it, is a horrible solution).

We spent many hours with Google developer advocates discussing this -- the upside is that they revamped the acceptance suites for later versions of the OS meaning 3.X and 4.X have MUCH better inter-company compatibility with regards to media playback.

My favorite bug is that if you have an MP4 video file with mis-aligned audio and video tracks (they start at different times which is compliant with the spec), Motorola phones running any of the 2.X series will play no audio at all.

So I guess, my answer is that you can't guarantee reliable playback on these devices and that you should inspect the audio properties to ensure that all the files are being generated by the same codec AND encoder with the same properties.

Also I would check to see if some are stereo, some are mono, which ones have IDv3 tags, which ones don't, etc -- the codecs are really that picky.

It's quite a shame since these companies have no incentive to upgrade OS on their older devices as well as we're stuck in the mobile community with a sea of incompatible hardware that claims compatibility so we can't even test for features, but, rather, must explicitly test for not only device data but software build IDs as well.

Upvotes: 2

Related Questions