vue-video-player怎么禁止快进 可以后退?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue-video-player怎么禁止快进 可以后退?相关的知识,希望对你有一定的参考价值。

参考技术A <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./font_m6b36j857h/demo.css">
<link rel="stylesheet" href="./font_m6b36j857h/iconfont.css">

<style>
.container
position: relative;
width: 640px;
height: 360px;
border: 1px solid red;
margin: 100px auto;


.container video
width: 100%;
height: 100%;

.container .control
position: absolute;
left: 20px;
bottom: 10px;
width: 600px;
height: 30px;

background: rgba(0, 0, 0, .5)


.control .switch
position: absolute;
left: 10px;
top: 5px;


.control .icon
cursor: pointer;
color: #fff;
font-size: 20px;

.control .process
position: absolute;
left: 36px;
top: 7px;
width: 350px;
height: 18px;
border-radius: 9px;
background-color: #555;
overflow: hidden;
cursor: pointer;


.control .process .bar
position: absolute;
left: 0;
top: 0;
width: 0px;
height: 100%;
background-color: #fff;

.control .time
position: absolute;
right: 60px;
top: 6px;
color: #fff;

.control .sound
position: absolute;
right: 33px;
top: 6px;


.control .full
position: absolute;
right: 6px;
top: 6px;
cursor: pointer;

</style>
</head>
<body>
<div>
<video src="https://act.mcake.com/fangli/2018/pc/zhou-nian/video/zhounian-7.mp4" poster="./images/poster.jpg"></video>
<div>
<i class="icon icon-play switch" id="switch">123</i>
<div>
<div></div>
</div>
<div>
<span>00:00:00</span> /
<span>00:00:00</span>
</div>
<i class="icon icon-sound sound">123</i>
<i class="icon iconfont full" id="full">123</i>
</div>
</div>
<script>
var btn = document.querySelector('#switch');
var video = document.querySelector('video');
var spans = document.querySelectorAll('.control .time span');
var process = document.querySelector('.process');
var bar = document.getElementsByClassName('bar')[0];
var full = document.querySelector('#full');
// console.log(spans[0]);
var total = 0;
var processWidth = process.offsetWidth;
// console.log(processWidth);
var currenttime = undefined;
var endbarwidth = undefined;

var num = 1;

//视频开始和暂停切换
btn.onclick = function ()
// console.log(video.paused);
if(video.paused)
video.play();
this.classList.remove('icon-play');
this.classList.add('icon-pause');
else
video.pause();
this.classList.remove('icon-pause');
this.classList.add('icon-play');



//获取视频时间
//当视频可以播放的时候才可以获取不然获取不到
video.oncanplay = function ()
total = video.duration;

// console.log(total); //以秒为单位
spans[1].innerHTML = getTime(total);
// console.log(spans[1]);

//当视频播放
video.ontimeupdate = function()
currenttime = video.currentTime;
spans[0].innerHTML = getTime(currenttime);
barWidth = processWidth * currenttime / total; // 当前时间
endbarwidth = processWidth * currenttime / total; // 记录最长时间
bar.style.width = barWidth + 'px';


//点击进度条下面的凹槽 也算是障眼法
process.onclick = function (e)
num += 1;
if ( num == 2)
localStorage.setItem('endbarwidth', endbarwidth);

console.log(e.offsetX);
var losW = undefined;
if (localStorage.getItem('endbarwidth'))
losW = parseFloat(localStorage.getItem('endbarwidth'))

console.log(losW);
if (e.offsetX < losW) //
video.currentTime = total * e.offsetX / processWidth;
else if (e.offsetX > barWidth)
return;
else
video.currentTime = total * e.offsetX / processWidth;



//视频结束时
video.onended = function ()
video.currentTime = 0;
btn.classList.remove('icon-pause');
btn.classList.add('icon-play');


//全屏开启
full.onclick = function()
if(video.webkitRequestFullScreen)
video.webkitRequestFullScreen();
else if (video.mozRequestFullScreen)
video.mozRequestFullScreen();
else if (video.msRequestFullScreen)
video.msRequestFullScreen();
else if (video.oRequestFullScreen)
video.oRequestFullScreen();
else
video.requestFullScreen();




function getTime(time)
var hours = Math.floor(time%86400/3600);

var minutes = Math.floor(time%86400%3600/60);

var seconds = Math.floor(time%60);
// console.log(seconds);

hours = hours > 10 ? hours : '0' + hours;
minutes = minutes > 10 ? minutes : '0' + minutes;
seconds = seconds > 10 ? seconds : '0' + seconds;

var str = '';
str = hours + ':' + minutes + ':' + seconds;
// console.log(str);
return str;

</script>
</body>
</html>
参考技术B 使用安卓手机的用户可能已经安装了任务管理软件。安卓手机真的需要安装结束任务的软件吗?每个人都发现它在使用中。很多软件在被终止后会立即出现在任务列表中,或者会在一段时间后自行出现。任务管理不断结束后台程序,我没看到。手机的运行速度能带来多大的提升,为什么?事实上,你不需要太在意安卓手机的剩余内存大小。很多人把使用其他系统的习惯带到了安卓手机上,并不是所有的智能手机系统都是一样的。大多数android应用程序不退出的设计其实是合理的,这与系统对进程的调度机制有关。如果你了解java,你可以更好地理解这个机制。实际上,类似于Java的垃圾回收机制,系统有一个规则来回收内存。内存调度是有阈值的,只有低于这个阈值,系统才会按照列表关闭用户不需要的东西。当然这个值默认设置得非常小,所以你会看到内存在很少的值附近徘徊。但实际上他并不影响速度。相反,它加快了应用程序的下一次启动。这也是安卓的优势之一。如果您手动关闭该进程,则没有必要。

英语里的‘快进,快退,播放,暂停,怎么说?

参考技术A 快进/快退:fastwind(有不同的符号)
播放:play
暂停:pause
参考技术B fast forward,rewind,play,pause 参考技术C 快进:fast forward
快退:fast rewind
播放:play
暂停:pause
参考技术D fst frward ,fst rwind ,play, pause 第5个回答  2010-08-11 fastforward,fast reverse,play,suspend

以上是关于vue-video-player怎么禁止快进 可以后退?的主要内容,如果未能解决你的问题,请参考以下文章

关于jwplayer 处理进度条禁止快进的处理方法。

Vue 实现 H5video 视频标签 禁止快进 最优

Video/Audio禁止快进(退)

uniapp实现禁止video拖拽快进

腾讯视频怎么快进

求助:Vue 中 vue-video-player 组件 的使用