Matt Gallagher's AudioStreamer play mp3 from offset before playing state

733 views Asked by At

I did not found solution for one issue: how to play mp3 file from offset immideately?

I can only play file then send -(void)seekToTime: but in this case sound begins and interrupts then begins from defined offset.

I tried to apply seekToTime method on ASStatusChangedNotification (in different cases of AudioStreamerState) but there were without result.

upd: I think that may set time offset after the file began streaming (before playing). But how?

Thanks.

1

There are 1 answers

2
Sammy Larbi On

What I did was create a method to seek to the desired time that I run after [streamer start]:

while(streamer.bitRate == 0) { sleep(1); }

If you're concerned about waiting too long, you can add a time out: either a count of times through the loop, or set a start time and compare it to the current time to break out of the loop.

This blog post has another take: http://www.saygoodnight.com/2009/08/streaming-audio-to-the-iphone-starting-at-an-offset/