播放时自动展开嵌入的 Youtube 视频

发布于 2024-12-01 03:36:10 字数 413 浏览 0 评论 0原文

如何在用户按下播放键时自动展开嵌入的 YouTube 视频?

情况:
- 由于各种原因,网页的理想布局要求当用户到达页面时视频播放器最初必须以小尺寸显示(假设为 480x385)
- 所显示的视频包含一些细节,难以在 480x385 分辨率下观看
- 现在,用户必须单击每个 YouTube 视频播放器中标配的“全屏”图标。这让很多人感到恼火。

所需的解决方案:
- 当用户点击视频进行播放时,播放器会自动扩展到更合理的尺寸(例如,640x385或853x505)并以​​该尺寸播放
- 视频可以在模式叠加中播放,但也欢迎其他解决方案
- 视频播放完毕后,展开的视图应自动消失,视频应以其原始大小显示在页面上

How do I automatically expand an embedded youtube video when the user presses play?

The situation:
- For various reasons the ideal layout of the webpage mans that the video player must appear initially at a small size (let's say 480x385) when the user arrives on the page
- The video being shown contains some detail and is difficult to watch at 480x385
- Right now the user must click on the "full-screen" icon which comes standard in every youtube video player. This is irritating to many people.

The desired solution:
- When users click on the video to play it, the player automatically expands to a more reasonable size (e.g., 640x385 or 853x505) and plays at that size
- The video could be played in a modal overlay, but other solutions would be welcome as well
- Upon completion of the video, the expanded view should automatically disappear and the video should appear in it's original size on the page

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

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

发布评论

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

评论(1

柏拉图鍀咏恒 2024-12-08 03:36:10

您基本上需要两件事:

  1. 能​​够检测视频何时播放。您应该能够从这个 YouTube 示例中看出这一点。
  2. 通过更改包含播放器的“对象”节点的高度和宽度属性来调整播放器的大小。

You basically need two things:

  1. The ability to detect when the the video is playing. You should be able to figure that out from this YouTube example.
  2. Resize the player by changing the height and width properties of the "object" node that contains the player.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文