| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 | 
							- <template name="dever-video">
 
- 	<view>
 
- 		<view class="player">
 
- 			<video
 
- 				:src="src"
 
- 				preload
 
- 				autoplay
 
- 				:muted="muted"
 
- 				:show-play-btn="true"
 
- 				:show-center-play-btn="false"
 
- 				:controls="control"
 
- 				:loop="true"
 
- 				:id="id()"
 
- 				:objectFit="objectFit"
 
- 				:enable-progress-gesture="false"
 
- 				play-btn-position="center"
 
- 				class="video"
 
- 				:playsinline="true"
 
- 				:webkit-playsinline="true"
 
- 				x-webkit-airplay="allow"
 
- 				x5-video-player-type="h5-page"
 
- 				:page-gesture="false"
 
- 				>
 
- 			</video>
 
- 		</view>
 
- 		<view class="control" @click="open">
 
- 			<cover-image v-if="poster && pic" class="poster" :src="pic">
 
- 			</cover-image>
 
- 			
 
- 			<cover-image
 
- 			class="ico-video-play" v-if="!playButton"></cover-image>
 
- 			
 
- 			<position :item="position_item" :down="src" :button="position_save" v-if="position_item"></position>
 
- 			
 
- 			<cover-view class="cover-view-right" v-if="showInfo">
 
- 				<cover-image :src="pic"
 
- 				 class="avater img" 
 
- 				 @click.stop="tapAvater"></cover-image>
 
- 				
 
- 				<text class="right-follow">+</text>
 
- 				<cover-image 
 
- 				style="position:relative;top:-20upx;"
 
- 				:src="up ? '../../static/video/axc.png' : '../../static/video/bed.png'" 
 
- 				class="img-left" @click.stop="tapLove"></cover-image>
 
- 				
 
- 				<text class="right-text">1</text>
 
- 				<cover-image src="@/static/video/ay2.png" 
 
- 				style="height: 80upx;" class="img-left" @click.stop="tapMsg"></cover-image>
 
- 				
 
- 				<text class="right-text">10</text>
 
- 				<cover-image src="@/static/video/b6p.png" 
 
- 				style="height: 76upx;" class="img-left" @click.stop="tapShare"></cover-image>
 
- 				
 
- 				<text class="right-text">10</text>
 
- 				<cover-image src="@/static/video/changpian.png" class="musicIcon img">
 
- 				</cover-image>
 
- 			
 
- 			</cover-view>
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- import position from "@/lib/dever/components/position.vue";
 
- export default {
 
- 	name: "dever-video",
 
- 	props: {
 
- 		src : {
 
- 			type    : String,
 
- 			value	: null
 
- 		},
 
- 		index : {
 
- 			type    : Number,
 
- 			value	: null
 
- 		},
 
- 		vid : {
 
- 			type    : String,
 
- 			value	: null
 
- 		},
 
- 		pic : {
 
- 			type    : String,
 
- 			value	: null
 
- 		},
 
- 		auto : {
 
- 			type    : Boolean,
 
- 			value	: false
 
- 		},
 
- 		control : {
 
- 			type    : Boolean,
 
- 			value	: false
 
- 		},
 
- 		position_item : {
 
- 			type    : Array,
 
- 			value	: null
 
- 		},
 
- 		position_save : {
 
- 			type    : String,
 
- 			value	: null
 
- 		},
 
- 		type : {
 
- 			type    : String,
 
- 			value	: 1
 
- 		},
 
- 	},
 
- 	data() {
 
- 		return {
 
- 			objectFit : 'fill',
 
- 			play : false,
 
- 			playButton : false,
 
- 			muted : true,
 
- 			poster : true,
 
- 			video : false,
 
- 			showInfo : false,
 
- 		};
 
- 	},
 
- 	mounted() {
 
- 		if (this.type == 2) {
 
- 			this.objectFit = '';
 
- 		}
 
- 		this.video = uni.createVideoContext(this.id(), this);
 
- 		if (this.auto) {
 
- 			this.start();
 
- 		}
 
- 	},
 
- 	methods:{
 
- 		//获取video_id
 
- 		id : function()  {
 
- 			return 'video_' + this.vid + '_' + this.index;
 
- 		},
 
- 		start : function()  {
 
- 			this.$emit('update:load', true);
 
- 			this.poster = false;
 
- 			this.video.play();
 
- 			this.play = true;
 
- 			this.playButton = true;
 
- 			this.muted = false;
 
- 		},
 
- 		stop : function(state) {
 
- 			var self = this;
 
- 			//this.poster = true;
 
- 			if (state) {
 
- 				if (this.play) {
 
- 					self.video.pause();
 
- 				}
 
- 				this.playButton = false;
 
- 			} else {
 
- 				/*
 
- 				setTimeout(function() {
 
- 					self.video.pause();
 
- 				}, 1000);
 
- 				*/
 
- 			}
 
- 			this.muted = true;
 
- 			this.play = false;
 
- 		},
 
- 		open : function()  {
 
- 			if (!this.play) {
 
- 				this.start();
 
- 			} else {
 
- 				this.stop(true);
 
- 			}
 
- 		},
 
- 		tapMsg : function(e)  {
 
- 			console.log(5, e);
 
- 		},
 
- 		tapShare : function(e) {
 
- 			console.log(6, e);
 
- 		},
 
- 		tapLove : function(e)  {
 
- 			// item.is_dianzan
 
- 			this.item[this.current_index].is_dianzan = !this.item[this.current_index].is_dianzan;
 
- 			console.log(7, e);
 
- 		}
 
- 	},
 
- 	components:{
 
- 		position
 
- 	}
 
- }
 
- </script>
 
- <style scoped>
 
- .control {
 
- 	width: 100%;
 
- 	height: 100%;
 
- 	z-index: 2;
 
- 	background: transparent;
 
- 	position: absolute;
 
- 	left: 0;
 
- 	top: 0;
 
- 	overflow: hidden;
 
- }
 
- .player {
 
- 	width: 100%;
 
- 	height: 100%;
 
- 	overflow: hidden;
 
- 	z-index: 1;
 
- 	background: transparent;
 
- 	position: absolute;
 
- 	left: 0;
 
- 	top: 0;
 
- 	overflow: hidden;
 
- }
 
- .video {
 
- 	/*
 
- 	width: 101%;
 
- 	height: 101%;
 
- 	margin-left: -5rpx;
 
- 	margin-top: -5rpx;
 
- 	*/
 
- 	width:100%;
 
- 	height:100%;
 
- 	position: relative;
 
- 	background-color: transparent;
 
- 	z-index: 1;
 
- }
 
- .poster{
 
- 	background-size: cover;
 
- 	position: absolute;
 
- 	left: 0;
 
- 	top: 0;
 
- 	width: 100%;
 
- 	height: 100%;
 
- }
 
- .ico-video-play{
 
-   background: url(@/static/icon/ico-video-play.png) no-repeat;
 
-   background-size: cover;
 
-   width: 100rpx;
 
-   height: 100rpx;
 
-   position: absolute;
 
-   left: 50%;
 
-   top: 50%;
 
-   transform: translate3d(-50%,-50%,0);
 
- }
 
- .cover-view-left {
 
- 	position: absolute;
 
- 	margin-left: 20upx;
 
- 	width: 580upx;
 
- 	bottom: 110upx;
 
- 	z-index: 9999;
 
- 	font-size: 14px;
 
- 	color: #ffffff;
 
- }
 
- .left-text {
 
- 	font-size: 14px;
 
- 	color: #ffffff;
 
- }
 
- .cover-view-right {
 
- 	position: absolute;
 
- 	bottom: 40px;
 
- 	right: 30upx;
 
- 	z-index: 9999;
 
- 	text-align: center;
 
- }
 
- .avater {
 
- 	border-radius: 50%;
 
- 	border-width: 2px;
 
- 	border-style: solid;
 
- 	border-color: #ffffff;
 
- }
 
- .img {
 
- 	height: 90upx;
 
- 	width: 90upx;
 
- 	margin-bottom: 110upx;
 
- }
 
- .img-left {
 
- 	width: 80upx;
 
- 	height: 66upx;
 
- 	padding-left: 4px;
 
- }
 
- .right-follow {
 
- 	position: absolute;
 
- 	z-index: 100;
 
- 	top: 75upx;
 
- 	left: 28upx;
 
- 	color: #ffffff;
 
- 	font-size: 16px;
 
- 	width: 34upx;
 
- 	height: 34upx;
 
- 	background-color: #f12f5b;
 
- 	text-align: center;
 
- 	line-height: 34upx;
 
- 	border-radius: 17upx;
 
- }
 
- .right-text {
 
- 	color: #ffffff;
 
- 	font-size: 11px;
 
- 	text-align: center;
 
- 	margin-bottom: 40upx;
 
- }
 
- .musicIcon {
 
- 	margin-top: 40upx;
 
- }
 
- @keyframes rotating {
 
- 	from {
 
- 		transform: rotate(0);
 
- 	}
 
- 	to {
 
- 		transform: rotate(360deg);
 
- 	}
 
- }
 
- .view-left-text-content {
 
- 	flex: 1;
 
- }
 
- .view-left-text {
 
- 	color: #ffffff;
 
- 	font-size: 18px;
 
- 	margin-bottom: 10upx;
 
- 	font-weight: bold;
 
- }
 
- .text-content-text {
 
- 	color: #ffffff;
 
- 	font-size: 16px;
 
- 	line-height: 50upx;
 
- 	height: 100upx;
 
- 	overflow: hidden;
 
- }
 
- </style>
 
 
  |