某网站的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. C++ 宏和模板简介

    参考<21天学通C++>第14章节,对C++中的宏和模板进行了学习,总结起来其主要内容如下: (1) 预处理器简介 (2) 关键字#define与宏 (3) 模板简介 (4) 如何编写函数 ...

  2. Flask项目中使用mysql数据库启动项目是发出警告

    Flask项目中使用mysql数据库启动项目是发出警告: Warning: (1366, "Incorrect string value: '\xD6\xD0\xB9\xFA\xB1\xEA ...

  3. Android模拟器Genymotion安装使用教程详解

    一.注册\登录 打开Genymotion官网,https://www.genymotion.com/ ,首先点击右上角的Sign in进行登录操作.如何登录就不细讲了,下面讲一下如何注册(备注:注册按 ...

  4. windows添加“以管理员身份运行”

    方法: 新建一个txt文件,命名为"admin.txt",记得打开"显示后缀名",要求看到.txt并可修改之. 将下列代码粘贴进去. Windows Regis ...

  5. Ribbon学习笔记

    微服务的概念: Ribbon默认的是轮询的算法:   @LoadBalanced @EnableEurekaClient Irule是根据 Ribbon默认(轮询)的7中负载均衡的算法: 修改默认的R ...

  6. 《Mysql - Order By 的工作原理?》

    一:概述 - order by 用于 SQL 语句中的排序. - 以  select city,name,age from t where city='杭州' order by name limit ...

  7. Visual Studio 设置为 UTF-8 保存格式

    1. 步骤 Visual Studio 提供高级保存选项功能,它能指定特定代码文件的编码规范和行尾所使用的换行符. 在 VS 中,该命令没有默认显示在「文件」菜单中.用户需要手工设置,才能显示该命令. ...

  8. PHP中类的继承与方法重写

    php中类的继承与方法重写,欢迎大神补充指点! <?php namespace _1009; class Demo5 { //实例属性 public $product; public $pric ...

  9. Linux基础-04-权限

    1. 查看文件的权限 1) 使用ls –l命令查看文件上所设定的权限. -rw-r--r-- 1 root root 605 Mar 18 20:28 .jp1.tar.gz 权限信息 属主 属组 文 ...

  10. Scala 数组操作之数组转换

    使用yield和函数式编程转换数组 // 对Array进行转换,获取的还是Array val a = Array(1, 2, 3, 4, 5) val a2 = for (ele <- a) y ...