简体   繁体   English

Matt Gallagher的AudioStreamer在播放状态前从偏移量播放mp3

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

I did not found solution for one issue: how to play mp3 file from offset immideately? 我没有找到解决一个问题的方法:如何从偏移量播放mp3文件?

I can only play file then send -(void)seekToTime: but in this case sound begins and interrupts then begins from defined offset. 我只能播放文件,然后发送-(void)seekToTime:但在这种情况下,声音开始,然后从定义的偏移开始中断。

I tried to apply seekToTime method on ASStatusChangedNotification (in different cases of AudioStreamerState ) but there were without result. 我试图在ASStatusChangedNotification申请seekToTime方法(在AudioStreamerState不同的情况下),但毫无结果。

upd: I think that may set time offset after the file began streaming (before playing). upd:我认为这可能会在文件开始流式传输(播放之前)后设置时间偏移。 But how? 但是如何?

Thanks. 谢谢。

What I did was create a method to seek to the desired time that I run after [streamer start] : 我所做的是创建一种方法来寻找[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/ 该博客文章另有介绍: http : //www.saygoodnight.com/2009/08/streaming-audio-to-the-iphone-starting-at-an-offset/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM