zhanmingkan
2022-05-16 dc9784b9f149e15b0ddfb439135fe712ba2f8e8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
//获取所有视频监督信息
function getVideo_3D() {
    var camData;
    var count;
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/getVideoAndNodes.action",
        contentType : "charset=utf-8",
        success : function(data) {
            camData = data;
            $.ajax({
                type : "post",
                url : "../../easyAPI/video/countCam.action",
                contentType : "application/json;charset=utf-8",
                success : function(data1) {
                    count = data1;
                    showVideo_3D(camData,count);
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    console.log("获取视频总数失败!");
                }
            });
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("获取视频信息失败!");
        }
    });
}
//根据摄像头ID获取摄像头详细信息
var pregetvideoid = null;
function getVideoById_3D(id) {
    if(pregetvideoid!==id){
        var cameraArgs = JSON.stringify({
            "id" : id
        });
        $.ajax({
            type : "post",
            url : "../../easyAPI/video/getVideoById.action",
            data : cameraArgs,
            contentType : "application/json;charset=utf-8",
            success : function(data) {
                if (data !== undefined) {
                    startVideoConverter(data,null,true,"video");
                }
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                console.log("根据摄像头ID获取详细信息请求失败!");
            }
        });
        pregetvideoid = id;
    }
}
//根据摄像头ID获取摄像头并显示投影
function getVideoAndShow(id){
    var cameraArgs = JSON.stringify({
        "id" : id
    });
    var result;
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/getVideoById.action",
        data : cameraArgs,
        async : false,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if (data !== undefined) {
                startVideoConverter(data,null,true);
                result = data;
            }
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("根据摄像头ID获取详细信息请求失败!");
        }
    });
    return result;
}
//根据摄像头ID获取摄像头详细信息并显示视频投影范围
function getVideoScopeById_3D(id) {
    var cameraArgs = JSON.stringify({
        "id" : id
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/getVideoById.action",
        data : cameraArgs,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if (data !== undefined) {
                createVideoScope(data);
            }
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("根据摄像头ID获取详细信息请求失败!");
        }
    });
}
//启动视频转换进程
function startVideoConverter(node,treeObjList,isinfo,type){
    var commandobj = {
        "id" : node.id,
        "camRtsp" : node.camRtsp,
        "camPort" : node.camPort,
        "camAdd" : ""
    };
    var objvlc = {
            'sysType':'vlc',
        };
    var argsvlc = JSON.stringify(objvlc);
    $.ajax({
        type : "post",
        url : "../../easyAPI/sys/querySysParabyType.action",
        data : argsvlc,
        async : false,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            commandobj.camAdd = data[0].sysContent;
            var commandArgs = JSON.stringify(commandobj);
            $.ajax({
                type : "post",
                url : "../../easyAPI/video/startVideoConverter.action",
                data : commandArgs,
                async: false,
                contentType : "application/json;charset=utf-8",
                success : function(data1) {
                    if(data1){
                        console.log("启动转换命令发送成功!");
                    }else{
                        console.log("转换进程已存在或参数不全!");
                    }
                    if(treeObjList==null){
                        if(isinfo){
                            showInfoVideo_3D(node,type);
                        }else{
                            var videoElement = createVideoElement(node.camUrl,node.id);
                            createCameraVideo(node,videoElement);
                        }
                    }else{
                        createVideoContainer(treeObjList,node);
                    }
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    console.log("启动转换命令发送失败!!");
                }
            });
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("ajax请求失败!","请重试!","error");
        }
    });
}
//关闭转换进程
function stopVideoConvertor(node){
    var commandArgs = JSON.stringify({
        "id" : node.id,
    });
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/stopVideoConverter.action",
        data : commandArgs,
        async: false,
        contentType : "application/json;charset=utf-8",
        success : function(data) {
            if(data){
                console.log("停止转换命令发送成功!");
            }else{
                console.log("停止转换进程不存在!");
            }
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("停止转换命令发送失败!!");
        }
    });
}
//视频研判获取所有视频信息
function getCameraAnalyze_3D(){
    var camData;
    var count;
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/getVideoAndNodes.action",
        contentType : "charset=utf-8",
        success : function(data) {
            camData = data;
            $.ajax({
                type : "post",
                url : "../../easyAPI/video/countCam.action",
                contentType : "application/json;charset=utf-8",
                success : function(data1) {
                    count = data1;
                    showCameraAnalyze_3D(camData,count);
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    console.log("获取视频总数请求失败!");
                }
            });
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("获取视频信息失败!");
        },
    });
}
//清除所有视频转换进程
function clearVideoConverter(){
    $.ajax({
        type : "post",
        url : "../../easyAPI/video/clearVideoConverter.action",
        contentType : "charset=utf-8",
        success : function(data) {
            if(data==1){
                console.log("清除成功!");
            }else{
                console.log("清除失败!");
            }
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            console.log("清除命令发送失败!");
        },
    });
}