当前位置:网站首页>uniapp实现禁止video拖拽快进
uniapp实现禁止video拖拽快进
2022-06-24 09:43:00 【马小跳会Coding】
在项目开发过程中,难免会用到video视频标签。根据客户要求,视频只能正常观看完,不能手动快进,以下是实现的方法:
<!--1.video标签-->
<video id="myVideo" @timeupdate="videoFun" :src="videourl" initial-time="initial_time" >
<script> export default {
data() {
//2.data数据部分 return {
videourl: "https://vd3.bdstatic.com/mda-me38qw5ayq6m5x6k/sc/cae_h264/1620080580731464743/mda-me38qw5ayq6m5x6k.mp4?v_from_s=hkapp-haokan-nanjing&auth_key=1654941744-0-0-e46a5e5c83b069fcaf54124cd256af20&bcevod_channel=searchbox_feed&pd=1&cd=0&pt=3&logid=1944747745&vid=1074518001243819841&abtest=102599_2-102777_6-102784_1-17451_1-3000225_3-3000232_1&klogid=1944747745", video_real_time: 0, //实时播放进度 nitial_time: '', //视频跳转进度 秒 } }, onLoad(option) {
//3.onload部分 this.initial_time = '0' //视频进度 }, methods: {
//4.方法部分 videoFun(e){
var isReady = 1; // 是否开启可以视频快进 1 禁止开启 //跳转到指定播放位置 initial-time 时间为秒 let that = this; //播放的总时长 var duration = e.detail.duration //实时播放进度 秒数 var currentTime = parseInt(e.detail.currentTime) //当前视频进度 // console.log("视频播放到第" + currentTime + "秒")//查看正在播放时间,以秒为单位 if (that.video_real_time == 0) {
var jump_time = parseInt(that.initial_time) + parseInt(that.video_real_time) } else {
var jump_time = parseInt(that.video_real_time) } if (isReady == 1) {
if (currentTime > jump_time && currentTime - jump_time > 3) {
let videoContext = wx.createVideoContext('myVideo') videoContext.seek(that.video_real_time) wx.showToast({
title: '未完整看完该视频,不能快进', icon: 'none', duration: 2000, }) } } that.video_real_time = currentTime //实时播放进度 } } } </script>
边栏推荐
- numpy.logical_and()
- GIS实战应用案例100篇(十四)-ArcGIS属性连接和使用Excel的问题
- 413-二叉树基础
- 413 binary tree Foundation
- Impdp leading schema message ora-31625 exception handling
- 415 binary tree (144. preorder traversal of binary tree, 145. postorder traversal of binary tree, 94. inorder traversal of binary tree)
- 记录一下MySql update会锁定哪些范围的数据
- Three ways to use applicationcontextinitializer
- Getting user information for applet learning (getuserprofile and getUserInfo)
- 为什么 JSX 语法这么香?
猜你喜欢
随机推荐
操作符详解
英伟达这篇CVPR 2022 Oral火了!2D图像秒变逼真3D物体!虚拟爵士乐队来了!
LeetCode: 240. Search 2D matrix II
How to improve the efficiency of network infrastructure troubleshooting and bid farewell to data blackouts?
Development of anti fleeing marketing software for health products
GIS实战应用案例100篇(十四)-ArcGIS属性连接和使用Excel的问题
canvas无限扫描js特效代码
SSH Remote Password free login
请问有国内靠谱低手续费的期货开户渠道吗?网上开户安全吗?
dedecms模板文件讲解以及首页标签替换
时尚的弹出模态登录注册窗口
Thinkphp5 clear the cache cache, temp cache and log cache under runtime
port 22: Connection refused
植物生长h5动画js特效
上升的气泡canvas破碎动画js特效
正规方程、、、
canvas掉落的小球重力js特效动画
Record the range of data that MySQL update will lock
物联网?快来看 Arduino 上云啦
Programming questions (continuously updated)









