根据iPad的方向更改html5视频标签的src

发布于 2024-12-11 08:42:58 字数 201 浏览 0 评论 0原文

编码 HTML5 页面,以便在 iPad Mobile Safari 中使用,该页面具有用于嵌入视频文件的标签。使用 CSS3 媒体查询来确定 iPad 的方向,效果很好。

现在需要根据方向更改视频标签的 src。换句话说,有两个视频,一个尺寸适合横向视图,另一个适合纵向视图。

关于如何解决这个问题有什么建议吗?我确信这很简单,但我似乎无法让它发挥作用。

Coding HTML5 page for use in iPad Mobile Safari that has tag for embedding video file. Using CSS3 media queries to determine orientation of iPad, which works fine.

Now need to change the src of the video tag depending on orientation. In other words, there are two videos, one sized to work in landscape view and one to work in portrait view.

Any advice on how to approach this problem? I'm sure it's something pretty simple, but I can't seem to get it to work.

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

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

发布评论

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

评论(1

许一世地老天荒 2024-12-18 08:42:58

在查看文档宽度并确定方向后,我只需使用 JavaScript 插入视频标签。

I'd just insert the video tag using javascript, after it's looked at the document width and figured out the orientation.

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