【问题标题】:html5 embed mp4 video | how to know if the device is an iphone 3/3gs or 4 | mp4 dimension are too bightml5嵌入mp4视频|如何知道设备是iphone 3/3gs 还是4 | mp4尺寸太大
【发布时间】:2011-01-26 01:32:50
【问题描述】:

我有一个嵌入 html5 的 mp4 视频。 它适用于所有浏览器以及 iphone4 和 ipad,但不适用于 iphone 3 和 3gs,因为它的尺寸为 900px*508px。

我怎么知道我要在什么设备(iphone4 或 3G/3GS)上显示页面?

提前非常感谢!

【问题讨论】:

    标签: php javascript iphone html mp4


    【解决方案1】:

    您可以使用媒体属性提供不同的视频(缩小尺寸),例如

    <video controls>
       <source src="myfile.ogg" type="video/ogg">
       <source src="myfile.ogg" type="video/ogg" media="(max-device-width: 300px)">
    </video>
    

    您可以阅读更多相关信息here,向下滚动到“将不同压缩的视频发送到手持设备”。

    【讨论】:

      【解决方案2】:

      你大概可以检查一下user-agent来判断是iphone4还是3:-

      echo $_SERVER['HTTP_USER_AGENT'];
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-02-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多