<template>
	<video id="myVideo" :src="videoSrc"
	@error="videoErrorCallback" :danmu-list="danmuList" :poster="posterSrc" controls></video>
</template>

<script>
	import { getGuildbookList } from '../api/index.js'
	export default({
		data() {
			return {
				pointId: '',
				posterSrc: '',
				videoSrc: ''
			}
		},
		methods: {
			getVideoInfo() {
				getGuildbookList(this.pointId).then(res => {
					if (res.code === 0) {
						let info = res.data.filter(item => {
							return item.bookSrc.includes('mp4')
						})
						this.posterSrc = this.$staticUrl + info[0].coverSrc
						this.videoSrc = this.$staticUrl + info[0].bookSrc
					}
				})
			},
		},

		onLoad(opt) {
			this.pointId = opt.id
			this.getVideoInfo()
		}
	})
</script>

<style lang="scss" scoped>
	#myVideo{
		height: 100vh;
		width: 100%;
	}
</style>