mattgallagher / AudioStreamer

A streaming audio player class (AudioStreamer) for Mac OS X and iPhone.
http://cocoawithlove.com
1.93k stars 553 forks source link

Progress doesn't update after a period of time (iPhone) #39

Open philchass opened 13 years ago

philchass commented 13 years ago

Experiencing the issue with short (and large) MP3.

The streamer progress doesn't update after a period of time, the streamer falls in AS_STOPPING_EOF.

Try to test the iPhoneStreamingPlayer example with a small MP3 like http://www.universal-soundbank.com/mp3/sounds/17412.mp3

streamer.duration is 4.3 sec but the player stops progress at 1.7 ... while playing normally until the end !!

philchass commented 12 years ago

I used the iPhone demo app and took a bunch of sounds from http://sounddogs.com/results.asp?Type=3&CategoryID=3018&SubcategoryID=1

Result: all the sounds are not correctly played. Progress stops shortly +/- randomly.

I'd like to use this class in my project but unfortunately this issue is to huge!

pil-zz commented 12 years ago

My MP3 file duration is 12.7 sec, but progress is stop at 9.5, but sound is hearing.

freak4pc commented 12 years ago

I get the same bug, the "progress" stops 3 seconds before the actual song ends (for some reason)...

tehillim commented 12 years ago

I get the same bug.. watching this.

mikefrederick commented 12 years ago

Same here. There seems to be a partial but incomplete fix available here: http://stackoverflow.com/questions/7952318/audiostreamer-doesnt-show-the-correct-play-time.

azone commented 12 years ago

CHANGE:

        if (sampleRate > 0 && ![self isFinishing])
        {
            if (state != AS_PLAYING && state != AS_PAUSED && state != AS_BUFFERING)
            {
                return lastProgress;
            }
        ...
        }

TO:

        if (sampleRate > 0 && (state == AS_STOPPING || ![self isFinishing]))
        {
            if (state != AS_PLAYING && state != AS_PAUSED && state != AS_BUFFERING && state != AS_STOPPING)
            {
                return lastProgress;
            }
         ...
        }

in progress method

mattgallagher commented 12 years ago

I've added the change as suggested by azone. I haven't tested thoroughly but it shouldn't cause any problems. I'll close this when I've tested more thoroughly.