将视频放置在iframe中后,如何使其全屏显示? [英] How to make a video fullscreen when it is placed inside an iframe?
问题描述
我正在使用mediaelement.js播放器的默认设置,并且初始化非常基础:
$('video').mediaelementplayer();
I'm using the default settings for my mediaelement.js player, and my initialization is very basic:
$('video').mediaelementplayer();
我的问题是: 当视频嵌入到iframe中时,是否可以全屏播放器? 当我按全屏显示时,视频会最大化到iframe,但不会最大化到整个屏幕. 这是html的局限性还是一种解决方法?
My question is: Is it possible to fullscreen the player when the video is embedded in an iframe? When I press fullscreen, the video maximizes to the iframe but not to the entire screen however. Is this a limitation of html or is there a way to get around it?
一般结构如下:
<!DOCTYPE html>
<html>
<head />
<body>
<iframe>
<!DOCTYPE html>
<html>
<head />
<body>
*My Video Here <video> ...*
<body>
</html>
</iframe>
</body>
</html>
谢谢!
看来这是特定于玩家的.默认的html5 <video>
实现即使在iframe中也可以最大化到全屏显示.
It seems this is player specific. The default html5 <video>
implementation maximizes to fullscreen just fine, even inside an iframe.
推荐答案
在video.js上偶然发现了这一点:
Stumbled upon this over at video.js:
答案是将这些属性添加到iframe:
<iframe … allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">
(尽管没有IE支持)
And the answer is to add these attributes to iframe:
<iframe … allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">
(no IE support though)
这篇关于将视频放置在iframe中后,如何使其全屏显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!