function VideoControls(option){
this.id = option.videoId;
this.videoId = document.getElementsByTagName(option.videoId)[0];
this.prismplayer = option.prismplayer;
this.controls = $(".controls");
this.initData = {
playImage:"url('../../images/wx/experience/play.png')",
pauseImage:"url('../../images/wx/experience/pause.png')"
};
}
VideoControls.prototype = {
play:false,
allTime:"",
init:function(option){
this.allTimeFunction(option.time);
this.range();
this.click();
},
click:function(){
var self = this;
$("#playpausebtn").on("click",function(e){
e.stopPropagation();
self.playBtn($(this));
});
$("#fullscreenbtn").on("click",function(){
self.fullScreen();
});
},
timeIntel:function(time){
var mTime = Math.floor((time / 60));
var sTime = parseInt(time % 60);
var m = mTime > 9 ? mTime : "0" + mTime;
var s = sTime > 9 ? sTime : "0" + sTime;
return m + ":" + s;
},
currentTime:function(time){
$("#currentTime").html(this.timeIntel(time));
},
allTimeFunction:function(data){
var vallTime = data;
$("#allTime").html(this.timeIntel(vallTime));
this.allTime = vallTime;
},
range:function(time){
var self = this;
$("#seekslider").on("change",function(){
var val = ($(this).val() / 100) * self.allTime;
self.videoId.currentTime = val;
self.currentTime(val);
});
if(time){
$("#seekslider").val((time / self.allTime) * 100);
}
},
playBtn:function(self){
self = self || $("#playpausebtn");
var bgImg; if(this.play){
bgImg = this.initData.playImage;
this.prismplayer.pause();
}else{
bgImg = this.initData.pauseImage;
this.prismplayer.play();
} self.css({
"backgroundImage":bgImg
}); this.play = !this.play;
this.changeStatus();
},
changeStatus:function(){
var controls = this.controls;
controls.removeClass("controlshide");
setTimeout(function(){
controls.addClass("controlshide");
},1500);
},
fullScreen:function(){
    // moboile will bug , TODO
//$(this.id).removeAttr("webkit-playsinline").removeAttr("playsinline").attr("x5-video-player-fullscreen","true");
if(this.videoId.requestFullScreen){
alert(1)
this.videoId.requestFullScreen();
} else if(this.videoId.webkitRequestFullScreen){
alert(2)
this.videoId.webkitRequestFullScreen();
} else if(this.videoId.mozRequestFullScreen){
alert(3)
this.videoId.mozRequestFullScreen();
}else{
alert(0)
}
},
timeupdate:function(time){
this.currentTime(time);
this.range(time);
}
};

video control的更多相关文章

  1. Video Codecs by FOURCC 视频格式编码

    FOURCC Name Summary 1978 A.M.Paredes predictor This is a LossLess video codec. >>> 2VUY 2VU ...

  2. HTML 5 简介、视频、Video + DOM、音频、拖放

    HTML5 是下一代的 HTML. 什么是 HTML5? HTML5 将成为 HTML.XHTML 以及 HTML DOM 的新标准. HTML 的上一个版本诞生于 1999 年.自从那以后,Web ...

  3. 6、USB Video Class Specification

    关于USB Class 将设备归为既定的类别,并对相应类别的设备的在USB协议的应用级协议和接口作出规范,这样只要按照类设备的标准实现驱动程序和设备,则一套驱动可以驱动这一类的所有设备,而这一类设备可 ...

  4. Python应用03 使用PyQT制作视频播放器

    作者:Vamei 出处:http://www.cnblogs.com/vamei 严禁任何形式转载. 最近研究了Python的两个GUI包,Tkinter和PyQT.这两个GUI包的底层分别是Tcl/ ...

  5. linux查看端口及端口详解

    今天现场查看了TCP端口的占用情况,如下图   红色部分是IP,现场那边问我是不是我的程序占用了tcp的链接,,我远程登陆现场查看了一下,这种类型的tcp链接占用了400多个,,后边查了一下资料,说E ...

  6. DirectShow Filter的开发实践

    一.介绍 摄像头图像采集处理在业界有着多种成熟的方案.从老的DirectShow.Grabber技术,到新的Windows Media Foundation框架,网络上都有着丰富的参考资料.OpenC ...

  7. bluetooth service uuid

    转自:https://www.bluetooth.com/specifications/assigned-numbers/service-discovery service discovery ​​​ ...

  8. Linux摄像头驱动学习之:(五)UVC-分析设备描述符

    linux系统上插上USB摄像头设备后,内存就会有相应的设备描述符信息,后期可以根据这些信息进一步写驱动程序. 流程:Device(设备) -> Configuration(配置) -> ...

  9. PyQT制作视频播放器

    Python应用03 使用PyQT制作视频播放器   作者:Vamei 出处:http://www.cnblogs.com/vamei 严禁任何形式转载. 最近研究了Python的两个GUI包,Tki ...

随机推荐

  1. nodemcu使用心得1

    1.简介 最近迷上了性价比超高的模块nodemcu,它是基于esp8266-12E的非常易用的模块.他可以用lua语言编程,带有丰富的库. 2.硬件 1)esp8266-12E单元模块原理图 经本人实 ...

  2. BZOJ1280 Emmy卖猪pigs 网络流

    正解:网络流 解题报告: 传送门! 我网络流的基础题都还麻油做完就来做这个了,,,wsl,,, 首先想下最基础的构图方法 不难想到把猪圈和顾客分别当做节点,然后新建一个源点和汇点 然后考虑怎么连边,首 ...

  3. C语言课堂题集

    1.输入一个整数,然后将其数字位置颠倒. int c,d=0,e; scanf("%d",&c); while (c!=0) { e=c%10; d=d*10+e; c/= ...

  4. 前端 HTML body标签相关内容 常用标签 定义列表<dl>

    定义列表<dl> 定义列表的作用非常大. <dl>英文单词:definition list,没有属性.dl的子元素只能是dt和dd. <dt>:definition ...

  5. 如何修改帝国cms文章点击量默认值和成倍增加

    我们在帝国cms发布完文章,在不点击的情况下,“点击量”默认显示为0,请问有什么方法,修改关注默认值吗?这个可以在增加信息时,“特殊属性”标签里修改点击量,如下图 有朋友问有没其他好的方法快速增加.成 ...

  6. JSONObject,String,Map互相转换

    JSONObject和String相互转换 JSONObject jsonObject = new JSONObject(); JSONArray jsonArray = new JSONArray( ...

  7. 火币网API文档——WebSocket API错误码

    错误信息返回格式 { "id": "id generate by client", "status": "error", ...

  8. what's the 爬虫之基本原理

    what's the 爬虫? 了解爬虫之前,我们首先要知道什么是互联网 1.什么是互联网? 互联网是由网络设备(网线,路由器,交换机,防火墙等等)和一台台计算机连接而成,总体上像一张网一样. 2.互联 ...

  9. Hive SQL测试

    在spark的空表test上进行运算,注意结果差异: ,age)) as ages from test group by name;//空 ,age)) as ages from test group ...

  10. 进程间通信IPC机制和生产者消费者模型

    1.由于进程之间内存隔离,那么要修改共享数据时可以利用IPC机制 我们利用队列去处理相应数据 #管道 #队列=管道+锁 from multiprocessing import Queue # q=Qu ...