swiper和video实现抖音刷视频功能

实现抖音刷视频功能 



	
		
			
				
			
		
	


//上下滑动触发事件
changeplay(res) {
	console.log('res', res);
	clearTimeout(time)
	this.page = res.detail.current
	time = setTimeout(() => {
		if (this.pageStatrY < this.pageEndY) {

			console.log('向上滑动')
			setTimeout(() => {
				this.$refs.player[this.page].player()
			}, 20)

			this.$refs.player[this.page + 1].pause()
			this.pageStatrY = 0
			this.pageEndY = 0
		} else {
			console.log('向下滑动')
			setTimeout(() => {
				this.$refs.player[this.page].player()
			}, 20)
			console.log('page', this.page - 1, this.$refs.player);
			this.$refs.player[this.page - 1].pause()
			this.pageStatrY = 0
			this.pageEndY = 0
		}
	}, 1)
},
//获取向下滑动的值
touchStart(res) {

	this.pageStatrY = res.changedTouches[0].pageY
	console.log('pageStatrY', this.pageStatrY)
},
//获取向上滑动的值
touchEnd(res) {
	this.pageEndY = res.changedTouches[0].pageY
	console.log('pageEndY', this.pageEndY)
},

videoPlayer 组件





!!!!目前我这个小程序是可以用的,但是华为快应用不行(uniapp转华为快应用)

你可能感兴趣的:(音视频,数据库,linux)