摄像头预览优化

This commit is contained in:
曹磊 2025-08-14 17:40:17 +08:00
parent 9c1076e64c
commit d67d7b955c
7 changed files with 236 additions and 130 deletions

View File

@ -27,5 +27,6 @@
<div id="app"> <div id="app">
</div> </div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
<script src="<%= basePublicPath %>/static/tums-player/tums-player.umd.min.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
<template> <template>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled"> <JFormContainer>
<template #detail> <template #detail>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
@ -12,7 +12,7 @@
<a-row> <a-row>
<a-col :span="2"></a-col> <a-col :span="2"></a-col>
<a-col :span="20"> <a-col :span="20">
<div id="video-container" class="video-container"></div> <div id="video-container-common" class="video-container"></div>
</a-col> </a-col>
</a-row> </a-row>
<a-row style="margin-top: 14px"> <a-row style="margin-top: 14px">
@ -225,24 +225,24 @@ import {
const useForm = Form.useForm; const useForm = Form.useForm;
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
deviceIndex: '',// deviceIndex: '',//
streamType: 0,// 0 1 streamType: 1,// 0 1
// //
url: '',//URL url: '',//URL
backupUrl: '',//URLIPnull backupUrl: '',//URLIPnull
wsUrl: '',//ws wsUrl: '',//ws
wssUrl: '',//wss wssUrl: '',//wss
chroma: "0", // chroma: 0, //
luma: "0", // luma: 0, //
sharpness: "0", // sharpness: 0, //
saturation: "0", // saturation: 0, //
contrast: "0", // contrast: 0, //
wd_gain: "0", // wd_gain: 0, //
smartir_level: "0",// smartir_level: 0,//
wide_dynamic: "off", // "off"// "on"// wide_dynamic: "off", // "off"// "on"//
smartir: "auto_ir",//"auto_ir_ae" //- "auto_ir" //- "manual"// smartir: "auto_ir",//"auto_ir_ae" //- "auto_ir" //- "manual"//
smartwtl: "auto_wtl",//"auto_wtl_ae" //- "auto_wtl" //- "manual" // smartwtl: "auto_wtl",//"auto_wtl_ae" //- "auto_wtl" //- "manual" //
smartwtl_digital_level: "0",// smartwtl_digital_level: 0,//
flip_type: "center",// "off"// "left_and_right"// "up_and_down"// "center"// flip_type: "center",// "off"// "left_and_right"// "up_and_down"// "center"//
night_vision_mode: "md_night_vision",//"wtl_night_vision"// "inf_night_vision"// "md_night_vision"// night_vision_mode: "md_night_vision",//"wtl_night_vision"// "inf_night_vision"// "md_night_vision"//
@ -286,13 +286,20 @@ import {
formData.wssUrl = res.wssUrl; formData.wssUrl = res.wssUrl;
confirmLoading.value=false; confirmLoading.value=false;
}); });
if (player.value){
player.value.destroy().then(() => {
}); //
player.value = null;
}
const TumsPlayer = window['tums-player'].default; const TumsPlayer = window['tums-player'].default;
player.value = new TumsPlayer('video-container', { player.value = new TumsPlayer('video-container-common', {
type: "rtsp", // rtsp type: "rtsp", // rtsp
url: formData.url, // , getPreviewUrl url: formData.url, // , getPreviewUrl
// url: formData.backupUrl, // , getPreviewUrl // url: formData.backupUrl, // , getPreviewUrl
socket: formData.wssUrl, // websocket, getPreviewUrl socket: formData.wssUrl, // websocket, getPreviewUrl
pluginPath: '/static', // sdkpluginPath pluginPath: '/static', // sdkpluginPath
talkEnable: true,
useMultitrans: true,
}); });
let isPlaying = player.value.isPlaying(); let isPlaying = player.value.isPlaying();
if (!isPlaying) { if (!isPlaying) {
@ -311,6 +318,7 @@ import {
if (player){ if (player){
player.value.destroy().then(() => { player.value.destroy().then(() => {
}); // }); //
player.value = null;
} }
} }
@ -325,20 +333,28 @@ import {
"deviceIndex": deviceIndex, "deviceIndex": deviceIndex,
"type": "common" "type": "common"
}).then(res=>{ }).then(res=>{
formData.chroma = res.chroma; // formData.chroma = strToInt(res.chroma); //
formData.luma = res.luma; // formData.luma = strToInt(res.luma); //
formData.sharpness = res.sharpness; // formData.sharpness = strToInt(res.sharpness); //
formData.saturation = res.saturation; // formData.saturation = strToInt(res.saturation); //
formData.contrast = res.contrast; // formData.contrast = strToInt(res.contrast); //
formData.wd_gain = res.wd_gain; // formData.wd_gain = strToInt(res.wd_gain); //
formData.smartir_level = res.smartir_level; // formData.smartir_level = strToInt(res.smartir_level); //
formData.wide_dynamic = res.wide_dynamic; // "off"// "on"// formData.wide_dynamic = res.wide_dynamic; // "off"// "on"//
formData.smartir = res.smartir; //"auto_ir_ae" //- "auto_ir" //- "manual"// formData.smartir = res.smartir; //"auto_ir_ae" //- "auto_ir" //- "manual"//
formData.smartwtl = res.smartwtl; //"auto_wtl_ae" //- "auto_wtl" //- "manual" // formData.smartwtl = res.smartwtl; //"auto_wtl_ae" //- "auto_wtl" //- "manual" //
formData.smartwtl_digital_level = res.smartwtl_digital_level; // formData.smartwtl_digital_level = strToInt(res.smartwtl_digital_level); //
}); });
} }
function strToInt(val){
if(val!=null&&isFinite(val)){
return Number(val);
}else{
return val;
}
}
/** /**
* 获取照明设置信息 * 获取照明设置信息
*/ */
@ -415,6 +431,20 @@ import {
{ deep: true, immediate: true } { deep: true, immediate: true }
); );
}); });
function destroyPlayer(){
if (player){
player.value.destroy().then(() => {
}); //
player.value = null;
}
}
//
defineExpose({
destroyPlayer
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,6 +1,6 @@
<template> <template>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled"> <JFormContainer>
<template #detail> <template #detail>
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
@ -13,7 +13,7 @@
<a-row> <a-row>
<a-col :span="1"></a-col> <a-col :span="1"></a-col>
<a-col :span="20"> <a-col :span="20">
<div id="video-container" class="video-container"> <div id="video-container-osd" class="video-container">
<div class="osd-text-top"> <div class="osd-text-top">
<span v-show="formData.dateEnabled">{{formData.dateData}}&nbsp;</span> <span v-show="formData.dateEnabled">{{formData.dateData}}&nbsp;</span>
<span v-show="formData.weekEnabled">{{formData.weekData}}&nbsp;</span> <span v-show="formData.weekEnabled">{{formData.weekData}}&nbsp;</span>
@ -108,7 +108,7 @@
weekEnabled: true, weekEnabled: true,
labelEnabled: true, labelEnabled: true,
streamType: 0,// 0 1 streamType: 1,// 0 1
// //
url: '',//URL url: '',//URL
backupUrl: '',//URLIPnull backupUrl: '',//URLIPnull
@ -220,13 +220,20 @@
formData.wssUrl = res.wssUrl; formData.wssUrl = res.wssUrl;
confirmLoading.value=false; confirmLoading.value=false;
}); });
if (player.value){
player.value.destroy().then(() => {
}); //
player.value = null;
}
const TumsPlayer = window['tums-player'].default; const TumsPlayer = window['tums-player'].default;
player.value = new TumsPlayer('video-container', { player.value = new TumsPlayer('video-container-osd', {
type: "rtsp", // rtsp type: "rtsp", // rtsp
url: formData.url, // , getPreviewUrl url: formData.url, // , getPreviewUrl
// url: formData.backupUrl, // , getPreviewUrl // url: formData.backupUrl, // , getPreviewUrl
socket: formData.wssUrl, // websocket, getPreviewUrl socket: formData.wssUrl, // websocket, getPreviewUrl
pluginPath: '/static', // sdkpluginPath pluginPath: '/static', // sdkpluginPath
talkEnable: true,
useMultitrans: true,
}); });
let isPlaying = player.value.isPlaying(); let isPlaying = player.value.isPlaying();
if (!isPlaying) { if (!isPlaying) {
@ -245,6 +252,7 @@
if (player){ if (player){
player.value.destroy().then(() => { player.value.destroy().then(() => {
}); // }); //
player.value = null;
} }
} }
@ -261,6 +269,20 @@
{ deep: true, immediate: true } { deep: true, immediate: true }
); );
}); });
function destroyPlayer(){
if (player){
player.value.destroy().then(() => {
}); //
player.value = null;
}
}
//
defineExpose({
destroyPlayer
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -4,42 +4,39 @@
v-model:activeKey="activeKey" v-model:activeKey="activeKey"
tab-position="left" tab-position="left"
:style="{ height: '100%' }" :style="{ height: '100%' }"
@tabScroll="callback"
> >
<a-tab-pane :key="1" tab="画面显示"> <a-tab-pane key="A" tab="画面显示">
<a-tabs <a-tabs
v-model:activeKey="oneChildActiveKey" v-model:activeKey="oneChildActiveKey"
tab-position="top" tab-position="top"
:style="{ height: '100%' }" :style="{ height: '100%' }"
@tabScroll="callback"
type="card" type="card"
> >
<a-tab-pane :key="1" tab="视频显示"> <a-tab-pane key="A1" tab="视频显示">
<div class="scrollable" v-if="oneChildActiveKey==1"> <div class="scrollable" v-if="oneChildActiveKey=='A1'">
<CameraCommonForm :data="cameraData"></CameraCommonForm> <CameraCommonForm ref="commonFormRef" :data="cameraData"></CameraCommonForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="2" tab="OSD"> <a-tab-pane key="A2" tab="OSD">
<div class="scrollable" v-if="oneChildActiveKey==2"> <div class="scrollable" v-if="oneChildActiveKey=='A2'">
<CameraOsdForm :data="cameraData"></CameraOsdForm> <CameraOsdForm ref="osdFormRef" :data="cameraData"></CameraOsdForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="3" tab="码流参数"> <a-tab-pane key="A3" tab="码流参数">
<div class="scrollable" v-if="oneChildActiveKey==3"> <div class="scrollable" v-if="oneChildActiveKey=='A3'">
<CameraBitrateForm :data="cameraData"></CameraBitrateForm> <CameraBitrateForm :data="cameraData"></CameraBitrateForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="2" tab="事件侦测"> <a-tab-pane key="B" tab="事件侦测">
<a-tabs <a-tabs
v-model:activeKey="twoChildActiveKey" v-model:activeKey="twoChildActiveKey"
tab-position="top" tab-position="top"
:style="{ height: '100%' }" :style="{ height: '100%' }"
@tabScroll="callback"
type="card" type="card"
> >
<a-tab-pane :key="1" tab="镜头遮挡"> <a-tab-pane key="B1" tab="镜头遮挡">
<div class="scrollable"> <div class="scrollable">
<CameraBlockForm :data="cameraData"></CameraBlockForm> <CameraBlockForm :data="cameraData"></CameraBlockForm>
</div> </div>
@ -67,40 +64,38 @@
<!-- </a-tab-pane>--> <!-- </a-tab-pane>-->
</a-tabs> </a-tabs>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="3" tab="报警设备"> <a-tab-pane key="C" tab="报警设备">
<a-tabs <a-tabs
v-model:activeKey="threeChildActiveKey" v-model:activeKey="threeChildActiveKey"
tab-position="top" tab-position="top"
:style="{ height: '100%' }" :style="{ height: '100%' }"
@tabScroll="callback"
type="card" type="card"
> >
<a-tab-pane :key="1" tab="白光报警"> <a-tab-pane key="C1" tab="白光报警">
<div class="scrollable" v-if="threeChildActiveKey==1"> <div class="scrollable" v-if="threeChildActiveKey==1">
<CameraLightAlarmForm :data="cameraData"></CameraLightAlarmForm> <CameraLightAlarmForm :data="cameraData"></CameraLightAlarmForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="2" tab="声音报警"> <a-tab-pane key="C2" tab="声音报警">
<div class="scrollable" v-if="threeChildActiveKey==2"> <div class="scrollable" v-if="threeChildActiveKey==2">
<CameraSoundAlarmForm :data="cameraData"></CameraSoundAlarmForm> <CameraSoundAlarmForm :data="cameraData"></CameraSoundAlarmForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="4" tab="录像管理"> <a-tab-pane key="D" tab="录像管理">
<a-tabs <a-tabs
v-model:activeKey="fourChildActiveKey" v-model:activeKey="fourChildActiveKey"
tab-position="top" tab-position="top"
:style="{ height: '100%' }" :style="{ height: '100%' }"
@tabScroll="callback"
type="card" type="card"
> >
<a-tab-pane :key="1" tab="MP4转发FTP"> <a-tab-pane key="D1" tab="MP4转发FTP">
<div class="scrollable"> <div class="scrollable">
<CameraUploadForm :data="cameraData"></CameraUploadForm> <CameraUploadForm :data="cameraData"></CameraUploadForm>
</div> </div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="2" tab="当天录像"> <a-tab-pane key="D2" tab="当天录像">
<div class="scrollable"> <div class="scrollable">
<CameraRecordList :data="cameraData" /> <CameraRecordList :data="cameraData" />
</div> </div>
@ -148,10 +143,12 @@
ip: '' ,//IP ip: '' ,//IP
}); });
const cameraData = ref({}); const cameraData = ref({});
const activeKey = ref(1); const activeKey = ref('A');
const oneChildActiveKey = ref(1); const oneChildActiveKey = ref('A1');
const twoChildActiveKey = ref(1); const twoChildActiveKey = ref('B1');
const threeChildActiveKey = ref(1); const threeChildActiveKey = ref('C1');
const commonFormRef = ref();
const osdFormRef = ref();
const imageData = reactive<Record<string, any>>({ const imageData = reactive<Record<string, any>>({
// //
@ -222,10 +219,18 @@
cameraData.value.parentId = formData.parentId; cameraData.value.parentId = formData.parentId;
} }
function destroyPlayer(){
if(commonFormRef.value){
commonFormRef.value.destroyPlayer();
}
if(osdFormRef.value){
osdFormRef.value.destroyPlayer();
}
}
defineExpose({ defineExpose({
edit, edit,
destroyPlayer
}); });
</script> </script>

View File

@ -1,6 +1,8 @@
<template> <template>
<j-modal :title="title" :width="width" :fullscreen="true" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> <j-modal :title="title" :width="width" :fullscreen="true" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<CameraPictureConfig ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPictureConfig> <div v-if="showCamera">
<CameraPictureConfig ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPictureConfig>
</div>
</j-modal> </j-modal>
</template> </template>
@ -14,6 +16,7 @@
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false); const disableSubmit = ref<boolean>(false);
const registerForm = ref(); const registerForm = ref();
const showCamera = ref<boolean>(false);
const emit = defineEmits(['register', 'success']); const emit = defineEmits(['register', 'success']);
@ -23,6 +26,7 @@
*/ */
function edit(record) { function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑'; title.value = disableSubmit.value ? '详情' : '编辑';
showCamera.value = true;
visible.value = true; visible.value = true;
nextTick(() => { nextTick(() => {
registerForm.value.edit(record); registerForm.value.edit(record);
@ -49,6 +53,10 @@
*/ */
function handleCancel() { function handleCancel() {
visible.value = false; visible.value = false;
nextTick(() => {
registerForm.value.destroyPlayer();
showCamera.value = false;
});
} }
defineExpose({ defineExpose({

View File

@ -2,75 +2,104 @@
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<div id="video-container"></div> <div id="video-container-preview"></div>
</a-col> </a-col>
<a-col :span="24" style="padding: 5px;"> <a-col :span="20">
<span style="margin-left: 5px;" v-show="!izPlaying"> <a-col :span="24" style="padding: 5px;">
<a-button preIcon="ant-design:play-circle-outlined" @click="play">播放</a-button> <span style="margin-left: 5px;" v-show="!izPlaying">
</span> <a-button preIcon="ant-design:play-circle-outlined" @click="play">播放</a-button>
<span style="margin-left: 5px;" v-show="izPlaying"> </span>
<a-button preIcon="ant-design:pause-circle-outlined" @click="pause">暂停</a-button> <span style="margin-left: 5px;" v-show="izPlaying">
</span> <a-button preIcon="ant-design:pause-circle-outlined" @click="pause">暂停</a-button>
<span style="margin-left: 5px;"> </span>
<a-button preIcon="ant-design:swap-outlined" @click="switchResolution">{{ resolution }}</a-button> <span style="margin-left: 5px;">
</span> <a-button preIcon="ant-design:swap-outlined" @click="switchResolution">{{ resolution }}</a-button>
<!-- <span style="margin-left: 5px;"> </span>
<a-button preIcon="ant-design:phone-outlined" @click="screenshot">巡航*</a-button> <!-- <span style="margin-left: 5px;">
</span>--> <a-button preIcon="ant-design:phone-outlined" @click="screenshot">巡航*</a-button>
<span style="margin-left: 5px;" v-show="!izPhone"> </span>-->
<a-button preIcon="ant-design:phone-outlined" @click="startPhone">电话</a-button> <span style="margin-left: 5px;" v-show="!izPhone">
</span> <a-button preIcon="ant-design:phone-outlined" @click="startPhone">电话</a-button>
<span style="margin-left: 5px;" v-show="izPhone"> </span>
<a-button type="primary" danger ghost preIcon="ant-design:phone-outlined" @click="stopPhone">电话</a-button> <span style="margin-left: 5px;" v-show="izPhone">
</span> <a-button type="primary" danger ghost preIcon="ant-design:phone-outlined" @click="stopPhone">电话</a-button>
<span style="margin-left: 15px;">分屏 </span>
<a-select <span style="margin-left: 15px;">分屏
ref="select" <a-select
v-model:value="fishEyeDisplayMode" ref="select"
style="width: 120px" v-model:value="fishEyeDisplayMode"
@focus="focus" style="width: 120px"
@change="setFishEyeDisplayMode" @focus="focus"
> @change="setFishEyeDisplayMode"
<a-select-option value="ORIGIN">原图</a-select-option> >
<a-select-option value="FISHEYE_360D">360全景</a-select-option> <a-select-option value="ORIGIN">原图</a-select-option>
<a-select-option value="FISHEYE_180D">180全景</a-select-option> <a-select-option value="FISHEYE_360D">360全景</a-select-option>
<a-select-option value="FISHEYE_WIN_PLANE_TOP_QUAD">四分屏</a-select-option> <a-select-option value="FISHEYE_180D">180全景</a-select-option>
<a-select-option value="FISHEYE_LONGITUDE">全景拉伸</a-select-option> <a-select-option value="FISHEYE_WIN_PLANE_TOP_QUAD">四分屏</a-select-option>
</a-select> <a-select-option value="FISHEYE_LONGITUDE">全景拉伸</a-select-option>
</span> </a-select>
</span>
</a-col>
<a-col :span="24" style="padding: 5px;">
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:picture-outlined" @click="screenshot">截图</a-button>
</span>
<span style="margin-left: 5px;" v-show="!izRecording">
<a-button preIcon="ant-design:video-camera-outlined" @click="recordingStart">录制</a-button>
</span>
<span style="margin-left: 5px;" v-show="izRecording">
<a-button type="primary" danger ghost preIcon="ant-design:video-camera-outlined" @click="recordingEnd">录制</a-button>
</span>
<span style="margin-left: 15px;">画面翻转
<a-select v-model:value="formData.flip_type" @change="(value) => changeSwitch('flip_type', value)">
<a-select-option value="off">关闭</a-select-option>
<a-select-option value="left_and_right">左右</a-select-option>
<a-select-option value="up_and_down">上下</a-select-option>
<a-select-option value="center">中心</a-select-option>
</a-select>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:alert-outlined" @click="manualAlarm">报警</a-button>
</span>
</a-col>
<a-col :span="24" style="padding: 5px;">
<span style="margin-left: 5px;">
变焦
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-out-outlined" @mousedown="moveCtrl(9,1,1)" @mouseup="moveCtrl(9,0,1)" title="缩小">缩小</a-button>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-in-outlined" @mousedown="moveCtrl(10,1,1)" @mouseup="moveCtrl(10,0,1)" title="放大">放大</a-button>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-out-outlined" @mousedown="moveCtrl(11,1,1)" @mouseup="moveCtrl(11,0,1)">对近焦</a-button>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-in-outlined" @mousedown="moveCtrl(11,1,1)" @mouseup="moveCtrl(11,0,1)">对远焦</a-button>
</span>
</a-col>
</a-col> </a-col>
<a-col :span="24" style="padding: 5px;"> <a-col :span="4" v-show="formData.ptz == '1'">
<span style="margin-left: 5px;"> <table style="width: 96px;height:96px;margin: 5px 0px 5px 0px;">
<a-button preIcon="ant-design:picture-outlined" @click="screenshot">截图</a-button> <tbody>
</span> <tr>
<span style="margin-left: 5px;" v-show="!izRecording"> <td></td>
<a-button preIcon="ant-design:video-camera-outlined" @click="recordingStart">录制</a-button> <td><a-button preIcon="ant-design:caret-up-outlined" @mousedown="moveCtrl(1,1,1)" @mouseup="moveCtrl(1,0,1)"></a-button></td>
</span> <td></td>
<span style="margin-left: 5px;" v-show="izRecording"> </tr>
<a-button type="primary" danger ghost preIcon="ant-design:video-camera-outlined" @click="recordingEnd">录制</a-button> <tr>
</span> <td><a-button preIcon="ant-design:caret-left-outlined" @mousedown="moveCtrl(3,1,1)" @mouseup="moveCtrl(3,0,1)"></a-button></td>
<span style="margin-left: 15px;">画面翻转 <td><a-button preIcon="ant-design:compress-outlined"></a-button></td>
<a-select v-model:value="formData.flip_type" @change="(value) => changeSwitch('flip_type', value)"> <td><a-button preIcon="ant-design:caret-right-outlined" @mousedown="moveCtrl(5,1,1)" @mouseup="moveCtrl(5,0,1)"></a-button></td>
<a-select-option value="off">关闭</a-select-option> </tr>
<a-select-option value="left_and_right">左右</a-select-option> <tr>
<a-select-option value="up_and_down">上下</a-select-option> <td></td>
<a-select-option value="center">中心</a-select-option> <td><a-button preIcon="ant-design:caret-down-outlined" @mousedown="moveCtrl(7,1,1)" @mouseup="moveCtrl(7,0,1)"></a-button></td>
</a-select> <td></td>
</span> </tr>
<span style="margin-left: 5px;"> </tbody>
<a-button preIcon="ant-design:alert-outlined" @click="manualAlarm">报警</a-button> </table>
</span>
</a-col>
<a-col :span="24" style="padding: 5px;">
<span style="margin-left: 5px;">
变焦
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-out-outlined" @click="zoomInOut('out')" title="缩小"></a-button>
</span>
<span style="margin-left: 5px;">
<a-button preIcon="ant-design:zoom-in-outlined" @click="zoomInOut('in')" title="放大"></a-button>
</span>
</a-col> </a-col>
</a-row> </a-row>
</a-spin> </a-spin>
@ -99,7 +128,7 @@
const formRef = ref(); const formRef = ref();
const player = ref(); const player = ref();
const resolution = ref<string>('超清'); const resolution = ref<string>('流畅');
const izPlaying = ref<boolean>(true); const izPlaying = ref<boolean>(true);
const izRecording = ref<boolean>(false); const izRecording = ref<boolean>(false);
const izPhone = ref<boolean>(false); const izPhone = ref<boolean>(false);
@ -111,7 +140,7 @@
// //
deviceIndex: '',// deviceIndex: '',//
streamType: 0,// 0 1 streamType: 1,// 0 1
// //
url: '',//URL url: '',//URL
@ -120,7 +149,10 @@
wssUrl: '',//wss wssUrl: '',//wss
flip_type: '',// "off"// "left_and_right"// "up_and_down"// "center"// flip_type: '',// "off"// "left_and_right"// "up_and_down"// "center"//
zoom: 1, //
sliderValue : 1,//
ptz : 0,//
smartCode : 0,//
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -160,7 +192,6 @@
// //
Object.assign(formData, tmpData); Object.assign(formData, tmpData);
}); });
createPreview(); createPreview();
getSwitch(); getSwitch();
} }
@ -179,9 +210,10 @@
if (player.value){ if (player.value){
player.value.destroy().then(() => { player.value.destroy().then(() => {
}); // }); //
player.value = null;
} }
const TumsPlayer = window['tums-player'].default; const TumsPlayer = window['tums-player'].default;
player.value = new TumsPlayer('video-container', { player.value = new TumsPlayer('video-container-preview', {
type: "rtsp", // rtsp type: "rtsp", // rtsp
url: formData.url, // , getPreviewUrl url: formData.url, // , getPreviewUrl
// url: formData.backupUrl, // , getPreviewUrl // url: formData.backupUrl, // , getPreviewUrl
@ -400,6 +432,7 @@
if (player){ if (player){
player.value.destroy().then(() => { player.value.destroy().then(() => {
}); // }); //
player.value = null;
} }
} }

View File

@ -1,6 +1,8 @@
<template> <template>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> <j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<CameraPreviewForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPreviewForm> <div v-if="showCamera">
<CameraPreviewForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPreviewForm>
</div>
</j-modal> </j-modal>
</template> </template>
@ -12,6 +14,7 @@
const title = ref<string>(''); const title = ref<string>('');
const width = ref<number>(600); const width = ref<number>(600);
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const showCamera = ref<boolean>(false);
const disableSubmit = ref<boolean>(false); const disableSubmit = ref<boolean>(false);
const registerForm = ref(); const registerForm = ref();
const emit = defineEmits(['register', 'success']); const emit = defineEmits(['register', 'success']);
@ -24,6 +27,7 @@
*/ */
function edit(record) { function edit(record) {
title.value = record.deviceName; title.value = record.deviceName;
showCamera.value = true;
visible.value = true; visible.value = true;
nextTick(() => { nextTick(() => {
registerForm.value.edit(record); registerForm.value.edit(record);
@ -48,8 +52,11 @@
* 取消按钮回调事件 * 取消按钮回调事件
*/ */
function handleCancel() { function handleCancel() {
registerForm.value.destroy();
visible.value = false; visible.value = false;
nextTick(() => {
registerForm.value.destroy();
showCamera.value = false;
});
} }
defineExpose({ defineExpose({