Commit 5d7865eb authored by 郭志伟's avatar 郭志伟

"fix: 问题修复

1、视频切换闪一下;2、swiper不从第一个开始;3、circular改变导致swiper刷
新问题预解决"
parent 1140bf69
This diff is collapsed.
......@@ -5,31 +5,31 @@
duration="500"
circular="{{circular}}"
vertical
current="1"
current="0"
bindchange="moveSwiper">
<swiper-item wx:for="{{curQueue}}" wx:key="index">
<view class="video-swiper">
<video
class="video-item"
:class="{ show: item.showType && item.showType.value == 2 }"
id="video_{{index}}"
loop
enable-progress-gesture="{{false}}"
show-center-play-btn="{{false}}"
controls="{{false}}"
src="{{currentIndex == index ?item.videoUrl :null}}"
src="{{item.videoUrl}}"
data-id="{{item.id}}"
object-fit="contain"
data-index="{{index}}"
@tap="videoTap"
custom-cache="{{false}}"
wx:if="{{item.showType && item.showType.value ==2}}"
bindplay="loadMedia"
bindloadedmetadata="loadMedia"
>
<video-pause :pause="videoPause"></video-pause>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
</video>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!-- <video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/> -->
<van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{item.photoUrl || item.videoSnapUrl}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
<van-loading slot="loading" type="spinner" size="20" vertical/>
</van-image>
......@@ -72,7 +72,7 @@
prevQueue: [],
curQueue: [],
circular: false,
_last: 1,
_last: -1,
_invalidUp: 0,
_invalidDown: 0,
_videoContexts: [],
......@@ -214,25 +214,24 @@
circular = false;
}
this.curQueue = [...curQueue];
this.circular = circular;
setTimeout(() => {
this.circular = circular;
}, 600);
},
playCurrent (current) {
this.$nextTick(() => {
if (playTimer) clearTimeout(500);
playTimer = setTimeout(() => {
this.curQueue[current] && this.getProgress(this.curQueue[current].id);
// 滑动到当前元素时,其他video都暂停,只播放当前video
this._videoContexts.forEach(function (ctx, index) {
if (ctx) {
if (index !== current) {
ctx.pause();
} else {
ctx.play();
}
this.curQueue[current] && this.getProgress(this.curQueue[current].id);
// 滑动到当前元素时,其他video都暂停,只播放当前video
this._videoContexts.forEach(function (ctx, index) {
if (ctx) {
if (index !== current) {
ctx.pause();
} else {
ctx.play();
}
});
this.updateAwardsInfo(current);
}, 500);
}
});
this.updateAwardsInfo(current);
});
},
videoTap(e) {
......@@ -307,6 +306,10 @@
position: absolute;
background-color: #000;
z-index: 1;
display: none;
&.show {
display: block;
}
}
.video-loading {
position: absolute;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment