views:

193

answers:

2

Hey,

In order to be able to send a video taken on the iphone to a server i assume one needs its data, how can one get a videos data? Is there somethign similar to UIImageJPEGRepresentation(UIImage *, ) for images.

Thanks

A: 

Yes, see the 3.0 documentation for UIImagePickerController and UIImagePickerControllerDelegate. Specifically the new imagePickerController:didFinishPickingMediaWithInfo: delegate method that will be called when the user chose a movie from the camera roll.

That delegate method will give you a dictionary containing information about the movie, including a URL to it's file. See the UIImagePickerControllerMediaURL key.

Once you have the (filesystem) URL, you can read the movie and send it to a server.

St3fan
How would u read the movie to get its data?
Daniel
I would read the movie in chunks. Since movie files can probably get big and you don't have a huge amount of memory available on the iPhone or iPod.
St3fan
So you give the server the video url and the server needs to read it in?
Daniel
Or i just use NSDatas initWithContentURL ?
Daniel
A: 

They are just mpeg-4 files, that you can end anywhere. It's not like the image picker where you only get an in-memory image.

Kendall Helmstetter Gelner
But one isnt just sneding it? One needs to give some service t he URL so they can read it in?
Daniel
Im not quite getting how one actually "sends" the movie
Daniel