不使用Flash的全屏视频背景

发布于 2024-12-03 08:20:42 字数 110 浏览 1 评论 0原文

有没有办法不使用Flash而为网页设置全屏视频背景?

我正在考虑 html5,但我不能将 Internet Explorer 排除在外。

有什么想法吗?

多谢

Is there any way to set a full screen video background for a web page without using Flash?

I was considering html5 but I cannot leave Internet Explorer out.

Any ideas?

Thanks a lot

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

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

发布评论

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

评论(6

回忆追雨的时光 2024-12-10 08:20:43

如果您需要支持 IE 8 及更早版本,并且想要避免 Flash,那么您可以在 Silverlight 中构建一个关于 HTML5 的视频播放器,正如其他人提到的,它不允许全屏播放,最好它提供全屏播放窗口播放。

希望这会有所帮助,但我想如果您试图避免使用 Flash,那么您实际上是在避免使用插件。

If you need to support IE versions 8 and earlier, and want to avoid Flash, then you could build a video player in Silverlight, concerning HTML5, as the other people mention, it does not allow full screen playback, the best it offers it full window playback.

Hope that helps, but I imagine that if you're trying to avoid Flash then you're actually avoiding using plugins.

下壹個目標 2024-12-10 08:20:43

看来你可以。请参阅​​此问题。并查看 VideoBG jQuery 插件。相当滞后,并且浏览器支持不是很好,但它确实有效:)

Seems you can. See this question. And check out the VideoBG jQuery plugin. Rather laggy, and not great browser support, but it does work :)

就此别过 2024-12-10 08:20:43

有没有办法在不使用Flash的情况下为网页设置全屏视频背景?

如果您的意思是真正全屏 - 占据整个,物理屏幕 - 不。没有现代浏览器允许在纯 HTML 中执行此操作。

Is there any way to set a full screen video background for a web page without using Flash?

If you mean true fullscreen - occupying the whole, physical screen - nope. No modern browser allows this in pure HTML.

最单纯的乌龟 2024-12-10 08:20:42

如果不使用 Internet Explorer 安装额外的附加组件或对象,这是不可能的。 HTML5 允许在您的网站中嵌入视频,但并非所有浏览器都提供全屏支持。也许是使用 Google 的 Chrome Frame 一个想法。

查看 HTML5 规范

用户代理可以允许用户以更适合用户的方式观看视频内容(例如全屏或在独立的可调整大小的窗口中)。至于其他用户界面功能,启用此功能的控件不应干扰页面的正常呈现,除非用户代理公开用户界面。然而,在这种独立的上下文中,用户代理可以使完整的用户界面可见,例如播放、暂停、搜索和音量控件,即使控件属性不存在。

也可以嵌入 Microsoft 的 Windows Media Player,但不能在后台...这是一个工作示例: http://www.html5-fullscreen-video.com/

It is not possible without installing additional add ons or objects with internet explorer. HTML5 allows to embed videos in your website, but not all browser provide full-screen support for that. Maybe is to use Google's Chrome Frame an idea.

Have a look at the HTML5 specification:

User agents may allow users to view the video content in manners more suitable to the user (e.g. full-screen or in an independent resizable window). As for the other user interface features, controls to enable this should not interfere with the page's normal rendering unless the user agent is exposing a user interface. In such an independent context, however, user agents may make full user interfaces visible, with, e.g., play, pause, seeking, and volume controls, even if the controls attribute is absent.

It is also possible to embed Microsoft's Windows Media Player, but not in background... Here a working example: http://www.html5-fullscreen-video.com/

掩饰不了的爱 2024-12-10 08:20:42

我认为你需要首先确定为什么你不热衷于使用Flash。如果原因是您想要定位移动设备,那么将 HTML5 的 与 Flash 播放器回退结合使用绝对是可行的。

不幸的是,并非所有浏览器都完全支持 HTML5,尤其是 IE。这可能就是您在某些时候仍然需要使用 Flash 的原因。

因此,假设您想为全屏背景视频使用“HTML5 的 + Flash Fallback”方法,您可能会执行以下操作:

HTML:

<video id="bg-vid" autoplay controls>
  <source src="video.webm" type='video/webm; codecs="vp8, vorbis"' />
  <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"' />
  <source src="video.mp4" />
  <object id="flash-vid" type="application/x-shockwave-flash"
    data="flowplayer-3.2.1.swf"> 
    <param name="movie" value="flowplayer-3.2.1.swf" /> 
    <param name="allowfullscreen" value="true" /> 
    <param name="flashvars" value='config={"clip": {"url": "http://yoursite.com/videos/video.mp4", "autoPlay":true}}' /> 
  </object>
</video>

然后对其进行样式设置像这样的全屏效果和比例裁剪/拉伸:

#bg-vid, #flash-vid{
   min-height: 100%;
   min-width: 1024px;
   width: 100%;
   height: auto;
   position: fixed;
   top: 0;
   left: 0;
   z-index: -1;
}

I think that you need to first establish why you are not keen on using Flash. If the reason is that you want to target mobile devices, then using HTML5's <video> in combination with a Flash player fall back is definitely viable.

Unfortunately HTML5 is not fully supported in every browser - especially IE. This is probably why you will still need to use Flash at some point.

So assuming that you would like to give the "HTML5's <video> + Flash fallback" method a shot for your full screen background video, here's what you could probably do:

HTML:

<video id="bg-vid" autoplay controls>
  <source src="video.webm" type='video/webm; codecs="vp8, vorbis"' />
  <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"' />
  <source src="video.mp4" />
  <object id="flash-vid" type="application/x-shockwave-flash"
    data="flowplayer-3.2.1.swf"> 
    <param name="movie" value="flowplayer-3.2.1.swf" /> 
    <param name="allowfullscreen" value="true" /> 
    <param name="flashvars" value='config={"clip": {"url": "http://yoursite.com/videos/video.mp4", "autoPlay":true}}' /> 
  </object>
</video>

And then you style it like this for a full screen effect and proportional cropping/stretching:

#bg-vid, #flash-vid{
   min-height: 100%;
   min-width: 1024px;
   width: 100%;
   height: auto;
   position: fixed;
   top: 0;
   left: 0;
   z-index: -1;
}
梦年海沫深 2024-12-10 08:20:42

好吧,如果它只是一个简短的动画/视频,你可以做一个精灵动画,但我很确定性能不会令人满意。更不用说图像尺寸了

Well you COULD do a sprite animation if it's just a short animation/video but i'm pretty sure the performance wouldn't be satisfactory. not to mention the image size

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