<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<video v-for="video in vList" :show-progress="true" :controls="true" :key="video.id"
:id="'videoPlayer' + video.id" :src="video.url" preload="auto" x5-video-player-fullscreen="true"
:custom-cache="false" object-fit="cover" x5-video-player-type="h5" :show-center-play-btn="false"
v-show="video.id === currentVideoId" :muted="video.muted" @ended="onEnded(video.id)"
@error="onVideoError(video.id, $event)"></video>
<view class="play-video-box">
<view class="play-video-item" @click="handlePlayVideo">
<button type="primary">播放视频</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
currentVideoId: 0,
vList: [{
id: 0,
url: 'https://www.w3school.com.cn/example/html5/mov_bbb.mp4',
muted: false
}, {
id: 1,
url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
muted: false
}],
}
},
methods: {
handlePlayVideo() {
this.playVideoById(0)
},
onEnded(videoId) {
this.playVideoById(1)
},
playVideoById(videoId) {
this.pauseAllVideos();
const videoIndex = this.vList.findIndex(video => video.id === videoId);
if (videoIndex !== -1) {
this.currentVideoId = videoId;
this.$nextTick(() => {
const videoPlayer = uni.createVideoContext('videoPlayer' + videoId, this);
videoPlayer.play();
});
}
},
pauseAllVideos() {
this.vList.forEach(video => {
const videoPlayer = uni.createVideoContext('videoPlayer' + video.id, this);
videoPlayer.pause();
});
},
}
}
</script> - 发布:2025-11-06 12:28
- 更新:2025-11-06 15:12
- 阅读:53
产品分类: uniapp/H5
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 10
HBuilderX类型: 正式
HBuilderX版本号: 4.76
浏览器平台: 微信内置浏览器
浏览器版本: 微信内置浏览器版本
项目创建方式: HBuilderX
App下载地址或H5⽹址: https://static-mp-d82591b7-3eb7-4495-93a5-65679e28ea19.next.bspapp.com/#/
示例代码:
操作步骤:
微信内置浏览器打开100%复现
只有 android 系统有问题,iOS一切正常(微信内置浏览器也是正常)
微信内置浏览器打开100%复现
只有 android 系统有问题,iOS一切正常(微信内置浏览器也是正常)
预期结果:
微信内置浏览器一切正常
微信内置浏览器一切正常
实际结果:
微信内置浏览器打开无法播放视频
微信内置浏览器打开无法播放视频
bug描述:
微信内置浏览器无法自动播放下一个视频,详细请看代码
在PC浏览器和手机默认浏览器一切都是正常。
附件有2个视频,1个是微信内置浏览器有BUG无法播放,1个是手机浏览器一切正常可以播放
只有 android 系统有问题,iOS一切正常(微信内置浏览器也是正常)

