Skip navigation.
 
mlStreaming a file as it gets recorded?
FROM : ben levitt
DATE : Fri Jan 04 22:57:00 2008

Sorry my first email went out prematurely...

Anyhoo, I'm trying to stream an audio file up to a server as it gets
recorded, using NSMutableURLRequest and an NSInputStrem.  The problem
I'm having is that if I start streaming while the file is still
getting recorded, then I only end up sending the beginning of the
file, and as soon as sending catches up to recording, the transfer
stops.

Is there a nice, simple way to get the file to continue streaming
until it's done being written?

I'm trying to do something like the following.

NSURL *cgiUrl = [NSURL URLWithString: urlStr];
NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:cgiUrl];

//setting the headers:
[postRequest setHTTPMethod:@"POST"];
[postRequest addValue: @"application/octet-stream" forHTTPHeaderField:
@"Content-Type"];

//adding the body:
fileStream = [[NSInputStream inputStreamWithFileAtPath: recordingFile] retain];
[postRequest setHTTPBodyStream: fileStream];

// Make the request
NSURLConnection *theConnection=[[NSURLConnection alloc]
initWithRequest:postRequest:  delegate:self];


Thanks,
Ben

Related mailsAuthorDate
No related mails found.