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