提交 b245a574 作者: 翁进城

fix: 飞控中心修正不支持srs播放, 修正清流信息不显示

上级 325f9725
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
:dblclick-fullscreen="false" :dblclick-fullscreen="false"
aspect="fulllscreen" aspect="fulllscreen"
:class="{ :class="{
small: !videoFlag, small: !smallFPV,
'livenvr-player': videoFlag, 'livenvr-player': smallFPV,
vUrl: isStatus && !videoFlag, vUrl: isStatus && !smallFPV,
vUrlDeffault: !isStatus && !videoFlag, vUrlDeffault: !isStatus && !smallFPV,
}" }"
ref="livePlayer" ref="livePlayer"
:videoUrl="data.vUrl" :videoUrl="data.vUrl"
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
:class="{ :class="{
vUrl: isStatus, vUrl: isStatus,
vUrlDeffault: !isStatus, vUrlDeffault: !isStatus,
small: videoFlag, small: smallFPV,
'livenvr-player': !videoFlag, 'livenvr-player': !smallFPV,
}" }"
ref="fpvPlayer" ref="fpvPlayer"
:controls="false" :controls="false"
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
}, },
className: String, className: String,
videoFlag: { smallFPV: {
type: Boolean, type: Boolean,
default: () => true, default: () => true,
}, },
......
...@@ -144,24 +144,6 @@ export default { ...@@ -144,24 +144,6 @@ export default {
this.classNames = this.className; this.classNames = this.className;
if (this.data.type) { if (this.data.type) {
} }
//鹰巢视频大小判断
console.log(
this.$store.state.mapmanage.mapisStatus,
"this.$store.state.mapmanage.mapisStatus"
);
if (
this.$store.state.mapmanage.mapisStatus.flag &&
this.$store.state.mapmanage.mapisStatus.type == "yc" &&
this.$store.state.mapmanage.mapisStatus.num == 0
) {
this.classNames = this.className + " ycqingliumap";
}
if (
this.$store.state.mapmanage.mapisStatus.flag &&
this.$store.state.mapmanage.mapisStatus.type == "wrj"
) {
this.classNames = this.className + " qingliumap";
}
this.getFontSize(); this.getFontSize();
if (this.device.customName) { if (this.device.customName) {
......
<template> <template>
<div class="cpt-player-webrtc"> <div class="cpt-player-webrtc">
<video id="rtc_media_player" <video id="rtc_media_player" ref="webrtc" controls autoplay></video>
ref="webrtc"
controls
autoplay></video>
<!-- <div class="cutImg" id="cutImage">
<span class="closeImg">X</span>
</div> -->
</div> </div>
</template> </template>
<script> <script>
let sdk = null; import $ from "./jquery-1.10.2.min";
// import Qs from "qs"; import {
SrsRtcPublisherAsync,
SrsRtcPlayerAsync,
SrsRtcFormatSenders,
} from "./srs.sdk";
window.$ = $;
export default { export default {
props: { props: {
...@@ -21,144 +21,74 @@ export default { ...@@ -21,144 +21,74 @@ export default {
default: () => ({}), default: () => ({}),
}, },
}, },
data () { data() {
return { return {
curr_data: { sdk: null,
vUrl: null
},
flight_info: null,
}; };
}, },
mounted () { watch: {
this.curr_data = {} data: {
let self = this; handler(value) {
self.$bus.$on("takePhotos", (flight_info) => { this.$nextTick(() => {
self.flight_info = flight_info(); this.init();
self.screenShot(self.flight_info); });
}); },
deep: true,
immediate: true,
},
},
beforeDestroy() {
this.sdk.close();
}, },
methods: { methods: {
init () { pause() {
if (this.$refs["webrtc"]) { if (this.$refs["webrtc"]) {
if(!this.data?.vUrl){ this.$refs["webrtc"].pause();
return; }
} },
// if (sdk) { play() {
// sdk.close(); if (this.$refs["webrtc"]) {
// } this.$refs["webrtc"].play();
// sdk = new SrsRtcPlayerAsync(); }
// this.$refs["webrtc"].srcObject = sdk.stream; },
// sdk.play(curr_data.vUrl); init() {
let _this = this;
if (sdk) { if (this.$refs["webrtc"]) {
sdk.close(); if (this.sdk) {
this.sdk.close();
} }
sdk = new SrsRtcPlayerAsync(); this.sdk = new SrsRtcPlayerAsync();
// $('#rtc_media_player').prop('srcObject', sdk.stream); this.$refs["webrtc"].srcObject = this.sdk.stream;
// console.log("sdk...", sdk) this.sdk
this.$refs["webrtc"].srcObject = sdk.stream;
// curr_data.vUrl = "rtmp://121.43.58.140/live/";
// 'webrtc://srs.mmcuav.cn/live/xxxxxxxxxxxxxxx' // 测试地址,需使用推流工具推流
// console.log("curr_data.vUrl:", curr_data.vUrl);
let self = this
sdk
.play(this.data.vUrl) .play(this.data.vUrl)
.then(function (session) { .then(function (session) {})
console.log(session);
/* if (session) {
self.$bus.$emit("handleVideoState")
} */
})
.catch(function (reason) { .catch(function (reason) {
console.log('err reason', reason) console.log('srs err', reason)
sdk.close(); _this.sdk.close();
console.error(reason);
});
}
},
async screenShot (data) {
// console.log("screenShot:", data);
var player = document.getElementById("rtc_media_player"); //获取video的Dom节点
player.setAttribute("crossOrigin", "anonymous"); //添加srossOrigin属性,解决跨域问题
var canvas = document.createElement("canvas");
// var img = document.createElement("img");
canvas.width = player.clientWidth;
canvas.height = player.clientHeight;
canvas
.getContext("2d")
.drawImage(player, 0, 0, canvas.width, canvas.height); //截
// var dataURL = canvas.toDataURL("image/png"); //将图片转成base64格式
// img.src = dataURL;
// img.width = player.clientWidth; //控制截出来的图片宽的大小
// img.height = player.clientHeight; //控制截出来的图片高的大小
// img.style.border = "1px solid #333333"; //控制截出来的图片边框的样式
// document.getElementById("cutImage").appendChild(img); //显示在页面中
// console.log("img:", dataURL);
try {
canvas.toBlob((blob) => {
// 创建a元素来实现下载
// const a = document.createElement("a");
// a.style.display = "none";
// document.body.appendChild(a);
// a.href = window.URL.createObjectURL(blob);
// // 下载的文件名
// let fileName = "nt图片";
// a.download =
// fileName || `screenshot-${canvas.width}x${canvas.height}.png`;
// console.log("IMG-BLOD:", blob);
const myFile = new File([blob], "image.png", {
type: blob.type,
}); });
this.savaTaskImages(myFile, data.deviceId, data.id);
// a.click();
// // 触发下载后,移除元素
// a.remove();
});
} catch (e) {
console.log(e);
} }
// this.downFile(dataURL, "图片.jpg"); //下载截图
},
async savaTaskImages (images, deviceHardId, task_id) {
let forms = new FormData();
forms.append("task_id", task_id);
forms.append("deviceHardId", deviceHardId);
forms.append("images", images);
}, },
}, fullScreen() {
watch: { let video = this.$refs["webrtc"];
data: { if (video.webkitRequestFullScreen) {
handler (newVal, oldVal) { video.webkitRequestFullScreen();
let self = this } else if (video.requestFullscreen) {
if (newVal?.vUrl != oldVal?.vUrl) { video.requestFullscreen();
this.$nextTick(() => { } else if (video.mozRequestFullScreen)
console.log('self.init') setTimeout(() => {
self.init(); video.play();
}); }, 200);
}
},
deep: true,
immediate: true,
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
video::-webkit-media-controls-enclosure {
display: none;
}
.cpt-player-webrtc { .cpt-player-webrtc {
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: #000; background-color: #000;
&:hover {
video::-webkit-media-controls-enclosure {
display: inherit !important;
}
}
video { video {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -5,13 +5,8 @@ ...@@ -5,13 +5,8 @@
class="player" class="player"
ref="player" ref="player"
v-if="showPlayer && uav" v-if="showPlayer && uav"
:pointListFlag="pointListFlag"
@imgUrl="getimgUrl"
@startLinePoint="startLinePoint"
:scheduleData="scheduleData"
:NXdata="NXdata"
:lineLableName="lineLableName"
:device="uav" :device="uav"
:mountDatas="selectMount"
@close="onPlayerClose" @close="onPlayerClose"
/> />
<ControlPanel v-if="showPanel"></ControlPanel> <ControlPanel v-if="showPanel"></ControlPanel>
...@@ -37,10 +32,7 @@ export default { ...@@ -37,10 +32,7 @@ export default {
return { return {
pointListFlag: false, pointListFlag: false,
aiPopup: null, //识别图标 aiPopup: null, //识别图标
scheduleData: {}, //航线执行进度
keyFlag: false, //NX状态 keyFlag: false, //NX状态
NXdata: {}, //NX数据
lineLableName: "", //当前航线标签
videoItem: 0, videoItem: 0,
showCenter: false, showCenter: false,
}; };
...@@ -50,6 +42,7 @@ export default { ...@@ -50,6 +42,7 @@ export default {
"uav", "uav",
"showPlayer", "showPlayer",
"showPanel", "showPanel",
"selectMount"
]), ]),
taskId() { taskId() {
return this.$store.state.fckernel.taskId; return this.$store.state.fckernel.taskId;
...@@ -82,15 +75,6 @@ export default { ...@@ -82,15 +75,6 @@ export default {
mounted() {}, mounted() {},
beforeDestroy() {}, beforeDestroy() {},
methods: { methods: {
startLinePoint() {
this.pointListFlag = !this.pointListFlag;
if (this.pointListFlag) {
this.pointFlag = true;
setTimeout(() => {
this.pointFlag = false;
}, 1000);
}
},
getcanvas(val, item) { getcanvas(val, item) {
let data = null; let data = null;
if (item.jsonData) { if (item.jsonData) {
...@@ -350,60 +334,6 @@ export default { ...@@ -350,60 +334,6 @@ export default {
}); });
} }
}, },
async getimgUrl(val, aiType, item) {
this.aiType = aiType;
this.imgshow = true;
this.imgshowurl = val;
//人流
if (aiType == 3) {
this.aiTotal = item.detectPersonCount;
this.getcanvas(val, item);
}
//车流
if (aiType == 13) {
// this.aiTotal = item.detectPersonCount;
let data = JSON.parse(item.jsonData).label;
console.log(data, "datatat");
let car = "";
let van = "";
let truck = "";
let bus = "";
for (let t in data) {
if (t == "car" && data["car"]) {
car = "小轿车" + data["car"] + "辆";
} else if (t == "truck" && data["truck"]) {
truck = "卡车" + data["truck"] + "辆";
} else if (t == "van" && data["van"]) {
van = "面包车" + data["van"] + "辆";
} else if (t == "bus" && data["bus"]) {
bus = "巴士" + data["bus"] + "辆";
}
}
this.aiTotal = car + truck + van + bus;
this.getcanvas(val, item);
}
//游泳
if (aiType >= 4) {
this.getcanvas(val, item);
}
//人脸
if (aiType == 1 || aiType == 2) {
let data = {
fileKey: item.visitUrl,
aiType: aiType,
};
let res = await API.FCKERNEL.getFaceResultByFileKey(data);
if (aiType == 1) {
this.faceList = res.faceImageInfo?.faceResults;
this.faceShow = true;
this.getcanvas(val, res.faceImageInfo);
} else {
this.carList = res.aiPlateShiJuResultInfoDtoList;
this.carShow = true;
this.getcanvas(val, res);
}
}
},
onPlayerClose(){ onPlayerClose(){
this.$store.dispatch("MMCFlightControlCenter/uavApplications/showPlayer", this.uav); this.$store.dispatch("MMCFlightControlCenter/uavApplications/showPlayer", this.uav);
} }
......
...@@ -882,13 +882,6 @@ const actions = { ...@@ -882,13 +882,6 @@ const actions = {
}, },
}); });
} else { } else {
// 地面站链路
window.$mmc.store.dispatch("MMCGroundStation/order", {
order: "指点飞行",
data: {},
deviceHardId: state.uav.hardId,
});
data?.callback && data.callback(true);
} }
}, },
/** /**
...@@ -936,13 +929,6 @@ const actions = { ...@@ -936,13 +929,6 @@ const actions = {
}, },
}); });
} else { } else {
// 地面站链路
window.$mmc.store.dispatch("MMCGroundStation/order", {
order: "指点飞行",
data: {},
deviceHardId: state.uav.hardId,
});
data?.callback && data.callback(true);
} }
}, },
/** /**
...@@ -961,13 +947,6 @@ const actions = { ...@@ -961,13 +947,6 @@ const actions = {
}, },
}); });
} else { } else {
// 地面站链路
window.$mmc.store.dispatch("MMCGroundStation/order", {
order: "指点飞行",
data: {},
deviceHardId: state.uav.hardId,
});
data?.callback && data.callback(true);
} }
}, },
...@@ -987,13 +966,6 @@ const actions = { ...@@ -987,13 +966,6 @@ const actions = {
}, },
}); });
} else { } else {
// 地面站链路
window.$mmc.store.dispatch("MMCGroundStation/order", {
order: "指点飞行",
data: {},
deviceHardId: state.uav.hardId,
});
data?.callback && data.callback(true);
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论