简体   繁体   English

如何在iPhone中寻找流媒体音频?

[英]How to seek the streaming audio in iPhone?

I need to develop an audio streaming application ,which has the capability to play,pause and seek(fast forward). 我需要开发一个音频流应用程序,它具有播放,暂停和搜索(快进)的能力。 I have implemented the all operations except seek..I am using Matt's audio streaming sample code . 除了seek之外,我已经实现了所有操作。我正在使用Matt的音频流示例代码 Can anybody explain in detail about how to implement audio seek operation. 任何人都可以详细解释如何实现音频搜索操作。 I got an idea about seek operation. 我对寻求操作有了一个想法。 ie. 即。 using AudioQueueGetCurrentTime() method. 使用AudioQueueGetCurrentTime()方法。 But I cannot get the entire concept to implement it. 但我无法让整个概念得以实现。 So can you help me with a sample code? 那么你能帮我一个示例代码吗?

Thanks in advance, Syam 提前谢谢,Syam

dude i am working on the exact same thing. 老兄,我正在做同样的事情。 i looked forever!!! 我永远看着!!!

i tried 我试过了

SInt64 byteOffset;
            UInt32 ioFlags;
            NSLog(@"seek to packet %i", mainMP3delegate.seek_Packet);
            OSStatus err = AudioFileStreamSeek(inAudioFileStream, mainMP3delegate.seek_Packet, &byteOffset, &ioFlags);
            if (err) { PRINTERROR("seek error");  myData->failed = true;}

and i tried to change the start time to where i wanted 我试着将开始时间改为我想要的地方

AudioTimeStamp ts; AudioTimeStamp ts; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mSampleTime = 111110; ts.mSampleTime = 111110; NSLog(@"sample time %f", ts.mSampleTime); NSLog(@“采样时间%f”,ts.mSampleTime); ts.mSampleTime = mainMP3delegate.MP3_Timestamp; ts.mSampleTime = mainMP3delegate.MP3_Timestamp; NSLog(@"sample time %f", ts.mSampleTime); NSLog(@“采样时间%f”,ts.mSampleTime);

         err = AudioQueueStart(myData->audioQueue, &ts.mSampleTime);
         if (err) { PRINTERROR("AudioQueueStart"); myData->failed = true; return err; }     
         myData->started = true;

but neither worked 但都没有奏效

i know its something simple, i just don't know about, so I put up a bid on elance to get someone to solve it for money even!!! 我知道它的一些简单的东西,我只是不知道,所以我提出申请即可让别人为了钱而解决它! http://www.elance.com/jobs/16779786/iphone_application_audio_streaming_seek_scrub&&catId=11033&backurl=aHR0cDovL3d3dy5lbGFuY2UuY29tL3BocC9zZWFyY2gvbWFpbi9lb2xzZWFyY2gucGhwP21hdGNoVHlwZT1wcm9qZWN0I21hdGNoS2V5d29yZHM9aXBob25lJTIwc3RyZWFtJTIwc2VlayZzb3J0Qnk9JnNvcnRPcmRlcj0mcGFnZT0xJmNhdEZpbHRlcj0xMDAmc3ViY2F0RmlsdGVyPSZ0aW1lbGVmdEZpbHRlcj0mdGltZWxpc3RlZEZpbHRlcj0mYnVkZ2V0RmlsdGVyPS0xJmZlYXR1cmVkcHJvamVjdEZpbHRlcj1mYWxzZSZlc2Nyb3dwcm9qZWN0RmlsdGVyPWZhbHNlJmIyYnByb2plY3RGaWx0ZXI9ZmFsc2UmaG91cmx5cHJvamVjdEZpbHRlcj10cnVlJmZpeGVkcHJvamVjdEZpbHRlcj10cnVlJnN0YXR1c0ZpbHRlcj0xMDAzNyZhbWV4cHJvamVjdEZpbHRlcj0%3D&job_tier=11188 http://www.elance.com/jobs/16779786/iphone_application_audio_streaming_seek_scrub&&catId=11033&backurl=aHR0cDovL3d3dy5lbGFuY2UuY29tL3BocC9zZWFyY2gvbWFpbi9lb2xzZWFyY2gucGhwP21hdGNoVHlwZT1wcm9qZWN0I21hdGNoS2V5d29yZHM9aXBob25lJTIwc3RyZWFtJTIwc2VlayZzb3J0Qnk9JnNvcnRPcmRlcj0mcGFnZT0xJmNhdEZpbHRlcj0xMDAmc3ViY2F0RmlsdGVyPSZ0aW1lbGVmdEZpbHRlcj0mdGltZWxpc3RlZEZpbHRlcj0mYnVkZ2V0RmlsdGVyPS0xJmZlYXR1cmVkcHJvamVjdEZpbHRlcj1mYWxzZSZlc2Nyb3dwcm9qZWN0RmlsdGVyPWZhbHNlJmIyYnByb2plY3RGaWx0ZXI9ZmFsc2UmaG91cmx5cHJvamVjdEZpbHRlcj10cnVlJmZpeGVkcHJvamVjdEZpbHRlcj10cnVlJnN0YXR1c0ZpbHRlcj0xMDAzNyZhbWV4cHJvamVjdEZpbHRlcj0%3D&job_tier=11188

But, no luck. 但是,没有运气。 I ended up (for now) downloading the mp3 and seeking through the buffer like shown here, but it is not a good solution. 我最终(现在)下载了mp3并通过这里显示的缓冲区进行搜索,但这不是一个好的解决方案。

http://lists.apple.com/archives/coreaudio-api/2009/Jan//msg00143.html http://lists.apple.com/archives/coreaudio-api/2009/Jan//msg00143.html

man! 人! if you figure this out or someone does, i would go crazy. 如果你想到这个或有人,我会发疯的。 i also put up a bid on rentacoder that someone is working on, 我还对有人正在进行的租赁公司出价,

I was using the Matt's audio streaming sample code too, but I wasn't able to achieve a good seek with his code. 我也在使用Matt的音频流示例代码,但我无法用他的代码实现良好的搜索。

Now I'm using the MPMoviePlayerController that do the audio streaming and its seek function works great. 现在我正在使用MPMoviePlayerController进行音频流,其搜索功能非常有效。 The only problem is that the total time is calculated progressively, only when the download is in the end you can know the total time. 唯一的问题是总时间是逐步计算的,只有下载到最后才能知道总时间。

MPMoviePlayerController Class Reference MPMoviePlayerController类参考

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

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