tags:

views:

152

answers:

5

Hi,

I have a webservice returning .flv file, it has to be played in iphone application, how do i play a .flv (flash file) in iphone?

Does anyone has faced this scenario? Programmatically is it possible to convert to some format and play in iphone?

Thanks.

+1  A: 

I would recommend setting up your webservice to use something like ffmpeg ( http://www.ffmpeg.org/ ) to convert the .flv file to an mp4 file which can be played directly from the iPhone's web browser.

Josiah
+3  A: 

IPhone doesn't and judging by the Apple official statements won't ever (or at least in the forseeable future) support flash content.

Converting the content to another format on the server side should be easy to do and would allow content playback on an iDevice.

code_burgar
So you mean to say there is no way that a flv file can be played in iphone indirectly by some conversion also?
Sharpeye500
Why would you want to avoid doing the conversion once on the server side, in place of having every single user convert it every single time, on a device that is resource constrained?
Marc Bollinger
@Marc: I never suggested converting the content on the fly
code_burgar
@Kathrick: Correct, unless you convert it prior to serving it to an iDevice you are out of luck.
code_burgar
@code_burglar: Sorry, should have used an '@', that was directed at Kathrick, not you; I agree with you. :)
Marc Bollinger
A: 

You may be able to use ffmpeg or something on your server to transcode it to H.264. I'm not so sure you would really want to do that transcoding on the phone. Given Apple's current stance on Flash, this is probably your best option.

pioto
I return the video path from DB and web-browser programmer adds .flv, the same path instead of .flv, i need to alter something for iphone app, can't we do like pass a string with .flv and it returns a format that is supported in iphone via any app/III party dll?
Sharpeye500
A: 

Pioto and Josaih are on the right track in suggesting that you should convert the video server-side using a tool like FFMpeg. As far as I know there is zero support for flv in any part of iOS, so you'd be unable to transcode it locally. Even if you could, it would make your users angry, since transcoding is a resource-intensive process that would kill their battery life and take a significant amount of time.

So, your solution is to transcode your videos to h.264 server-side. However, I'd caution against transcoding from flv->h.264 if there are any other options available. If you have the original, uncompressed (or at least less-compressed) source video available, you'll get higher-quality video by transcoding that to h.264. Each time lossy compression (eg, squeeze or h.264) is used on a file, you lose some information and quality. If you've ever seen a 3rd or 4th generation copy of a VHS tape, you can understand what I'm getting at.

Once you have a h.264 formatted video, you can use QTKit to play it on iOS. Not sure about the exact details of QTKit on iOS, but I'm sure it's in there somewhere.

Alterscape
The appropriate class on iOS is MPMoviePlayerController.
rpetrich
A: 

SInce the video is probably already h.264 encoded inside the FLV container, you may want to try FLV Extract on the server to avoid recompression:

http://www.videohelp.com/tools/FLV_Extract

Basically you just need to run it once for each of the videos on the server and keep the results around.

Kendall Helmstetter Gelner