<template>
	<view class="fullHeight">
		<headers :showBack="true" :themeType="'#3A7BFF'">
			<view class="headerName">
				视频回放
			</view>
		</headers>
		<!-- <video class="videoBox" id="myVideo" :custom-cache="false" :src="url" controls autoplay></video> -->
		<!-- 外网IP地址访问视频监控 -->
		<!-- <video class="videoBox" id="myVideo" :custom-cache="false" :src="'rtsp://42.180.188.17:'+url.substring(20)" controls autoplay></video> -->
		<video class="videoBox" id="myVideo" :custom-cache="false" :src="url" controls autoplay></video>
		<view class="videoName">
			<text>{{passData.videoName}}</text>
			<text>{{passData.beginTime}}<br />至<br />{{passData.endTime}}</text>
			
		</view>
	</view>
</template>

<script>
	import headers from '../../components/headers/headers.vue'
	export default {
		components:{headers},
		data() {
			return {
				url:'',//rtsp://admin:jxj12345@192.168.0.64:554/h264/ch1/main/av_stream
				streamType: 1, //1是子码流    2是主码流
				passData: {}
			};
		},
		onLoad(options) {
			//videoType    1萤石云，2乐橙，3ISC，4大华，5宇视，6国标
			// this.url = options.url
			if(options.obj){
				this.passData = JSON.parse(options.obj)
			}
			console.log(this.passData,777888)
			this.loadData()
		},
		methods:{
			//获取项目视频
			loadData() {
				var that = this
				let requestData = {
					projectSn: that.passData.projectSn,
					serialNumber: that.passData.serialNumber
				}
				if(that.passData.beginTime && that.passData.endTime){
					requestData.beginTime = that.passData.beginTime
					requestData.endTime = that.passData.endTime
				}
				that.sendRequest({
					url: "xmgl/videoItem/callPostPlaybackURLsV2",
					data: requestData,
					method: "POST",
					success(res) {
						console.log('找封面', res)
						that.url = res.result.url
						if(that.url.indexOf("10.168.1.100") != -1){
							that.url = that.url.replace("10.168.1.100", "42.180.188.17")
							console.log(that.url,888999)
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.fullHeight{
	background-color: #F4F5FD;
}
.videoBox{
	width: 100%;
}
.videoName{
	margin: 10px 15px;
	position: relative;
	display: flex;
	flex-direction: column;
	font-size: 32rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 600;
	text:nth-child(1){
		color: #000000;
	}
	text:nth-child(2){
		color: #6F6F6F;
		margin-top: 12rpx;
	}
}
</style>
