某网站的videojs的配置及操作
某网站的videojs的配置及操作
一、总结
一句话总结:
多参照参照别人的例子就好,省事
1、videojs如何获取用户当前视频的位置?
this.currentTime()
2、回到视频开始处?
player.currentTime(0);
二、内容在总结中
options={
playbackRates: [1,1.25,1.5,1.75,2],
controlBar: {
volumePanel: {
inline: false //默认是true,横着的
}
}
};
player=videojs('my-video',options);
player.ready(function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
enableVolumeScroll: false,
enableModifiersForNumbers: false
});
});
player.on('ended',function(){
hourid=player.now_hourid;
if(nv>1){
oldposter=$('.video-js').attr('oldposter');
$('.vjs-poster').css({'background-image':oldposter});
$('#my-video_html5_api').attr({'poster':oldposter});
notice_go();
$('.fullscreen').appendTo('.video-js').show();
$('.vrepeat').appendTo('.video-js').show();
nv=vlogo;
}else{
ajaxvideo(hourid);
$('.vjs-poster').css({'background-image':'none'});
$('#my-video_html5_api').attr({'poster':''});
player.play();
}
});
player.on('play',function(){
if(nv==1){
$('.vjs-control-bar').hide();
}else{
$('.vjs-control-bar').show();
if(player.srecordok){
srecord();
}
}
notice_go();
});
player.on('pause',function(){
clearInterval(srobj);
});
//学习记录
function srecord(){
srobj=setInterval(function(){
cid='46';
hid=player.now_hourid;
run=player.currentTime();
$.post('/Online/srecord',{'cid':cid,'hid':hid,'run':run});
},5000);
}
player.on('timeupdate',function(){
uid="8063";
ctime=player.currentTime();
if(!uid){
if(ctime>=30){
this.pause();
notice_go();
$('.plogin,.fullscreen').show();
return false;
}
}
});
function notice_go(){
$('.buycourse,.readcourse,.plogin,.vrepeat,.flogin,.fullscreen,.srecord').hide();
}
function ajaxvideo(hourid){
clearInterval(srobj);
$.ajax({
type:'post',
url:'/online/getvideo',
data:{'hourid':hourid,'nv':nv,'md5_token':md5_token},
async:false,
dataType:'json',
success:function(free){
if(free.s=='1'){
nv++;
player.src({'src':free.m3,'type':'application/x-mpegURL'});
player.now_hourid=hourid;
player.srecordok=free.srecordok;
$('.vjs-playback-rate-value').html('1x');
$('.vjs-menu-item').removeClass('vjs-selected');
$('.vjs-menu-item').last().addClass('vjs-selected');
$('.chapter_hour_str').html(free.chapter_hour_str);
$('.l-footer').html(free.prev_next);
$('.readcourse').html(free.welcome);
$('.vrepeat').html(free.next_end);
}
ajax_free=free;
}
});
return ajax_free;
}
ajaxvideo(hourid);
$('.srecord .pvrepeat_replay').click(function(){
player.currentTime(srow_run);
player.play();
});
$('.srecord .vrepeat_next').click(function(){
player.currentTime(0);
player.play();
});
// 到达上次记录
if(srow_run){
$('.fullscreen').show();
$('.srecord').show();
}
$('.nofabu').click(function(){
alert('亲,该节视频还未更新,每周都会有更新的,敬请关注');
return false;
});
$('.filedown').click(function(){
id=this.id;
obj=$(this);
uid="8063";
player.pause();
if(uid){
$.ajax({
type:'post',
url:'/filedown',
data:{id:id},
async:false,
success:function(rst){
if(rst!='0'){
obj.attr({'href':rst});
compute();
}else{
notice_go();
$('.fullscreen,.buycourse').show();
}
}
});
}else{
notice_go();
$('.fullscreen,.flogin').show();
}
});
$('.rightvideoli').click(function(){
$('.rightvideoli').find('.mylearnhour1').css({'color':'#F78080'});
$('.rightvideoli').find('.gohour').css({'color':'#000'});
$('.rightvideoli').find('.mybackground').hide();
$(this).find('.mybackground').show();
$(this).find('.mylearnhour1,.gohour').css({'color':'#fff'});
});
$('.rightfileli').mouseenter(function(){
$('.rightfileli').find('.mylearnhour1').css({'color':'#F78080'});
$('.rightfileli').find('.filedown').css({'color':'#000'});
$('.rightfileli').find('.mybackground3').hide();
$(this).find('.mybackground3').show();
$(this).find('.mylearnhour1,.filedown').css({'color':'#fff'});
});
$('.rightfileli').mouseleave(function(){
$(this).find('.mybackground3').hide();
$('.rightfileli').find('.mylearnhour1').css({'color':'#F78080'});
$('.rightfileli').find('.filedown').css({'color':'#000'});
});
$('.nofabu').mouseenter(function(){
$('.nofabu').find('.mylearnhour2').css({'color':'#a8a8a8'});
$('.nofabu').find('.gohour2').css({'color':'#000'});
$('.nofabu').find('.mybackground2').hide();
$(this).find('.mybackground2').show();
$(this).find('.mylearnhour2,.gohour2').css({'color':'#fff'});
});
$('.nofabu').mouseleave(function(){
$(this).find('.mybackground2').hide();
$(this).find('.gohour2').css({'color':'#000'});
$('.nofabu').find('.mylearnhour2').css({'color':'#a8a8a8'});
});
$('body').delegate('.gohour,.return-prev,.return-next','click',function(){
hourid=$(this).attr('hourid');
sort=$(this).attr('sort');
nv=vlogo;
oldposter=$('.video-js').attr('oldposter');
$('.vjs-poster').css({'background-image':'url('+oldposter+')'});
$('#my-video_html5_api').attr({'poster':oldposter});
ajax_res=ajaxvideo(hourid);
menu_item(sort);
notice_go();
if(ajax_res.acl>0){
$('.fullscreen,.readcourse').finish().show();
$('.fullscreen,.readcourse').finish().fadeOut(2000);
}else{
$('.fullscreen,.buycourse').show();
}
});
$('body').delegate('.vp_next,.vrepeat_replay','click',function(){
hourid=$(this).attr('hourid');
sort=$(this).attr('sort');
nv=vlogo;
oldposter=$('.video-js').attr('oldposter');
$('.vjs-poster').css({'background-image':'url('+oldposter+')'});
$('#my-video_html5_api').attr({'poster':oldposter});
ajax_res=ajaxvideo(hourid);
menu_item(sort);
notice_go();
if(ajax_res.acl>0){
$('.fullscreen,.vrepeat').finish().show();
$('.fullscreen,.vrepeat').finish().fadeOut(2000);
}else{
$('.fullscreen,.buycourse').show();
}
});
menu_n="2";
menu_item(menu_n);
function menu_item(menu_n){
$('.rightvideoli').find('.gohour').css({'color':'#000'});
$('.rightvideoli').find('.mylearnhour1').css({'color':'#F78080'});
$('.rightvideoli').find('.mybackground').hide();
$('.rightvideoli').eq(menu_n-1).find('.gohour,.mylearnhour1').css({'color':'#fff'});
$('.rightvideoli').eq(menu_n-1).find('.mybackground').show();
}
某网站的videojs的配置及操作的更多相关文章
- 基于NopCommerce的开发框架——缓存、网站设置、系统日志、用户操作日志
最近忙于学车,抽时间将Nop的一些公用模块添加进来,反应的一些小问题也做了修复.另外有园友指出Nop内存消耗大,作为一个开源电商项目,性能方面不是该团队首要考虑的,开发容易,稳定,代码结构清晰简洁也是 ...
- CentOS 配置防火墙操作实例(启、停、开、闭端口):
CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status< ...
- Redis快速入门:安装、配置和操作
本文是有关Redis的系列技术文章之一.在之前的文章中介绍了<Redis快速入门:初识Redis>,对Redis有了一个初步的了解.今天继续为大家介绍Redis如何安装.配置和操作. 系列 ...
- 征服 Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)
有日子没写博客了,真的是忙得要疯掉. 完成项目基础架构搭建工作,解决了核心技术问题,接着需要快速的调研下基于Spring框架下的Redis操作. 相关链接: 征服 Redis 征服 Redis + J ...
- CentOS 配置防火墙操作实例(启、停、开、闭端口)CentOS Linux-FTP/对外开放端口(接口)TomCat相关
链接地址:http://blog.csdn.net/jemlee2002/article/details/7042991 CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作 ...
- Redis:安装、配置、操作和简单代码实例(C语言Client端)
Redis:安装.配置.操作和简单代码实例(C语言Client端) - hj19870806的专栏 - 博客频道 - CSDN.NET Redis:安装.配置.操作和简单代码实例(C语言Client端 ...
- CentOS配置防火墙操作实例
CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status<回 ...
- SAP Parallel Accounting(平行分类账)业务配置及操作手册
目录 SAP Parallel Accounting(平行分类账业务)配置及操作手册 SAP Parallel Accounting(平行分类账业务)配置及操作手册 Overview 业务说明 为了适 ...
- SAP按销售订单生产和标准结算配置及操作手册
SAP按销售订单生产和标准结算配置及操作手册 http://blog.sina.com.cn/s/blog_6787c0b80101a3tl.html SAP按销售订单生产和标准结算配置及操作手册 S ...
随机推荐
- face_code业务信息不匹配
face_code业务信息不匹配 检查获取 face code时的 appid, mch_id,out_trade_no以及可选的sub_mch_id , 与 face pay 时是否一致.
- EM算法概念
EM算法是一种非常经典的alternative optimizing算法.alternative optimizing的思想就是对于一个最优化问题,可以计算分为两步或者参数分为两个,就可以随机任意的选 ...
- docker 搭建私有 docker hub
查找registry 镜像 meiya@meiya:/etc/docker$ clear meiya@meiya:/etc/docker$ docker search registry NAME DE ...
- qt linux下自动检测U盘热插拔
如果用U盘来更新软件,需要先删除当前的可执行文件,但是如果删除之后,复制失败的话会导致后续没有文件可以运行了.一个方法是将新的可执行文件放到另一个目录中,当copy成功后修改linux的启动文件,然后 ...
- SpringCloud用Zookeeper做服务注册与发现中心代码实现
一:Zookeeper用的是3.5.5版本,SpringBoot用的是2.1.6版本,SpringCloud用的是Greenwich.SR2版本,JDK用的是1.8: 服务提供者product-ser ...
- Quartz.Net—初识
什么是Quartz.Net 计划任务,定时框架.大到可以做灾难转移 负载均衡.小到可以做定时生成数据,数据更新等等. 官网 http://www.quartz-scheduler.org/ Q ...
- JAVA httpURLConnection curl
// 文件路径 D:\ApacheServer\web_java\HelloWorld\src\com\test\TestHttpCurl.java package com.test; import ...
- Linux7 安装python3.5.4
1.首先修改yum配置文件 因为yum使用python2,因此替换为python3后可能无法正常工作,继续使用这个python2.7.5 因此修改yum配置文件(vi /usr/bin/yum). 把 ...
- Cookie,Session,Token详解
Cookie,Session,Token详解 Cookie : 是一个非常具体的东西,指的就是浏览器里面能永久存储的一种数据,仅仅是浏览器实现的一种数据存储功能. Cookie由服务器生成,发 ...
- Linux基础-02-目录文件管理
1. Linux文件系统的层次结构 1) Linux文件系统的树状结构: 在Linux或UNIX操作系统中,所有的文件和目录都被组织成一个以根节点开始的倒置的树状结构. 2) 目录的定义: 目录相当于 ...