<video ref="hervideo" id="hervideo" title="测试视频" src="vUrl" loop="true" autoplay="true" controls="false" @ended="videoEnded1"
/>
</view>
</template>
<script>
export default {
data() {
return {
list: [{
"createDate": "2024-06-06 13:59:58",
"creator": "1788175532230811649",
"id": "f46fd1696724b8f589772507203722e1",
"url": "/static/video/20240611151728.mp4"
},
{
"createDate": "2024-06-06 13:59:56",
"creator": "1788175532230811649",
"id": "dcf456128ba60a4984ebcbeea1d028ad",
"url": "/static/video/20240611151744.mp4"
},
{
"createDate": "2024-06-06 13:59:56",
"creator": "1788175532230811649",
"id": "dcf456128ba60a4984ebcb7891d028ad",
"url": "/static/video/20240611152317.mp4"
}
],
index:1,
index1:0,
vUrl:null,
sUrl:null
}
},
onLoad() {
this.vUrl = this.list[this.index1].url
this.sUrl = this.list[this.index].url
},
methods: {
videoEnded(){
console.log('视频1播放结束=============')
if(this.index==1){
this.index=2
} else {
this.index=1
}
this.sUrl = this.list[this.index].url
},
videoEnded1(){
console.log('视频2播放结束=============')
if(this.index1==0){
this.index1 = 1
} else {
this.index1 = 0
}
this.vUrl = this.list[this.index1].url
}
}
}
</script>
<style scoped>
</style>
福宝的宝宝 (作者)
单个视频是没问题的,两个视频同时播总会有一个不会触发
2024-06-12 14:32