视频圈
This commit is contained in:
parent
9618e035dc
commit
805cb8b0c0
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 视频 id 切记是字符串类型 -->
|
||||
<image v-if="isShowAixin" src="@/static/img/index/aixining.png" :style="'position: fixed; margin-left: '+ aixinLeft +'px; margin-top: '+ aixinTop +'px; width: 70px; height: 65px; transform: rotate('+ Rotate +'deg);'"></image>
|
||||
<!-- <image v-if="isShowAixin" src="@/static/img/index/aixining.png" :style="'position: fixed; margin-left: '+ aixinLeft +'px; margin-top: '+ aixinTop +'px; width: 70px; height: 65px; transform: rotate('+ Rotate +'deg);'"></image> -->
|
||||
<swiper :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px; background-color: #000000;'" :vertical="true" @animationfinish="animationfinish" @change="change" :current="current" :indicator-dots="false" :duration="duration">
|
||||
<swiper-item v-for="(list,index) in dataList" :key="index">
|
||||
<view v-if="Math.abs(k-index)<=1">
|
||||
|
@ -32,7 +32,7 @@
|
|||
@click="tapVideoHover(list.state,$event)"
|
||||
@timeupdate="timeupdate($event,index)"
|
||||
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px; background-color: #000000; z-index: 8;'"
|
||||
:poster="list.filePath+'?x-oss-process=video/snapshot,t_100,f_jpg'"
|
||||
:poster="list.filePath"
|
||||
></video>
|
||||
<!--
|
||||
1.这里是封面(方案二):这里的封面可以自定义。
|
||||
|
@ -242,6 +242,7 @@
|
|||
}
|
||||
},200)
|
||||
} else {
|
||||
console.log(88)
|
||||
audo.pause()
|
||||
this.dataList[k].state = 'pause'
|
||||
uni.createVideoContext(this.dataList[k].id+''+k,this).seek(0)
|
||||
|
@ -263,39 +264,28 @@
|
|||
this.boxStyle.width = this.windowWidth + 'px'//给宽度加px
|
||||
this.boxStyle.height = this.windowHeight - this.deleteHeight;//有 tabbar的 修改这里可以改变视频高度
|
||||
this.get() //刚进入页面加载数据
|
||||
// #ifndef MP
|
||||
this.rotateX();
|
||||
// #endif
|
||||
|
||||
},
|
||||
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){
|
||||
this.dataList[this.k].state = 'play';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).play()
|
||||
audo.play()
|
||||
this.dataList[this.k].state = 'pause';
|
||||
uni.createVideoContext(this.dataList[this.k].id+''+this.k,this).pause()
|
||||
audo.pause()
|
||||
|
||||
// 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('到后台');
|
||||
},
|
||||
|
||||
|
@ -579,56 +569,24 @@
|
|||
*/
|
||||
},
|
||||
//点击播放&&暂停
|
||||
//点击播放&&暂停
|
||||
tapVideoHover(state,event){
|
||||
// this.dataList[this.k].isShowimage = false
|
||||
// this.dataList[this.k].isShowProgressBarTime = false
|
||||
this.ProgressBarOpacity = 0.5
|
||||
this.dotWidth = 0
|
||||
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(()=>{
|
||||
this.rotateX();
|
||||
},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();
|
||||
}
|
||||
}
|
||||
if(this.touchNum >= 2){
|
||||
this.doubleLike();
|
||||
}
|
||||
this.touchNum = 0;
|
||||
},200)
|
||||
// --------------- ending
|
||||
// 2. 不启用双击点赞 start
|
||||
// if(state=='play'||state=='continue'){
|
||||
// this.dataList[this.k].state = 'pause';
|
||||
// }else{
|
||||
// this.dataList[this.k].state = 'continue';
|
||||
// }
|
||||
// if(this.dataList[this.k].state == 'continue'){
|
||||
// uni.createVideoContext(this.dataList[this.k].id,this).play();//暂停以后继续播放
|
||||
// }
|
||||
// if(this.dataList[this.k].state == 'pause'){
|
||||
// uni.createVideoContext(this.dataList[this.k].id,this).pause();//暂停以后继续播放
|
||||
// }
|
||||
// --------------- ending
|
||||
console.log('state--',state);
|
||||
if(state=='play'||state=='continue'){
|
||||
this.dataList[this.k].state = 'pause';
|
||||
}else{
|
||||
this.dataList[this.k].state = 'continue';
|
||||
}
|
||||
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();//暂停以后继续播放
|
||||
audo.play()
|
||||
}
|
||||
if(this.dataList[this.k].state == 'pause'){
|
||||
uni.createVideoContext(this.dataList[this.k]._id+''+this.k,this).pause();//暂停以后继续播放
|
||||
audo.pause()
|
||||
}
|
||||
},
|
||||
//点击播放&&暂停
|
||||
tapVideoHovers(state,event){
|
||||
|
@ -715,21 +673,19 @@
|
|||
src:item.filePath
|
||||
};
|
||||
});
|
||||
console.log("this.dataList",this.dataList)
|
||||
// 3.播放当前视频
|
||||
setTimeout(()=>{
|
||||
this.isShow = true;
|
||||
this.dataList[this.k].isplay = false
|
||||
this.dataList[this.k].isplay = true
|
||||
this.dataList[this.k].playIng = true
|
||||
setTimeout(()=>{
|
||||
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()
|
||||
|
||||
},500)
|
||||
},200)
|
||||
console.log("this.dataList",this.dataList)
|
||||
this.videoID = this.dataList[this.k].id
|
||||
} else {
|
||||
uni.showToast({
|
||||
|
@ -738,35 +694,6 @@
|
|||
})
|
||||
}
|
||||
});
|
||||
// uni.request({
|
||||
// url: 'https://bdb24c6d-8c19-4f80-8e7e-c9c9f037f131.bspapp.com/video',
|
||||
// method: 'POST',
|
||||
// data:{
|
||||
// info: 'get_video'
|
||||
// },
|
||||
// success: (res) => {
|
||||
// this.isShow = false;
|
||||
// var msg = res.data.data
|
||||
// // 2.这里把视频添加到视频列表
|
||||
// for (let i = 0; i < msg.length; i++) {
|
||||
// this.dataList.push(msg[i])
|
||||
// }
|
||||
// // 3.播放当前视频
|
||||
// setTimeout(()=>{
|
||||
// this.isShow = true;
|
||||
// this.dataList[this.k].isplay = true
|
||||
// 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 = 'pause';
|
||||
// audo.src = this.dataList[this.k].src;
|
||||
|
||||
// },500)
|
||||
// },200)
|
||||
// this.videoID = this.dataList[this.k].id
|
||||
// }
|
||||
// })
|
||||
},
|
||||
share(){
|
||||
uni.showToast({
|
||||
|
|
Loading…
Reference in New Issue