Commit 445eb574 authored by 朱松文's avatar 朱松文

add

parent c8bd4248
......@@ -54,7 +54,7 @@ export default class Camera extends BaseVue {
}
handleClickCamera(cameraId: string): void {
this.$emit("clickCamera", { cameraId });
this.$emit("clickCamera", { cameraId, groupName: this.groupName });
}
handleCameraName(name: string) {
......
......@@ -16,4 +16,5 @@ export interface DogData {
frameCountWithRope?: number;
frameCountWithoutRope?: number;
withRopeRatio?: number;
objId?: string
}
......@@ -2,6 +2,7 @@ export interface TrackData {
DogId: string,
FrameIndex: numbner,
HasRope: boolean,
obj_id: number,
x1: number,
y1: number,
x2: number,
......
......@@ -83,13 +83,12 @@ export default class MyVideo extends Vue {
onSrcChange(dog: DogData) {
this.player.src(dog.fileName);
// this.player.currentTime((dog.startFrameIndex * 40) / 1000);
this.player.play();
}
onTrackDataChange(dogIds: any, trackData: any, currentDogId: string) {
onTrackDataChange(dogIds: any, trackData: any, dog: DogData) {
//切换视频隐藏跟踪框
this.dogTrack.initData(dogIds, trackData, currentDogId);
this.dogTrack.initData(dogIds, trackData, dog);
}
beforeDestroy() {
......
......@@ -11,6 +11,7 @@ class DogTrack extends Component {
isReplaceDisplayNone = false
arrayIndex = 0
preCurrentTime = 0
isExtract = false
constructor(player, options) {
super(player, options);
......@@ -28,16 +29,9 @@ class DogTrack extends Component {
// })
}
// fullScreenChange(e, player) {
// if (player.isFullscreen()) {
// console.log("full", e.currentTarget.offsetWidth, e.currentTarget.offsetHeight)
// }
// }
update() {
if (this.processing || this.trackData.length === 0) return
// const now = new Date().getTime()
// console.log("call", this.arrayIndex)
this.processing = true
const currentTime = this.player_.currentTime() * 1000
//假如调整的播放时间则初始数组索引
......@@ -54,15 +48,23 @@ class DogTrack extends Component {
}
for (let i = this.arrayIndex; i < this.trackData.length; i++) {
const d = this.trackData[i]
// console.log(i, currentTime, d[0] * 40)
if (firstFrameIndex <= currentTime && currentTime <= d[0] * 40) {
if (this.isExtract) {
const time = Math.abs(d[0] * 40 - currentTime)
if (time < 300) {
this.arrayIndex = i == 0 ? 1 : i
this.trackDogs(d[1])
console.log('extract', time, d[0], currentTime)
break;
} else {
this.hideTrack()
}
} else if (firstFrameIndex <= currentTime && currentTime <= d[0] * 40) {
this.arrayIndex = i
this.trackDogs(d[1])
break;
}
}
this.processing = false
// console.log("currentTime 循环耗时", new Date().getTime() - now)
}
trackDogs(dogs) {
......@@ -93,8 +95,17 @@ class DogTrack extends Component {
}
}
hideTrack() {
for (const id of this.dogDiv.keys()) {
const arrEl = this.dogDiv.get(id)
arrEl[0].classList.add("display-none")
arrEl[1].classList.add("display-none")
}
}
initData(dogIds: any, data: any, currentDog: DogData) {
if (!data || data.length === 0) return;
this.isExtract = currentDog.labelFileName.indexOf('extract') > -1
//先清理之前狗跟踪的div
this.clearOldDogDiv()
this.dispose()
......@@ -124,7 +135,6 @@ class DogTrack extends Component {
createDogDiv(dogIds: any, currentDogId: string) {
if (!dogIds || dogIds.size === 0) return;
console.log('dogId', currentDogId, dogIds)
//@ts-ignore
const myContainer = this.player_.el_;
// console.log("key currentDogId", dogIds, currentDogId, myContainer)
......
......@@ -4,6 +4,7 @@ import api from '@/configs/apiConfig'
import { TrackData } from "@/components/MyVideo/data";
import { getItem, setItem } from '@/utils/indexdbHelper'
import { Message } from 'element-ui'
import { extractFile } from '@/utils/common'
export function getCamera(pageData: any): Promise<responseData> {
return NetUtil.fetch_request('camera/paging', 'POST', pageData)
......
export function extractFile(fileName: string) {
if (!fileName) return fileName
if (fileName.indexOf('.') < 0) return fileName
const ar = fileName.split('.')
if (ar.length != 2) return fileName
return `${ar[0]}_extract.${ar[1]}`
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment