视频轮播,播放完之后循环播放为什么不生效哇?每次最后一个播放完就停住了,插件用的swiper,求解
<div id="screen_saver" class="screen_saver">
<div class="swiper-container" id="slides">
<div id="swiper-wrapper" class="swiper-wrapper">
</div>
</div>
</div>
```javascript
strList = [
{ id: 1, src: 'https://www.ziguizhifu.com:10377/zipTest/Demo/20220701115406.mp4' },
{ id: 2, src: 'https://www.ziguizhifu.com:10377/zipTest/Demo/20220701115406.mp4' },
{ id: 3, src: 'https://www.ziguizhifu.com:10377/zipTest/Demo/20220701115406.mp4' },
{ id: 4, src: 'https://www.ziguizhifu.com:10377/zipTest/Demo/20220701115406.mp4' },
];
strList.forEach(function (obj) {
MaterialHtml += "";
})
$("#swiper-wrapper").html(MaterialHtml)
SwiperVideo();
function SwiperVideo() {
var swiper = new Swiper('#slides', {
centeredSlides: true,
autoplay: true,
on: {
slideChangeTransitionEnd: function () {
if ($("#slides .swiper-slide-active video").length > 0) {
var _this = this;
_this.autoplay.stop();
var videoID = $("#slides .swiper-slide-duplice-active video").attr("id");
var videoObj = document.getElementById(videoID);
}
}
},
loop: true,
loopAdditionalSlides: 2,
});
if ($("#slides .swiper-slide-active video").length > 0) {
swiper.autoplay.stop();
var videoID = $("#slides .swiper-slide-active video").attr("id");
var videoObj = document.getElementById(videoID);
videoObj.play();
videoObj.addEventListener(
"ended",
function () {
swiper.slideNext();
swiper.autoplay.start();
},
false
);
}
}
```