| | |
| | | * @Author: Morpheus |
| | | * @Date: 2021-03-17 15:21:33 |
| | | * @Last Modified by: Morpheus |
| | | * @Last Modified time: 2021-03-20 11:38:56 |
| | | * @Last Modified time: 2021-03-20 16:47:06 |
| | | */ |
| | | <template> |
| | | <basic-container> |
| | |
| | | :visible.sync="dialogTableVisible" |
| | | :append-to-body="true" |
| | | :close-on-click-modal="false" |
| | | @opened="videoConversationReal = true" |
| | | @close="(videoConversationReal = false), (oldVideoSatart = false)" |
| | | > |
| | | <el-dialog |
| | |
| | | > |
| | | <video |
| | | src="" |
| | | id="video_conversation" |
| | | id="real_video_conversation" |
| | | style="width: 100%; height: 100%; object-fit: fill" |
| | | controls |
| | | ></video> |
| | |
| | | muted="muted" |
| | | autoplay="autoplay" |
| | | loop |
| | | id="old_video" |
| | | id="real_old_video" |
| | | style="width: 100%; height: 100%; object-fit: fill" |
| | | controls |
| | | ></video> |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col span="12"> |
| | | <el-form-item label="警情类别"> |
| | | <el-form-item label="警情类型"> |
| | | <el-input |
| | | disabled="true" |
| | | v-model="form.waringType" |
| | |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col span="12"> |
| | | <!-- <el-col span="12"> |
| | | <el-form-item label="接警时间"> |
| | | <el-input |
| | | disabled="true" |
| | | v-model="form.jjTime" |
| | | autocomplete="off" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <el-col span="12"> |
| | | <el-form-item label="报警内容"> |
| | | <el-input |
| | | disabled="true" |
| | | v-model="form.content" |
| | | autocomplete="off" |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | :class="{ active: isActive }" |
| | | type="success" |
| | | @click.stop=" |
| | | (videoConversationReal = !videoConversationReal), |
| | | (oldVideoSatart = false), |
| | | aKeyToCall(form) |
| | | (videoConversationReal = true), (oldVideoSatart = false) |
| | | " |
| | | @mousedown.native="aKeyToCall" |
| | | @mouseup.native="aKeyStopCall" |
| | | >视频通话 |
| | | </el-button> |
| | | <el-button |
| | |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col span="12"> |
| | | <el-form-item label="报警内容"> |
| | | <el-input |
| | | disabled="true" |
| | | v-model="form.content" |
| | | autocomplete="off" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col span="12"> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.bz" autocomplete="off"></el-input> |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | // { |
| | | // label: "报警内容", |
| | | // prop: "content", |
| | | // }, |
| | | { |
| | | label: "主要负责人", |
| | | prop: "oneContacts", |
| | |
| | | peopleList: [], |
| | | peopleName: "", |
| | | peoplePhone: "", |
| | | aKeyToCallFlag: false, |
| | | aKeyToCallTime: null, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | created() { |
| | | this.dateTime = this.getDate(); |
| | | Recorder.getPermission().then(() => {}); |
| | | |
| | | this.recorder = new Recorder({ |
| | | sampleBits: 16, // 采样位数,支持 8 或 16,默认是16 |
| | |
| | | this.$router.query != null && |
| | | this.$router.query != "" |
| | | ) { |
| | | params = { |
| | | alarmType: this.$router.query.alarmType, |
| | | }; |
| | | if (this.$router.query.status) { |
| | | this.activeClass = this.$router.query.status; |
| | | this.page.currentPage = 1; |
| | | if (this.$router.query.status == 0) { |
| | | params = { |
| | | waringType: this.$router.query.waringType, |
| | | beginTime: this.dateTime.day.beginTime, |
| | | endTime: this.dateTime.day.endTime, |
| | | }; |
| | | } else if (this.$router.query.status == 1) { |
| | | params = { |
| | | waringType: this.$router.query.waringType, |
| | | beginTime: this.dateTime.week.beginTime, |
| | | endTime: this.dateTime.week.endTime, |
| | | }; |
| | | } else if (this.$router.query.status == 2) { |
| | | params = { |
| | | waringType: this.$router.query.waringType, |
| | | beginTime: this.dateTime.month.beginTime, |
| | | endTime: this.dateTime.month.endTime, |
| | | }; |
| | | } |
| | | } else { |
| | | params = { |
| | | waringType: this.$router.query.waringType, |
| | | }; |
| | | } |
| | | } |
| | | |
| | | if (releaseTimeRange) { |
| | |
| | | this.onLoad(this.page, params); |
| | | }, |
| | | rowStyle({ row, column, rowIndex }) { |
| | | if (row.jtype == "1") { |
| | | if (row.jtype == "0") { |
| | | return { |
| | | color: "#ff2727", |
| | | }; |
| | | } else if (row.jtype == "1") { |
| | | return { |
| | | color: "#15a2fe", |
| | | }; |
| | | } else { |
| | | return { |
| | | color: "#ff2727", |
| | | color: "#000000", |
| | | }; |
| | | } |
| | | }, |
| | |
| | | this.peopleName = row.oneContacts; |
| | | this.peoplePhone = row.onePhone; |
| | | this.dialogTableVisible = true; |
| | | this.videoConversationReal = true; |
| | | }, |
| | | updateJtyep(row, jtype, t) { |
| | | var that = this; |
| | |
| | | jtype: jtype, |
| | | rid: row.alarmId, |
| | | bz: row.bz, |
| | | snumber: row.alarmPeople, |
| | | sname: row.alarmId, |
| | | snumber: row.alarmId, |
| | | sname: row.alarmPeople, |
| | | zc: t, |
| | | zctime: that.getDate().current, |
| | | }, |
| | |
| | | ) |
| | | .then(function () { |
| | | that.onLoad(that.page, that.query); |
| | | that.videoConversationReal = false; |
| | | that.oldVideoSatart = false; |
| | | that.dialogTableVisible = false; |
| | | }); |
| | | }, |
| | | beginTimeOrEndTime(time) { |
| | |
| | | }, |
| | | // 视频通话打开关闭事件 |
| | | openRealVideoBox() { |
| | | var that = this; |
| | | var newAxios = axios.create({ |
| | | baseURL: "https://web.byisf.com:18000", |
| | | withCredentials: false, |
| | |
| | | this.videoSource = result.data.data.m3u8; |
| | | |
| | | if (Hls.isSupported()) { |
| | | var dom = document.getElementById("video_conversation"); |
| | | |
| | | // if (dom.volume) dom.volume = 1.0; |
| | | var dom = document.getElementById("real_video_conversation"); |
| | | |
| | | this.hls = new Hls(); |
| | | |
| | |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // newAxios |
| | | // .post( |
| | | // "/api_control", |
| | | // {}, |
| | | // { |
| | | // params: { |
| | | // param: JSON.stringify({ |
| | | // PktType: "RemotePlayback", |
| | | // accessToken: res.data.data.accessToken, |
| | | // deviceCode: "001231409472", |
| | | // startTime: "20210130150000", |
| | | // endTime: "20210130160000", |
| | | // chl: data.serialNumber |
| | | // }) |
| | | // } |
| | | // } |
| | | // ) |
| | | // .then(result => { |
| | | |
| | | // this.videoConversationReal = true; |
| | | |
| | | // this.videoSource = result.data.data.m3u8; |
| | | |
| | | // }); |
| | | }); |
| | | }, |
| | | closeRealVideoBox() { |
| | | var dom = document.getElementById("video_conversation"); |
| | | var dom = document.getElementById("real_video_conversation"); |
| | | |
| | | if (dom.getAttribute("src") != "") { |
| | | dom.pause(); |
| | |
| | | |
| | | // 历史视频打开关闭事件 |
| | | openOldVideoBox() { |
| | | var dom = document.getElementById("old_video"); |
| | | var dom = document.getElementById("real_old_video"); |
| | | dom.currentTime = 0; |
| | | dom.play(); |
| | | }, |
| | | closeOldVideoBox() { |
| | | var dom = document.getElementById("old_video"); |
| | | var dom = document.getElementById("real_old_video"); |
| | | dom.pause(); |
| | | }, |
| | | |
| | | aKeyToCall(e, form) { |
| | | aKeyToCall() { |
| | | var that = this; |
| | | if (this.recorder == null) { |
| | | this.recorder = new Recorder({ |
| | | sampleBits: 16, // 采样位数,支持 8 或 16,默认是16 |
| | | sampleRate: 8000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000 |
| | | numChannels: 1, // 声道,支持 1 或 2, 默认是1 |
| | | // compiling: false,(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false |
| | | }); |
| | | } |
| | | this.isActive = true; |
| | | |
| | | // 一键呼叫相关函数 |
| | | that.recorder.start().then( |
| | | () => { |
| | | // 开始录音 |
| | | }, |
| | | (error) => { |
| | | // 出错了 |
| | | console.log(`${error.name} : ${error.message}`); |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | // 序列号后期待修改 |
| | | aKeyStopCall() { |
| | | var newCallAxios = axios.create({ |
| | | baseURL: "https://web.byisf.com:18000", |
| | | withCredentials: false, |
| | |
| | | }, |
| | | }); |
| | | var that = this; |
| | | that.isActive = false; |
| | | |
| | | if (that.recorder == null) { |
| | | that.recorder = new Recorder({ |
| | | sampleBits: 16, // 采样位数,支持 8 或 16,默认是16 |
| | | sampleRate: 8000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000 |
| | | numChannels: 1, // 声道,支持 1 或 2, 默认是1 |
| | | // compiling: false,(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false |
| | | }); |
| | | } |
| | | |
| | | if (this.aKeyToCallFlag == false) { |
| | | this.aKeyToCallFlag = true; |
| | | videoPhone(); |
| | | Recorder.getPermission().then(() => { |
| | | // 一键呼叫相关函数 |
| | | that.aKeyToCallTime = setInterval(() => { |
| | | that.recorder.start().then( |
| | | () => { |
| | | // 开始录音 |
| | | setTimeout(() => { |
| | | newCallAxios |
| | | .post( |
| | | `/api_control`, |
| | | {}, |
| | | { |
| | | params: { |
| | | param: { PktType: "GetAccessToken" }, |
| | | }, |
| | | } |
| | | ) |
| | | .then((result) => { |
| | | var formData = new FormData(); |
| | | var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据 |
| | | //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData |
| | | var newbolb = new Blob([blob], { type: "audio/pcm" }); |
| | | var fileOfBlob = new File( |
| | | [newbolb], |
| | | new Date().getTime() + ".pcm" |
| | | ); |
| | | formData.append("file", fileOfBlob); |
| | | |
| | | // var dom = document.getElementById("real_audio"); |
| | | // dom.setAttribute("src", URL.createObjectURL(blob)); |
| | | |
| | | // this.recorder.play(); |
| | | |
| | | newCallAxios |
| | | .post(`/api_control`, blob, { |
| | | params: { |
| | | param: { |
| | | PktType: "Talk", |
| | | accessToken: result.data.data.accessToken, |
| | | // deviceCode: form.channelNumber, |
| | | deviceCode: "001241945990", |
| | | }, |
| | | }, |
| | | }) |
| | | .then((result) => {}); |
| | | }); |
| | | }, 5000); |
| | | }, |
| | | (error) => { |
| | | // 出错了 |
| | | console.log(`${error.name} : ${error.message}`); |
| | | } |
| | | ); |
| | | }, 6000); |
| | | }); |
| | | } else { |
| | | this.aKeyToCallFlag = false; |
| | | |
| | | that.recorder.destroy().then(function () { |
| | | that.recorder = null; |
| | | }); |
| | | window.clearInterval(that.aKeyToCallTime); |
| | | } |
| | | |
| | | function videoPhone() { |
| | | that.recorder.start().then( |
| | | () => { |
| | | // 开始录音 |
| | | setTimeout(() => { |
| | | newCallAxios |
| | | .post( |
| | | `/api_control`, |
| | | {}, |
| | | { |
| | | params: { |
| | | param: { PktType: "GetAccessToken" }, |
| | | }, |
| | | } |
| | | ) |
| | | .then((result) => { |
| | | var formData = new FormData(); |
| | | var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据 |
| | | //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData |
| | | var newbolb = new Blob([blob], { type: "audio/pcm" }); |
| | | var fileOfBlob = new File( |
| | | [newbolb], |
| | | new Date().getTime() + ".pcm" |
| | | ); |
| | | formData.append("file", fileOfBlob); |
| | | |
| | | // var dom = document.getElementById("real_audio"); |
| | | // dom.setAttribute("src", URL.createObjectURL(blob)); |
| | | |
| | | // this.recorder.play(); |
| | | |
| | | newCallAxios |
| | | .post(`/api_control`, blob, { |
| | | params: { |
| | | param: { |
| | | PktType: "Talk", |
| | | accessToken: result.data.data.accessToken, |
| | | // deviceCode: form.channelNumber, |
| | | deviceCode: "001241945990", |
| | | }, |
| | | }, |
| | | }) |
| | | .then((result) => {}); |
| | | }); |
| | | }, 5000); |
| | | }, |
| | | (error) => { |
| | | // 出错了 |
| | | console.log(`${error.name} : ${error.message}`); |
| | | newCallAxios |
| | | .post( |
| | | `/api_control`, |
| | | {}, |
| | | { |
| | | params: { |
| | | param: { PktType: "GetAccessToken" }, |
| | | }, |
| | | } |
| | | ); |
| | | } |
| | | }, |
| | | |
| | | aKeyToCall111(e, form) { |
| | | var newCallAxios = axios.create({ |
| | | baseURL: "https://web.byisf.com:18000", |
| | | withCredentials: false, |
| | | headers: { |
| | | "Content-Type": "application/json;", |
| | | }, |
| | | }); |
| | | |
| | | setInterval(() => { |
| | | Recorder.getPermission().then(() => { |
| | | this.recorder.start().then(() => { |
| | | // 开始录音 |
| | | newCallAxios |
| | | .post( |
| | | `/api_control`, |
| | | {}, |
| | | { |
| | | params: { |
| | | param: { PktType: "GetAccessToken" }, |
| | | }, |
| | | } |
| | | ) |
| | | .then((result) => { |
| | | var formData = new FormData(); |
| | | var blob = this.recorder.getPCMBlob(); //获取pcm格式音频数据 |
| | | //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData |
| | | var newbolb = new Blob([blob], { type: "audio/pcm" }); |
| | | var fileOfBlob = new File( |
| | | [newbolb], |
| | | new Date().getTime() + ".pcm" |
| | | ); |
| | | formData.append("file", fileOfBlob); |
| | | |
| | | // var dom = document.getElementById("real_audio"); |
| | | // dom.setAttribute("src", URL.createObjectURL(blob)); |
| | | |
| | | // this.recorder.play(); |
| | | |
| | | newCallAxios |
| | | .post(`/api_control`, blob, { |
| | | params: { |
| | | param: { |
| | | PktType: "Talk", |
| | | accessToken: result.data.data.accessToken, |
| | | // deviceCode: form.channelNumber, |
| | | deviceCode: "001241945990", |
| | | }, |
| | | }, |
| | | }) |
| | | .then((result) => {}); |
| | | ) |
| | | .then((result) => { |
| | | var formData = new FormData(); |
| | | var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据 |
| | | //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData |
| | | var newbolb = new Blob([blob], { type: "audio/pcm" }); |
| | | var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm"); |
| | | formData.append("file", fileOfBlob); |
| | | newCallAxios |
| | | .post(`/api_control`, blob, { |
| | | params: { |
| | | param: { |
| | | PktType: "Talk", |
| | | accessToken: result.data.data.accessToken, |
| | | // deviceCode: form.channelNumber, |
| | | deviceCode: "001241945990", |
| | | }, |
| | | }, |
| | | }) |
| | | .then(() => { |
| | | that.recorder.destroy().then(function () { |
| | | that.recorder = null; |
| | | }); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | // 一键呼叫相关函数 |
| | | }, 200000); |
| | | }, |
| | | |
| | | peopleOrPhone(e) { |
| | | this.peopleList.forEach((item) => { |
| | | if (item.label == e) { |