iphone/ipod mobile safari 导致视频元素在旋转时消失

发布于 2024-10-11 16:12:40 字数 1843 浏览 4 评论 0原文

我正在编写一个非常简单的显示视频的网站。我有针对设备不同旋转状态的单独样式表,如下所示:

<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait-style.css"/>
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape-style.css"/>

当用户首次以相应方向导航到站点时,工作表会正确加载并显示内容。但是,当用户更改方向时,以下代码中的视频元素会消失,而该方向的所有其他样式都会正确应用。

<video id="mainvideo" width="640" height="480" controls preload="auto">

        <source src="output.ogv"  type="video/ogg" />       
        <source src="output.mp4"  type="video/mp4" />       

        <object width="640" height="480" data="flowplayer-3.2.5.swf" type="application/x-shockwave-flash">  
            <param name="movie" value="flowplayer-3.2.5.swf" />  
            <param name="allowfullscreen" value="true"/> 
            <param name="allowscriptaccess" value="always"/>
            <param name="flashvars" value="config={'clip':{'url':'output.flv', 'autoPlay':false, 'autoBuffering':true}}" />
        </object>

        <div id="trollface">
        <p>You do not have Adobe flash player installed on your browser. You may download it <a href="http://get.adobe.com/flashplayer/">here</a>.</p>
        </br>
        <p>Alternatively, you may also use a modern, standards-compliant browser (such as <a href="http://www.mozilla.com/en-US/firefox/">firefox</a>, <a href="http://www.google.com/chrome/intl/en/landing_chrome_mac.html?hl=en">chrome</a>, <a href="http://www.opera.com/">opera</a>, or <a href="http://www.apple.com/safari/">safari</a>), or download the video by clicking the download link below.</p>

        </div>

    </video>

有人可以给我们一些指导吗?

预先感谢您的所有帮助。

I am writing a very simple website that displays a video. I have separate stylesheets for the different rotation states of the device, like so:

<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait-style.css"/>
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape-style.css"/>

The sheets load and display the content properly when the user first navigates to the site in the respective orientation. However, when the user changes orientation, the video element in the following code disappears, while all other styling for the orientation is correctly applied.

<video id="mainvideo" width="640" height="480" controls preload="auto">

        <source src="output.ogv"  type="video/ogg" />       
        <source src="output.mp4"  type="video/mp4" />       

        <object width="640" height="480" data="flowplayer-3.2.5.swf" type="application/x-shockwave-flash">  
            <param name="movie" value="flowplayer-3.2.5.swf" />  
            <param name="allowfullscreen" value="true"/> 
            <param name="allowscriptaccess" value="always"/>
            <param name="flashvars" value="config={'clip':{'url':'output.flv', 'autoPlay':false, 'autoBuffering':true}}" />
        </object>

        <div id="trollface">
        <p>You do not have Adobe flash player installed on your browser. You may download it <a href="http://get.adobe.com/flashplayer/">here</a>.</p>
        </br>
        <p>Alternatively, you may also use a modern, standards-compliant browser (such as <a href="http://www.mozilla.com/en-US/firefox/">firefox</a>, <a href="http://www.google.com/chrome/intl/en/landing_chrome_mac.html?hl=en">chrome</a>, <a href="http://www.opera.com/">opera</a>, or <a href="http://www.apple.com/safari/">safari</a>), or download the video by clicking the download link below.</p>

        </div>

    </video>

Can anyone lend we some direction with this?

Thanks in advance for all your help.

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

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

发布评论

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

评论(1

温折酒 2024-10-18 16:12:40

在样式表内部,您还可以针对不同的方向做出不同的设置,

@media only screen and (orientation:landscape) {
    .yourclass{
    }
}

@media only screen and (orientation:portrait) {
    .yourclass{
    }
}

这允许您对同一类(或ID或标签)有两个定义,并且当您将设备转向另一个方向时,它应该动态更新您的页面

Inside the stylesheet you can make a difference as well for different orientations

@media only screen and (orientation:landscape) {
    .yourclass{
    }
}

@media only screen and (orientation:portrait) {
    .yourclass{
    }
}

This allows you to have two definitions for the same class (or ID, or tag) and it should be updating your page dynamically when you turn the device to another orientation

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