Firefox 3.6 视频全屏控制
Firefox 现在支持视频 html5 标签的全屏模式。 (右键单击电影..)
有什么方法可以创建一个控件(html标签)来执行此操作,就像这个播放/暂停示例(使用js)?
<script>
function play(){
var video = document.getElementById('movie');
var play = document.getElementById('play');
play.addEventListener('click',playControl,false);
function playControl() {
if (video.paused == false) {
video.pause();
this.firstChild.nodeValue = 'Play';
pauseCount();
} else {
video.play();
this.firstChild.nodeValue = 'Pause';
startCount();
}
}
}
Firefox now supports full screen mode on the video html5 tag. ( right click on the movie .. )
Is there any way to create a control ( html tag ) to do this like this play/pause example ( using js ) ?
<script>
function play(){
var video = document.getElementById('movie');
var play = document.getElementById('play');
play.addEventListener('click',playControl,false);
function playControl() {
if (video.paused == false) {
video.pause();
this.firstChild.nodeValue = 'Play';
pauseCount();
} else {
video.play();
this.firstChild.nodeValue = 'Pause';
startCount();
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,您需要的只是创建一个函数(由全屏按钮触发),在其中为视频包装器指定一个位置:绝对和更高的 z 索引
,您将指定视频和视频包装器的宽度和高度:100%(或固定大小(如果您愿意)
可能实现此行为的最佳方法是定义一个类(例如全屏)并将其分配给容器,就像
函数调用(全屏/普通视图)是
的开关.fullscreen
类。basically all you need is creating a function (triggered by a fullscreen button) in which you assign a position: absolute, and an higher z-index to the video wrapper
the you will assign both video and video wrapper width and height : 100% (or fixed size if you prefer)
probably the best way to achieve this behaviour is defining a class (e.g. fullscreen) and assign it to the container, something like
so the function call (fullscreen/normal view) is a switch for the
.fullscreen
class.