<template name="vodShort">
	<view>
		<swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeVod" circular="true">
			<swiper-item v-for="(v, k) in item" :key="k">
				<dever-video
				:src="v.video" 
				:pic="v.pic" 
				:index="k" 
				:vid="v.id"
				:type="v.type"
				:disabled="false"
				:position_item="v.text"
				:position_save="v.is_button"
				:load.sync="load"
				ref="video"
				>
				</dever-video>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
import deverVideo from '@/lib/dever/components/video.nvue';
var play = true;
export default {
	name: "vodShort",
	props: {
		control : {
			type : Object,
			value : null
		},
		item : {
			type    : Array,
			value	: null
		},
		index : 0
	},
	data() {
		return {
			load : false,
			current_index: 0,
		};
	},
	created() {
		
	},
	mounted() {
		this.control[this.index] = this;
		for(var i in this.$refs.video) {
			this.$refs.video[i].autoStart();
		}
	},
	methods:{
		start : function() {
			if (this.Dever.source == 'h5' && uni.getSystemInfoSync().platform == 'ios') {
				return;
			}
			for(var i in this.$refs.video) {
				if (this.current_index == i) {
					this.$refs.video[this.current_index].start();
				}
			}
		},
		stop : function() {
			this.$refs.video[this.current_index].stop(true);
		},
		changeVod : function(e)  {
			var self = this;
			self.$nextTick(()=>{
				this.$refs.video[this.current_index].stop(false);
				this.current_index = e.detail.current;
				self.start();
			});
					
		},
	},

	components:{
		deverVideo
	}
}
</script>

<style>
.swiper{
	width: 100vw;
	height: 100vh;	
	/*position: fixed;*/
	position: relative;
	top: 0;
	left: 0;
}

</style>
