视频圈
This commit is contained in:
parent
c527fbddae
commit
fa016dc00e
|
@ -198,8 +198,9 @@
|
|||
|
||||
watch:{
|
||||
async k(k,old_k){
|
||||
console.log(k, old_k)
|
||||
// console.log(k, old_k)
|
||||
this.progressBarPercent = 0;
|
||||
|
||||
this.isShow = false
|
||||
this.dataList[old_k].playIng = false//如果视频暂停,就加载封面
|
||||
this.dataList[old_k].isplay = true
|
||||
|
@ -212,27 +213,9 @@
|
|||
this.isShow = true
|
||||
this.xrotats = setTimeout(()=>{
|
||||
this.showPlay = true;
|
||||
// #ifndef MP
|
||||
this.rotateX();
|
||||
// #endif
|
||||
},200)
|
||||
// #ifdef MP
|
||||
// 如果是小程序端
|
||||
clearTimeout(this.changeTimeout);
|
||||
this.dataList[k].isplay = false
|
||||
setTimeout(()=>{
|
||||
this.dataList[k].playIng = true
|
||||
},250)
|
||||
if(this.mptime < 0.2){
|
||||
this.changeTimeout = setTimeout(()=>{
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
},1400)
|
||||
} else {
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.dataList[k].isplay = true
|
||||
console.log("this.dataList[k].src",this.dataList[k].src)
|
||||
audo.src = this.dataList[k].src
|
||||
if(this.isClick){
|
||||
setTimeout(()=>{
|
||||
|
@ -264,7 +247,6 @@
|
|||
uni.createVideoContext(this.dataList[k].id+''+k,this).seek(0)
|
||||
uni.createVideoContext(this.dataList[k].id+''+k,this).pause()
|
||||
}
|
||||
// #endif
|
||||
var p = k+1;
|
||||
console.log('预加载第' + (p + 1) + '个视频:' + this.dataList[p].id+''+p)
|
||||
}
|
||||
|
@ -281,7 +263,6 @@
|
|||
this.boxStyle.width = this.windowWidth + 'px'//给宽度加px
|
||||
this.boxStyle.height = this.windowHeight - this.deleteHeight;//有 tabbar的 修改这里可以改变视频高度
|
||||
this.get() //刚进入页面加载数据
|
||||
|
||||
// #ifndef MP
|
||||
this.rotateX();
|
||||
// #endif
|
||||
|
@ -290,20 +271,31 @@
|
|||
onShow(){
|
||||
console.log('回到前台');
|
||||
if(this.dataList.length !== 0){
|
||||
// #ifdef MP
|
||||
this.dataList[this.k].state = 'play';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if(this.isClick){
|
||||
console.log(222)
|
||||
this.dataList[this.k].state = 'play';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
audo.play()
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
onHide(){
|
||||
// #ifdef MP
|
||||
this.dataList[this.k].state = 'pause';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause()
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if(this.isClick){
|
||||
this.dataList[this.k].state = 'pause';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause()
|
||||
audo.pause()
|
||||
}
|
||||
// #endif
|
||||
console.log('到后台');
|
||||
},
|
||||
|
||||
|
@ -592,17 +584,20 @@
|
|||
// this.dataList[this.k].isShowProgressBarTime = false
|
||||
this.ProgressBarOpacity = 0.5
|
||||
this.dotWidth = 0
|
||||
console.log('state--',state);
|
||||
console.log('state--1',state);
|
||||
// 1.启用双击点赞 --- start
|
||||
this.touchNum++;
|
||||
setTimeout(()=>{
|
||||
if(this.touchNum == 1){
|
||||
if(state=='play'||state=='continue'){
|
||||
this.dataList[this.k].state = 'pause';
|
||||
this.dataList[this.k].isplay = true;
|
||||
}else{
|
||||
this.dataList[this.k].state = 'continue';
|
||||
this.dataList[this.k].isplay = false;
|
||||
}
|
||||
if(this.dataList[this.k].state == 'continue'){
|
||||
this.dataList[this.k].isplay = false;
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play();//暂停以后继续播放
|
||||
this.clearTime();
|
||||
setTimeout(()=>{
|
||||
|
@ -610,6 +605,7 @@
|
|||
},50)
|
||||
}
|
||||
if(this.dataList[this.k].state == 'pause'){
|
||||
this.dataList[this.k].isplay = true;
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause();//暂停以后继续播放
|
||||
this.clearTime();
|
||||
}
|
||||
|
@ -636,7 +632,7 @@
|
|||
},
|
||||
//点击播放&&暂停
|
||||
tapVideoHovers(state,event){
|
||||
console.log('state--',state);
|
||||
console.log('state--2',state);
|
||||
if(state=='play'||state=='continue'){
|
||||
this.dataList[this.k].state = 'pause';
|
||||
}else{
|
||||
|
@ -644,23 +640,12 @@
|
|||
}
|
||||
if(this.dataList[this.k].state == 'continue'){
|
||||
this.isClick = true;
|
||||
this.dataList[this.k].playIng = true
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play();//暂停以后继续播放
|
||||
// #ifdef MP
|
||||
this.dataList[this.k].isplay = false
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
audo.play()
|
||||
// #endif
|
||||
this.dataList[this.k].playIng = true;
|
||||
this.dataList[this.k].muted = !this.dataList[this.k].muted;
|
||||
}
|
||||
if(this.dataList[this.k].state == 'pause'){
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause();//暂停以后继续播放
|
||||
// #ifdef MP
|
||||
this.dataList[this.k].isplay = true
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
audo.pause()
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
change(event){
|
||||
|
@ -727,22 +712,21 @@
|
|||
isplay: true,
|
||||
playIng: true,
|
||||
state: 'pause',
|
||||
src:item.filePath
|
||||
};
|
||||
});
|
||||
console.log("this.dataList",this.dataList)
|
||||
// 3.播放当前视频
|
||||
setTimeout(()=>{
|
||||
this.isShow = true;
|
||||
this.dataList[this.k].isplay = true
|
||||
this.dataList[this.k].isplay = false
|
||||
this.dataList[this.k].playIng = true
|
||||
setTimeout(()=>{
|
||||
// uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).seek(0)
|
||||
// uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause()
|
||||
this.dataList[this.k].state = 'play';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
this.dataList[this.k].state = 'pause';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).seek(0)
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause()
|
||||
audo.src = this.dataList[this.k].src;
|
||||
audo.play()
|
||||
// this.dataList[this.k].state = 'pause';
|
||||
|
||||
},500)
|
||||
},200)
|
||||
|
|
Loading…
Reference in New Issue