uniapp轮播图 加入video,video滚动到图片的时候,视频停止播放

下面是我用的插件地址,感觉还不错的
https://ext.dcloud.net.cn/plugin?id=284

<uni-swiper-dot :info="info" :current="current" :mode="mode" :dots-styles="dotsStyles" field="content" class="swiper">
		<swiper class="swiper-box" @change="change">
		    <!-- 这里是video代码,至于里面的属性的话根据你们的需求去添加  poster是视频封面图片 src就是视频地址了 -->
			<view class="page">
				<video class="video"  id="myVideo"  poster="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa2.att.hudong.com%2F27%2F81%2F01200000194677136358818023076.jpg&refer=http%3A%2F%2Fa2.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1612149661&t=705c026e67f6aa1efe4ba4b64f546db7"
					 style="width: 100%;" id="demoVideo" :controls="true" :enable-progress-gesture="false" :show-center-play-btn="true"
					 src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400">
				</video>
			</view>
			<!-- 到这里结束 -->
			<!-- 下面这部分是图片轮播展示 -->
			<swiper-item v-for="(item, index) in info" :key="index">
				<view :class="item.colorClass" class="swiper-item">
					<image class="image" :src="item.thumbnail_url" mode="aspectFill" />
				</view>
			</swiper-item>
		</swiper>
</uni-swiper-dot>
onReady() {
	this.videoplay = uni.createVideoContext('myVideo')
},
//轮播   组件的change事件加入这行代码即可
change(e) {
	this.videoplay.pause()
},

如果类似问题走不通,请留言

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值