某网站的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的配置及操作的更多相关文章

  1. 基于NopCommerce的开发框架——缓存、网站设置、系统日志、用户操作日志

    最近忙于学车,抽时间将Nop的一些公用模块添加进来,反应的一些小问题也做了修复.另外有园友指出Nop内存消耗大,作为一个开源电商项目,性能方面不是该团队首要考虑的,开发容易,稳定,代码结构清晰简洁也是 ...

  2. CentOS 配置防火墙操作实例(启、停、开、闭端口):

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status< ...

  3. Redis快速入门:安装、配置和操作

    本文是有关Redis的系列技术文章之一.在之前的文章中介绍了<Redis快速入门:初识Redis>,对Redis有了一个初步的了解.今天继续为大家介绍Redis如何安装.配置和操作. 系列 ...

  4. 征服 Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)

    有日子没写博客了,真的是忙得要疯掉. 完成项目基础架构搭建工作,解决了核心技术问题,接着需要快速的调研下基于Spring框架下的Redis操作. 相关链接: 征服 Redis 征服 Redis + J ...

  5. CentOS 配置防火墙操作实例(启、停、开、闭端口)CentOS Linux-FTP/对外开放端口(接口)TomCat相关

    链接地址:http://blog.csdn.net/jemlee2002/article/details/7042991 CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作 ...

  6. Redis:安装、配置、操作和简单代码实例(C语言Client端)

    Redis:安装.配置.操作和简单代码实例(C语言Client端) - hj19870806的专栏 - 博客频道 - CSDN.NET Redis:安装.配置.操作和简单代码实例(C语言Client端 ...

  7. CentOS配置防火墙操作实例

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status<回 ...

  8. SAP Parallel Accounting(平行分类账)业务配置及操作手册

    目录 SAP Parallel Accounting(平行分类账业务)配置及操作手册 SAP Parallel Accounting(平行分类账业务)配置及操作手册 Overview 业务说明 为了适 ...

  9. SAP按销售订单生产和标准结算配置及操作手册

    SAP按销售订单生产和标准结算配置及操作手册 http://blog.sina.com.cn/s/blog_6787c0b80101a3tl.html SAP按销售订单生产和标准结算配置及操作手册 S ...

随机推荐

  1. Uncaught Error: `setOption` should not be called during main process.

    主要是自己记笔记用,大佬些莫怪! 使用 echart 出现 :Uncaught Error: `setOption` should not be called during main process. ...

  2. JMeter 脚本请求错误 HTTP Status 415 的解决

    然后在http请求上点击右键,添加配置元件-http信息头管理器,在信息头管理器上,添加一个参数,名称:Content-Type,值:application/json.然后在http请求上,conte ...

  3. java后台面试之计算机网络问题集锦

    1.http和https的区别 2.对称加密和非对称加密 3.三次握手与四次挥手的流程 4.为什么TCP需要三次握手?两次不可以吗?为什么 5.为什么TCP挥手需要四次?三次不行吗? 6.TCP协议如 ...

  4. IntelliJ IDEA - 查找代码提交人

    转载. https://blog.csdn.net/abcyyjjkk/article/details/88995503 如果Annocation不可用

  5. 从零开始学Flask框架-007

    Flash消息 from flask import flash 渲染Flash消息,在基模板base.html中引入get_flashed_messages() {% extends "bo ...

  6. Go语言学习笔记(10)——错误处理示例

    // 定义一个 DivideError 结构 type DivideError struct { dividee int divider int } // 实现 `error` 接口 func (de ...

  7. Vuex入门、同步异步 存取值

    目的: 1.了解vuex中的各个js文件的用途 2.利用vuex存值 3.利用vuex取值 4.Vuex的异步同步加载问题 1. vuex中各个组件之间传值 1.父子组件 父组件-->子组件,通 ...

  8. vue 写一个瀑布流插件

    效果如图所示: 采用了预先加载图片,再计算高度的办法..网络差的情况下,可能有点卡 新建 vue-water-easy.vue  组件文件 <template> <div class ...

  9. vue.js+DRF跨域访问图片

    一.背景 在前后端分离过程时,后端服务器只开放本地接口,而前端则开放IP接口,在DRF响应请求时,会把域名(locahost+port)响应给前端服务器,前端服务器把再把数据响应给浏览器,浏览器在解析 ...

  10. python之函数基本使用

    函数的定义: 函数是一段具有特定功能的.可重用的语句组,用函数名来表示并通过函数名进行功能调用. 使用函数主要有两个目的:降低编程难度和代码重用. python定义一个函数是通过使用def保留字的方式 ...