<template>
<uni-popup ref="popup" background-color="#fff">
<button @click="operate">播放</button>
<video id="myVideo" ref="ddd" :src="url" enable-danmu danmu-btn controls @play="play" @timeupdate="timeupdate"
@pause="pause"></video>
</uni-popup>
</template>
<script>
export default {
data() {
return {
url: '',
videoContext: '',
isPlay: false
}
},
onReady() {
},
methods: {
open(params) {
this.videoContext = uni.createVideoContext('myVideo')
this.$refs.popup.open()
this.url = params.url
},
operate() {
if (this.isPlay) {
this.videoContext.pause()
} else {
this.videoContext.play()
}
},
play() {
this.isPlay = true
},
paruse() {
this.isPlay = false
}
}
}
</script>
<style lang="scss" scoped>
video {
width: 100vw;
}
</style>
1***@163.com
- 发布:2024-03-04 22:50
- 更新:2024-03-05 08:44
- 阅读:449
1***@163.com (作者)
微信小程序
2024-03-05 14:49