nuxt视频如何使用video标签?
参数什么的根据自己的需求调整
<template><!-- <IndexVideo /> --><div class="video-player"><video ref="videoPlayer" :src='srcurl' muted loop autoplay></video></div>
</template>
<script>
export default {data(){return{srcurl:''}},mounted() {this.srcurl = 'http://vjs.zencdn.net/v/oceans.mp4';this.videoPlayer = this.$refs.videoPlayer;this.videoPlayer.addEventListener('ended', this.handleVideoEnded);},beforeDestroy() {// Clean up event listener when the component is about to be destroyedthis.videoPlayer.removeEventListener('ended', this.handleVideoEnded);},methods:{handleVideoEnded() {// When the video ends, rewind to the beginning and play againthis.videoPlayer.currentTime = 0;this.videoPlayer.play();},}
}
</script>
<style scoped lang="scss"></style>
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
