Commit 9b68c936 authored by 郭志伟's avatar 郭志伟

"fix: 首次第二屏视频不播放问题;切换视频后从新开始播放"

parent 37c46f1e
...@@ -77,7 +77,8 @@ ...@@ -77,7 +77,8 @@
_videoContexts: [], _videoContexts: [],
videoPause: false, videoPause: false,
showPopup: false, showPopup: false,
videoLoading: true videoLoading: true,
isFirstRole: true
}, },
watch: { watch: {
videoList (list) { videoList (list) {
...@@ -144,7 +145,12 @@ ...@@ -144,7 +145,12 @@
// 一次最多只展示3个video标签,提高加载视频的速度 // 一次最多只展示3个video标签,提高加载视频的速度
const current = e.$wx.detail.current; const current = e.$wx.detail.current;
const diff = current - _last; const diff = current - _last;
if(this.isFirstRole && current === 1) {
this.playCurrent(1);
this.isFirstRole = false;
}
if (diff === 0) return; if (diff === 0) return;
this.isFirstRole = false;
this._last = current; this._last = current;
this.playCurrent(current); this.playCurrent(current);
// 如果上滑的时候,当前滑动到第0元素,那么被划走,放入prevQueue是第一个元素,这个要自己画图才会更理解 // 如果上滑的时候,当前滑动到第0元素,那么被划走,放入prevQueue是第一个元素,这个要自己画图才会更理解
...@@ -204,6 +210,7 @@ ...@@ -204,6 +210,7 @@
ctx.play(); ctx.play();
} else { } else {
ctx.pause(); ctx.pause();
ctx.seek(0);
} }
} }
}); });
......
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