从网站流式传输视频,并支持现代浏览器(包括 IE)*和* iPad

发布于 2024-11-06 18:57:15 字数 2289 浏览 2 评论 0 原文

我的老板想要以下内容:

要求:将 m4v 视频从我们的 Web 服务器流式传输到客户端,包括标准 Web 浏览器(IE7、FF、Chrome 等)和 iPad!

我不太确定他为什么想要 m4v...他提到了效率,但这也可能与 iPad 兼容性有关?不管怎样,我还是被 m4v 困住了。

我浏览过一些相关问题,这个页面也非常有用:

http://henriksjokvist.net/archive/2009/2/using-the-html5-video-tag-with-a-flash-fallback

所以如果我理解正确,HTML5 带有 <video>标签将满足我的所有要求(浏览器和 iPad)除了 IE 直至并包括 IE8。

所以在我的代码中:

<div id="demo-video-flash">
   <video id="demo-video" poster="snapshot.jpg" controls>
    <source src="video.m4v" type="video/mp4" /> <!-- MPEG4 for Safari -->
    <source src="video.ogg" type="video/ogg" /> <!-- Ogg Theora for Firefox 3.1b2 -->
   </video>
</div>

<script type="text/javascript">
  $(document).ready(function() { // ... a dash of jQuery.
    var v = document.createElement("video"); // Are we dealing with a browser that supports <video>? 
    if ( !v.play ) { // If no, use Flash.
      var params = {
        allowfullscreen: "true",
        allowscriptaccess: "always"
      };
      var flashvars = {
        file: "video.f4v",
        image: "snapshot.jpg"
      };
      swfobject.embedSWF("player.swf", "demo-video-flash", "480", "272", "9.0.0", "expressInstall.swf", flashvars, params);
    }
  });
</script>

正如上面的链接所解释的,测试浏览器是否支持 >,如果不支持,则回退到 flash。如果浏览器支持>,我不需要担心播放器,因为浏览器会处理它。如果不支持>,我需要提供:

(a) 一个Flash播放器。

(b) 我的 .m4v 视频的 Flash 兼容副本

问题:

1) 此解决方案能否满足我的要求?

2) .m4v 是一种适合流式传输到 iPad 的格式吗? (我猜是的,因为它是 Apple 专有格式!)

3) .m4v 是“flash-comatabile”吗?也就是说,如果我将它发送到我的 Flash 播放器,它会起作用吗?我读过关于此的相互矛盾的报道。如果不是,那么我想我需要将我的视频副本转换为 Flash 兼容格式...有什么建议吗? (.f4v 似乎很常见,但我们已经有了一个 .mov 文件,可以使用吗?)

4) 最后但并非最不重要的一点是,什么是好的 Flash 播放器。我倾向于 flowplayer (http://flowplayer.org/),但是,我们已经安装了 swf 播放器 (http://code.google.com/p/swfobject/)。似乎后一种会起作用......对其中一个或另一个有什么好处吗?

如果这个问题的某些部分没有意义,我深表歉意……那里有很多有关视频的信息,很难将它们拼凑在一起……希望这里的一些答案可能会有所帮助。我可以根据需要完善我的问题。

提前致谢!

彼得

My boss wants the following:

Requirements: Stream m4v videos from our Web-server to clients including standard web browsers (IE7, FF, Chrome, etc) and iPad!

I'm not really sure why he wants m4v...he mentioned efficiency but it may also have to do with iPad compatibility?? Anyway, I'm stuck with m4v.

I've browsed some related questions on SO, and this page is very useful as well:

http://henriksjokvist.net/archive/2009/2/using-the-html5-video-tag-with-a-flash-fallback

So if I understand correctly, HTML5 with <video> tag will take care of all my requirements (browsers & iPad) except IE up to and including IE8.

So in my code:

<div id="demo-video-flash">
   <video id="demo-video" poster="snapshot.jpg" controls>
    <source src="video.m4v" type="video/mp4" /> <!-- MPEG4 for Safari -->
    <source src="video.ogg" type="video/ogg" /> <!-- Ogg Theora for Firefox 3.1b2 -->
   </video>
</div>

<script type="text/javascript">
  $(document).ready(function() { // ... a dash of jQuery.
    var v = document.createElement("video"); // Are we dealing with a browser that supports <video>? 
    if ( !v.play ) { // If no, use Flash.
      var params = {
        allowfullscreen: "true",
        allowscriptaccess: "always"
      };
      var flashvars = {
        file: "video.f4v",
        image: "snapshot.jpg"
      };
      swfobject.embedSWF("player.swf", "demo-video-flash", "480", "272", "9.0.0", "expressInstall.swf", flashvars, params);
    }
  });
</script>

As the link above explains, test if the browser supports <video>, and if not, fall back to flash. If the browser supports <video>, I don't need to worry about the player as the browser handles that. If it doesn't support <video>, I need to provide:

(a) A flash player.

(b) A flash-compatible copy of my .m4v video

Questions:

1) Will this solution work for my requirements?

2) Is .m4v a good format to stream to iPad? (I'm guessing yes as it's an Apple proprietary format!)

3) Is .m4v "flash-comatabile"? That is, if I send it to my flash player will it work? I've read conflicting reports on this. If it's not, then I guess I need to have a copy of my video converted to a flash-compatable format...any recommendations? (.f4v seems common but we already have a .mov file will that work?)

4) Last but not least, what's a good flash player. I'm leaning toward flowplayer (http://flowplayer.org/), however, we already have a swf player installed (http://code.google.com/p/swfobject/). Seems this latter one would work...any advantages to one or the other??

Apologies if some parts of this question don't make sense...there's alot of info about video out there and it's hard to piece it all together...hoping some answers here may help. I can refine my question as needed.

Thanks in advance!

Peter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汐鸠 2024-11-13 18:57:15

据我所知...,IE不支持HTML5,因此该标签在IE中无法识别...

As far as I know..., IE does not support HTML5 so the tag would be unrecognized in IE...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文