开发者

How do you stream M4V video on the web without using Flash?

开发者 https://www.devze.com 2022-12-23 00:54 出处:网络
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 do

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消