mozilla-b2g/gaia — pull request #11402 by tdz (2013-08-07 17:03:34+00:00)
Title: Bug 783512: Remove timer for switching tracks in Music app

As reported in bug 783512, for some MP3 files, no 'ended' events
are fired by Gecko. The workaround for this bug introduced a timer
for switching tracks in the music player. When the timer expires,
it switches the Music app to the next track in the play list.

The problem is caused by Android's way of computing the duration of
an MP3 file. MP3 files are split into short frames with a duration
of a few milliseconds each. The actual value per frame depends on
the frame's bit rate. Android's implementation computes the duration
of the first frame using its bit rate, and approximates the track's
duration from that bit rate. Many MP3 files use varying bit rates.
This results in an incorrect duration for the whole track.

With the fix for bug 831224, we support MP3 files with varying bit
rate directly in Gecko.

This patch thus removes the workaround for bug 783512 from the Music
app. The app now registers an event listener for 'durationchange'
events, which get fired when the duration of an MP3 file has been
updated.

Signed-off-by: Thomas Zimmermann