2

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.

user612856
  • 21
  • 2

1 Answers1

0

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/

Sammy Larbi
  • 3,062
  • 3
  • 26
  • 21
  • Thanks you, I solved it's similar. But the example in blog is not good solution... – user612856 Jul 29 '12 at 17:55
  • It doesn't work as-is because some of the instance variables and calculations have changed, but following a similar approach works fine. One thing you have to keep in mind is that the first time the bit-rate is set it may be inaccurate (in fact in all my trials it is wrong, and obviously wrong: always under 1.0) .. so if you wait until bitRate > 1.0 it works better. – Sammy Larbi Jul 29 '12 at 21:01