AudioStreamer 未显示正确的播放时间
我有一个 ios 应用程序,它通过流式传输并使用 mattgallagher AudioStreamer 库来播放音乐,它不显示真实的播放时间,并且永远不会在 0 秒时停止播放...
有谁知道为什么会发生这种情况?
多谢!
i've one ios application that plays music by streaming and using the mattgallagher AudioStreamer library it doesn't show the real playtime and never stop play at 0 secs...
Does anyone know why this happens??
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我经历过类似的事情。查看AudioStreamer.m 中的progress 方法
现在,进度显示不正确的原因在于两个if 语句。当您的
AudioStreamer
即将完成时(可能是在加载所有数据时),它的isFinishing
变为 true,这使其返回进度的缓存值。此外,流媒体状态变为AS_STOPPING
,这使得第二个 if 语句返回lastProgress
。您真正想要的是更新进度,直到流媒体停止。我对代码的以下修改做到了这一点,并且看起来工作正常。然而,鉴于 AudioStreamer 的总体质量以及它是由 Matt Gallagher 开发的事实,这些 if 语句可能是有原因的。到目前为止,我修改后的代码没有遇到任何崩溃或类似情况,但您应该在您的应用程序中对其进行彻底测试。请注意,一旦流媒体完成,我就不再查询进度。如果你这样做,测试它是否有效:)
I experienced something similar. Have a look at the progress method in AudioStreamer.m
Now, the reason for the progress not being displayed correctly lies within the two if-statements. When your
AudioStreamer
is nearly finished (probably when all data is loaded), it'sisFinishing
becomes true, which makes it return the cached value for progress. Also, the streamer state becomesAS_STOPPING
, which makes the second if-statement return thelastProgress
. What you really want is to update the progress right until the streamer stops.My following modification to the code does this and it seems to work fine. HOWEVER, given the general quality of the AudioStreamer and the fact that it's developed by Matt Gallagher, those if statements might be as they are for a reason. So far, I did not experience any crashes or alike with my modified code but you should thoroughly test it in your app. Note, that, once the streamer is done, I don't query the progress anymore. If you do, test if it works :)
该问题已得到解决:
https://github.com/mattgallagher/AudioStreamer/issues/39
The issue has been addressed:
https://github.com/mattgallagher/AudioStreamer/issues/39