views:

3006

answers:

2

We have a whole catalogue of videos which we would like to stream to an iphone for showing on the move, this would be done inside the iphone's safari browser.

For some reason I have not been able to find anything decent online to show how this is done, we have the videos converted to formats the iphone can see .m4v and .3gp (both converted using quicktime)

But i'm not sure how to embed the videos in a webpage so that the iphone can open them in the built in quick time player.

I attempted the code below, but safari returns an error stating "safari is unable to download this file"

<script src="AC_QuickTime.js" language="JavaScript" type="text/javascript"></script> 
<script language="javascript"> 
<!-- 
var ua = navigator.userAgent ;
if (ua.indexOf("iPhone") > 0) document.location.replace("iolliecell.3gp");
self.moveTo(0,0);
self.resizeTo(screen.width,window.screen.availHeight);
//-->
</script> 

<script language="javascript"> 
QT_WriteOBJECT('ollie.mp4', '100%','95%', '', 'autoplay', 'true', 'bgcolor', 'black', 'scale', 'aspect');
</script> 
+1  A: 

You can't embed video on the iPhone, only the video player can "play video", and it requires access to the full screen.

Will Hartung
No problem with access to full screen. The question is "how do you place the video in the web page for it to play in any manner"
Shadi Almosri
+3  A: 

As far as I know, you shouldn't have to do anything to make it compatible as long as it's using a certain codec (m4v should be fine). The iPhone handles the embed tag accordingly. What will happen is it'll show the area of the video and a play button in the middle of that area. Clicking the video will open the video player in full screen. When the movie finishes, it goes back to the webpage. I'll try and find something in Apple's documentation that discusses this.

Edit: Apple has information on media in Safari here. Hope this helps.

Edit 2: This is essentially all you need.

<embed src="poster.jpg" href="movie.m4v" type="video/x-m4v" />

In addition to playing "movie.m4v" when clicked on, it will also show "poster.jpg" on the webpage instead of the gray box I was referring to before.

If you're going to be designing web applications for the iPhone, you will want to sign up for an ADC account. It's free, and it gives you access to documentation such as this. While the link I sent you deals with how to add a preview image, it references a more detailed guide which discusses issues such as supported codecs, what bit rate to use, server configuration, and more.

You can verify this is working by visiting the website in question on any iPhone/iPod Touch and seeing what it looks like. You can even use the iPhone simulator to do this (also free to download).

mgriepentrog
Unfortunatly i do not have an ADC or iPhone Dev account thus unable to see the information provided there.So regarding embedding. Simply embedding the video as is (Without a player) should play the file?
Shadi Almosri
So something like the below?<code><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase= http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0 width="320" height="256" align="middle"> <param name="src" value="sample.mov" /> <param name="autoplay" value="true" /> <embed src="sample.mov" autoplay="true" width="320" height="256" align="middle" bgcolor="black" pluginspage="http://www.apple.com/quicktime/download/"> </embed></object></code>
Shadi Almosri
See my above updates.
mgriepentrog
and iPhone Dev account is free, you should register.
CiNN