Merge branch 'dev-yxl' of gitee.com:zongzhige/shopxo-uniapp into dev

master
gongfuxiang 2026-01-08 11:02:14 +08:00
commit 28e04112df
1 changed files with 19 additions and 2 deletions

View File

@ -339,9 +339,18 @@
//
attemptAutoPlay(videoElement, isMuted) {
const playPromise = videoElement.play();
uni.showToast({
title: '开始尝试播放' + playPromise,
icon: 'success',
mask: true
})
if (playPromise !== undefined) {
playPromise.then(() => {
uni.showToast({
title: '播放成功' + videoElement.muted,
icon: 'success',
mask: true
})
//
this.autoplayRejected = false;
//
@ -351,6 +360,11 @@
});
})
.catch((error) => {
uni.showToast({
title: '播放失败' + videoElement.muted,,
icon: 'error',
mask: true
})
//
this.autoplayRejected = true;
//
@ -636,7 +650,10 @@
this.videoEl.controls = controls
this.videoEl.muted = muted
this.videoEl.playbackRate = playbackRate
uni.showToast({
title: this.autoplayRejected && autoplay ? '自动播放失败,请手动播放' : '自动播放成功',
icon: 'none'
});
//
if (this.autoplayRejected && autoplay) {
this.attemptAutoPlay(this.videoEl, muted);