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

时间:2021-11-27 19:00:58

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. Can anybody explain in detail about how to implement audio seek operation. I got an idea about seek operation. ie. using AudioQueueGetCurrentTime() method. But I cannot get the entire concept to implement it. So can you help me with a sample code?

我需要开发一个音频流应用程序,它具有播放,暂停和搜索(快进)的能力。除了seek之外,我已经实现了所有操作。我正在使用Matt的音频流示例代码。任何人都可以详细解释如何实现音频搜索操作。我对寻求操作有了一个想法。即。使用AudioQueueGetCurrentTime()方法。但我无法完成整个概念。那么你可以帮我一个示例代码吗?

Thanks in advance, Syam

提前谢谢,Syam

2 个解决方案

#1


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; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mSampleTime = 111110; NSLog(@"sample time %f", ts.mSampleTime); ts.mSampleTime = mainMP3delegate.MP3_Timestamp; NSLog(@"sample time %f", ts.mSampleTime);

AudioTimeStamp ts; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mSampleTime = 111110; NSLog(@“采样时间%f”,ts.mSampleTime); ts.mSampleTime = mainMP3delegate.MP3_Timestamp; 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

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,

人!如果你想到这个或有人,我会发疯的。我还对有人正在进行的租赁公司出价,

#2


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. 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执行音频流,其搜索功能非常有效。唯一的问题是总时间是逐步计算的,只有下载到最后才能知道总时间。

MPMoviePlayerController Class Reference

MPMoviePlayerController类参考

#1


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; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mSampleTime = 111110; NSLog(@"sample time %f", ts.mSampleTime); ts.mSampleTime = mainMP3delegate.MP3_Timestamp; NSLog(@"sample time %f", ts.mSampleTime);

AudioTimeStamp ts; ts.mFlags = kAudioTimeStampSampleTimeValid; ts.mSampleTime = 111110; NSLog(@“采样时间%f”,ts.mSampleTime); ts.mSampleTime = mainMP3delegate.MP3_Timestamp; 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

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,

人!如果你想到这个或有人,我会发疯的。我还对有人正在进行的租赁公司出价,

#2


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. 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执行音频流,其搜索功能非常有效。唯一的问题是总时间是逐步计算的,只有下载到最后才能知道总时间。

MPMoviePlayerController Class Reference

MPMoviePlayerController类参考