Browse Source

ios video

ck@123911.net 6 days ago
parent
commit
74da84debc
1 changed files with 16 additions and 0 deletions
  1. 16 0
      uni_modules/uv-swiper/components/uv-swiper/uv-swiper.vue

+ 16 - 0
uni_modules/uv-swiper/components/uv-swiper/uv-swiper.vue

@@ -67,7 +67,15 @@
 							height: $uv.addUnit(height)
 						}"
 						controls
+						playsinline
+						webkit-playsinline
+						:object-fit="'fill'"
+						:enable-play-gesture="true"
+						:show-play-btn="true"
+						:show-center-play-btn="true"
+						:muted="false"
 						@tap="clickHandler(index)"
+						@error="onVideoError"
 					></video>
 					<text
 						v-if="showTitle && $uv.test.object(item) && item.title"
@@ -202,6 +210,14 @@
 			// 点击某个item
 			clickHandler(index) {
 				this.$emit('click', index)
+			},
+			onVideoError(e) {
+				console.error('视频加载失败', e)
+				// 可以在这里添加错误处理逻辑,比如显示错误提示或fallback图片
+				this.$emit('video-error', {
+					index: this.currentIndex,
+					error: e
+				})
 			}
 		},
 	}