代码之家  ›  专栏  ›  技术社区  ›  ToughPal

如何在Windows、Mac、Android和iOS设备上的所有主要浏览器上设置视频播放

  •  0
  • ToughPal  · 技术社区  · 14 年前

    我们需要制作一个特定产品的视频演示。确保视频在所有流行平台上尽可能多的浏览器上播放的最佳方法是什么?

    当前的实现:我们只需要在Flash播放器中加载Flash视频。

    3 回复  |  直到 13 年前
        1
  •  1
  •   Andrew    14 年前

    如果托管服务对你来说是一个可行的选择,Vimeo和Wistia等网站的付费账户将为桌面浏览器提供Flash视频,为智能手机和其他移动设备(如iPad和三星、黑莓等即将推出的平板电脑)提供HTML5视频。

    如果你要做所有的托管自己,我建议使用HTML5视频标签与一个简单的回退到闪存。优秀的 VideoJS 脚本为您处理大多数困难的事情,甚至允许您 build custom embed codes .

    基本上,HTML如下所示:

    <video width="640" height="360" poster="poster.png" controls preload>
        <source src="video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /> <!-- This video file is for Safari, Chrome and smartphones running iOS and Android, it will also be referenced later in the Flash fallback for Internet Explorer -->
        <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"' /> <!-- This video file is for Firefox, Opera, and is also supported by Chrome -->
    
        <object id="flash_fallback" width="640" height="360" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"> <!-- This calls on FlowPlayer, an excellent third party Flash video player -->
            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
            <param name="allowfullscreen" value="true" />
            <param name="flashvars" value='config={"playlist":["poster.png", {"url": "video.mp4","autoPlay":false,"autoBuffering":true}]}' /> <!-- Notice here you're calling the same .mp4 file as above -->
            <img src="poster.png" width="640" height="360" alt="Poster Image" title="No video playback capabilities." /> <!-- If the browser can't handle any of the HTML5 video files and doesn't have Flash installed, they'll just get the poster frame as shown here -->
        </object>
    </video>
    

    希望这有帮助!

        2
  •  0
  •   sange    14 年前

    Flash不能在任何iOS设备上播放。

    编辑:我看错了这个问题。如果使用youtube来承载视频并嵌入youtube视频,则可以通过youtube应用程序在iOS设备上播放视频。那将是一种方法。

        3
  •  0
  •   zeh    14 年前

    使用可嵌入的视频播放器,这些播放器在您的网站页面上可以回退到HTML5版本(例如, JWPlayer ). 这样你就可以在所有浏览器上使用Flash进行可预测/稳定的播放,在支持它的设备(Android、iOS等)上进行HTML5播放。