views:

693

answers:

2

I'm building a web site that needs to stream video and be friendly for handheld devices (especially the iPhone). Some handhelds don't support Flash so I'm avoiding the use of a Flash player. How does Youtube stream its videos so that they play on both desktops and iPhones? I'm looking for a player, or multiple players, which can be somehow activated based on the user's device.

Your help and guidance are much appreciated. Thanks.

+3  A: 

The YouTube website and others use the HTML5 video tag for streaming playback on iPhones. It works like this:

<video  width="480" height="360" controls>
    <source src="test.mp4" type="video/mp4" />
    <source src="test.ogv" type="video/ogg" />
</video>

In Safari (Desktop as well as mobile) and Chrome, the h264-compressed test.mp4 file will be played. Firefox will play back test.ogv. For other videos, you should still have a flash video player as fallback. You can have all the format choosing and flash fallback done automatically using HTML5Media. You might also check out SublimeVideo, which provides video player controls for the <video> tag.

MrMage
Wow! Thank you, MrMage :) I didn't realize that Firefox could use the <video> tag; I thought it was only on Safari.
Alex
+1  A: 

It is possible just to provide link to video (don't forget to put moov atom to the beginning), and it is also possible to use erlyvideo to stream your movies to iPhone or iPad via Apple HTTP Live Streaming.

Max Lapshin
Thank you, Max. I didn't know about erlyvideo.
Alex