Embedding h.264 video for the iphone

38 views
Skip to first unread message

olicat

unread,
Nov 4, 2008, 10:03:38 AM11/4/08
to iPhoneWebDev
Hi all,
I've tried various different methods of playing h264 quicktime files
via an xhtml page, but i can't get anything to work.

all the docs i've looked into have suggested creating a reference
movie, however i'm developing on linux so that functionality isn't
available.

using apple's QT_WriteObject gives me a crossed out play button
here's the javascript code i'm using: http://pastebin.ca/1244909

i've also tried going to the video's url directly, the iphone media
player starts (which looks promising), but then returns an error "this
movie could not be played"

any ideas?

Pierre Bussière

unread,
Nov 4, 2008, 11:54:10 AM11/4/08
to iphone...@googlegroups.com
Hi Paul,

You have indeed to use a link for the iPhone to detect and play the
video. It can be an image linked to your video file as am alternative
to the embedded video, which the iPhone cannot play from within the
page.

You got a "can't be played" message, this usually means your file is
not compatible with the device, which complies to a narrow range of
mp4 spec. Does it play when you load it via iTunes ?

Pierre

olicat

unread,
Nov 4, 2008, 12:27:36 PM11/4/08
to iPhoneWebDev
hi Pierre,
thanks for your reply.
I've changed my page so that I now have:
<a href="http://video_url.com.mov"><img src="images/video.png"></a>
when viewing the page and clicking that image in the iPhone, I get the
same message.
I'm almost certain the video is a valid iPod one, I got it from the
apple support site, here: http://www.info.apple.com/images/kbase/302892/sample_iPod.m4v.zip
The only difference being the name (I've changed it to sample_iPod.mov
rather than .m4v).

with the .mov extension i get: "this movie could not be played"
with the .m4v i get: "safari cannot download this file"

not sure what's going wrong....

thanks again,
paul.

On Nov 4, 4:54 pm, Pierre Bussière <pierrebussi...@gmail.com> wrote:
> Hi Paul,
>
> You have indeed to use a link for the iPhone to detect and play the  
> video. It can be an image linked to your video file as am alternative  
> to the embedded video, which the iPhone cannot play from within the  
> page.
>
> You got a "can't be played" message, this usually means your file is  
> not compatible with the device, which complies to a narrow range of  
> mp4 spec. Does it play when you load it via iTunes ?
>
> Pierre
>

Pierre Bussière

unread,
Nov 4, 2008, 5:36:15 PM11/4/08
to iphone...@googlegroups.com
Paul,

Something very important is that you shouldn't change a .m4v extenxion
to .mov.
M4v, m4a, m4p, etc. are all mp4 files and their extension can be
replaced by mp4. That can help with some device which "understand"
"mp4" but not "m4X". But concerning mov, though both files are very
similar, a mp4 is not a mov.
And since the iPhone is supposed to understand any of those
extensions, there is no need for a modification.

I think your problem is actually the mime-mapping. I reproduced it on
a basic tomcat 5.0. You have to tell it how to handle m4v or mp4 files.

Here is the solution for Tomcat :
Open web.xml in the "conf" folder.
Find the mime-mappings and add these two :

<mime-mapping>
<extension>m4v</extension>
<mime-type>video/mp4</mime-type>
</mime-mapping>
<mime-mapping>
<extension>mp4</extension>
<mime-type>video/mp4</mime-type>
</mime-mapping>

If you work on Apache, it should be in mime.types :

video/mp4 mp4 mp4v mpg4 m4v

I hope that will help. If not, what server is your site on ?

Pierre

Le 4 nov. 08 à 18:27, olicat a écrit :
Reply all
Reply to author
Forward
0 new messages