Ver código fonte

bug fix: 让过渡视频一直播放完毕后自动展示长图时,因为没有开启store里的canPlayLongImageBgAudio,导致小人说话没有声音。

任一存 2 anos atrás
pai
commit
43845cba6a
1 arquivos alterados com 25 adições e 20 exclusões
  1. 25 20
      src/views/LongImage.vue

+ 25 - 20
src/views/LongImage.vue

@@ -72,7 +72,7 @@
             webkit-playsinline="true"
             :src="`${config.cdnDir}videos/video2.mp4`"
             @playing="isNeedToBofang = false"
-            @ended="isLongImageVideo = false"
+            @ended="onFadeInVideoEnd"
             @mousedown.passive.stop
             @touchstart.passive.stop
             @canplaythrough="onVideoCanPlayThrough"
@@ -134,7 +134,6 @@ const mouseImg = utils.getImageUrl(`mouse.png`)
 const comfirImg = utils.getImageUrl(`btn_concern.png`)
 const skipImg = utils.getImageUrl(`skip.png`)
 const bofangImg = utils.getImageUrl(`bofang.png`)
-const videoPostImg = utils.getImageUrl(`videobg.jpg`)
 
 const longref$ = ref(null)
 const video$ = ref(null)
@@ -155,11 +154,34 @@ function switchBgAudio() {
   }
 }
 
+// 过渡视频相关
+const videoPostImg = utils.getImageUrl(`videobg.jpg`)
+const isLongImageVideo = ref(true)
+const isNeedToBofang = ref(true)
+const isShowSkip = ref(false)
+const onVideoCanPlayThrough = () => {
+  if (video$.value) {
+    video$.value.play()
+    isNeedToBofang.value = false
+  }
+}
+const onSkipClick = () => {
+  isShowGuide.value = true
+  setTimeout(() => {
+    isLongImageVideo.value = false
+  }, 100);
+}
+function onFadeInVideoEnd() {
+  isShowGuide.value = true
+  setTimeout(() => {
+    isLongImageVideo.value = false
+  }, 100);
+}
+
 // 动画帧相关
 const lastAnimationTimeStamp = ref(0);
 const animationFrameId = ref(0);
 
-
 // 镜头平移相关
 const translateLength = ref(0);
 
@@ -172,23 +194,6 @@ const itemW = computed(() => globalProperties.$isMobile || window.innerWidth < 1
 
 const isShowDir = ref(false)
 const isShowGuide = ref(false)
-const isLongImageVideo = ref(true)
-const isNeedToBofang = ref(true)
-const isShowSkip = ref(false)
-
-const onVideoCanPlayThrough = () => {
-  if (video$.value) {
-    video$.value.play()
-    isNeedToBofang.value = false
-  }
-}
-
-const onSkipClick = () => {
-  isShowGuide.value = true
-  setTimeout(() => {
-    isLongImageVideo.value = false
-  }, 100);
-}
 
 let firstIn = true
 const onCloseGuide = () => {