测试海康对讲

测试海康对讲
This commit is contained in:
TimSpan 2024-09-02 15:08:28 +08:00
parent 13c1e97405
commit bac75ee325
4 changed files with 1717 additions and 3136 deletions

File diff suppressed because one or more lines are too long

4225
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,21 @@
<template>
<div class="hkcont">
<div id="player">
</div>
<div id="player"></div>
<div class="items">
<div>
<button type="button" @click="startTalk">开始对讲</button>
<button type="button" @click="stopTalk">停止对讲</button>
<!-- <button type="button" onClick="SetVolume()">设置声音</button> -->
设置声音<input
type="range"
min="0"
max="100"
step="1"
value="50"
v-model="inputValue"
@change="TalkSetVolume"
/>
设置声音<input type="range" min="0" max="100" step="1" value="50" v-model="inputValue" @change="TalkSetVolume" />
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import api from '@/axios'
import { Ref, ref, watch, onMounted, onBeforeMount, onBeforeUnmount, reactive, getCurrentInstance } from 'vue'
import {ref, onMounted, onBeforeUnmount} from 'vue'
import {useRouter} from 'vue-router'
import {JsonResult} from '@/axios'
const router = useRouter()
const infoData = ref()
const inputValue = ref(50)
var curIndex = 0 //
let myPlugin: any
@ -43,37 +29,68 @@
}
const startTalk = () => {
console.log('开启对讲')
api.post('/multialarm/talk/channel', { ...date }).then((ress) => {
console.log('对讲地址', ress.data.videoUrl);
myPlugin.JS_SetConnectTimeOut(0, 3000);
api.post<any>('/multialarm/talk/channel', {...date}).then((ress) => {
console.log('对讲地址', ress.data.videoUrl)
myPlugin.JS_SetConnectTimeOut(0, 3000)
myPlugin.JS_StartTalk(ress.data.videoUrl).then(
() => {
console.log("talkStart success");
console.log('talkStart success')
},
(e) => {
console.error(e, "对讲失败");
(e: any) => {
console.error(e, '对讲失败')
}
);
)
})
}
const GetVolume = () => {
myPlugin.JS_GetVolume(curIndex).then(
(volumn: any) => {
//50
console.info('JS_GetVolume success', volumn)
// do you want...
},
(err: any) => {
console.info('JS_GetVolume failed')
// do you want...
}
)
}
const OpenSound = () => {
myPlugin.JS_OpenSound(curIndex).then(
() => {
console.info('JS_OpenSound success')
// do you want...
},
(err: any) => {
console.info('JS_OpenSound failed')
// do you want...
}
)
}
//
const stopTalk = () => {
myPlugin.JS_StopTalk().then(function () {
console.log("关闭对讲 success");
}, function () {
console.log("关闭对讲 failed");
});
};
myPlugin.JS_StopTalk().then(
function () {
console.log('关闭对讲 success')
},
function () {
console.log('关闭对讲 failed')
}
)
}
//
const TalkSetVolume = () => {
myPlugin.JS_TalkSetVolume(parseFloat(inputValue.value)).then(
() => {
console.log("JS_TalkSetVolume success", inputValue.value);
console.log('JS_TalkSetVolume success', inputValue.value)
},
(err) => {
console.error("JS_TalkSetVolume failed", err);
(err: any) => {
console.error('JS_TalkSetVolume failed', err)
}
);
)
}
onMounted(() => {
if (typeof window.JSPlugin === 'undefined') {
@ -81,7 +98,6 @@
} else {
}
api.post('/multialarm/video/preview', {...date}).then((res: JsonResult<any>) => {
// console.log('router222', res)
console.log('播放地址', res.data.videoUrl)
@ -108,28 +124,6 @@
var controlIndex = 2
//
// function startTalk() {
// console.log('')
// api.post('/multialarm/talk/channel', { ...date }).then((ress) => {
// console.log('', ress.data.videoUrl);
// // myPlugin.JS_SetConnectTimeOut(0, 3000);
// myPlugin.JS_StartTalk(ress.data.videoUrl).then(
// () => {
// console.log("talkStart success");
// },
// (e) => {
// console.error(e, "");
// }
// );
// })
// }
function playVideo() {
myPlugin
.JS_Play(
@ -141,7 +135,13 @@
curIndex //
)
.then(
() => { },
() => {
console.info('JS_Play success')
OpenSound()
GetVolume()
// do you want...
},
(e: any) => {
// console.log('')
controlIndex--
@ -186,9 +186,9 @@
background: #000;
}
.items {
border: 1px solid #444444;position:absolute;bottom:0px;
border: 1px solid #444444;
position: absolute;
bottom: 0px;
}
}
</style>

View File

@ -856,8 +856,8 @@ const initMapdt = (data: any, podat: any, name: any) => {
}
if (name !== '湖南省') {
// option.series = option.series.filter((series) => series.type !== 'lines')
// option.series[1].data = []
// option.series[2].data = []
option.series[1].data = []
option.series[2].data = []
myChart.setOption(option)
} else {
myChart.setOption(option)