tags:

views:

630

answers:

1

Hi all,

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(http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html)...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?

Thanks in advance, Syam

+1  A: 

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);

   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

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.

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,