Saturday, January 10, 2009

Make Your FLV Playable in iPhone iMobileCinema

If you host a flash video site, you can make the flv file playable on iPhone by adding some html codes.

The simplest way is writing a embed tag like this,
<embed src="http://imobilecinema.com/imcfp.swf" type="application/x-shockwave-flash" width="320" height="240" flashvars="file=URLEncoded_FLV_File_URL&image=URLEncoded_Thumb_Image_URL"></embed>

e.g., if the flv file url is http://example.com/test.flv, and thumbnail image url is http://example.com/test.jpg, the embed tag should be like this,
<embed src="http://imobilecinema.com/imcfp.swf" type="application/x-shockwave-flash" width="320" height="240" flashvars="file=http%3A%2F%2Fexample.com%2Ftest.flv&image=http%3A%2F%2Fexample.com%2Ftest.jpg"></embed>

The source swf is a fake swf file for triggering iMobileCinema only. So we recommend that the embed tag code should be showed on iPhone only. You can detect the device by checking User Agent, or using javascript.

HTTP redirection is supported, so if your embed src is http://example.com/playtest, and is 302 redirected to
http://imobilecinema.com/imcfp.swf?file=http%3A%2F%2Fexample.com%2Ftest.flv&image=http%3A%2F%2Fexample.com%2Ftest.jpg
It will work like the previous example.

An advanced usage is using req argument instead of file argument. This is useful if you want to generate different flv file urls, for mirror sites or temperory files. e.g., if your flashvars is
flashvars="req=http%3A%2F%2Fexample.com%2Frequest"
The result of http://example.com/request will be used as flv file url, which should be plaintext.

7 comments:

Unknown said...

Hello, I would know how to update the flashvars value field in the embed tag with a new video URL by using a Javascript ... to have something like a dynamic video Flash player. Is this possible and how ?

Unknown said...

Youtube, dailymotion, etc all work fine. I tried to use the embed code on my server to play a flv file but I got a blue box.

Krewx said...

How can i use the code for embed videos like megavideo, because i can't play it on the iphone xD

KRewx

Unknown said...

Very usefull, but...
It works with flv video.
Is it possible to play realtime video connecting to a flash media server in rtmp?
How?
Thanks again!!!

Luis Edgar said...

Does this support the rmtp protocol?

yili360 said...

@Paolo, Does your problem still exist? Or have you figured it out? If yes, then how? Kindly share the solution! flv to dvd

Unknown said...

Ah, sad to see the post so late.it works for me.convert avi to mp4