first commit
This commit is contained in:
97
WebRoot/jsp/work/appCameraView.jsp
Normal file
97
WebRoot/jsp/work/appCameraView.jsp
Normal file
@ -0,0 +1,97 @@
|
||||
<%@page import="com.sipai.entity.maintenance.Maintenance" %>
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<style type="text/css">
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var websocket = null;
|
||||
|
||||
function viewThisCamera(id) {
|
||||
var uuid = '${uuid}';
|
||||
var net = '${net}';
|
||||
var definition = 'standard';
|
||||
if ('${param.definition}' != null && '${param.definition}' != '') {
|
||||
definition = '${param.definition}';
|
||||
}
|
||||
var restartDialog;
|
||||
//判断当前浏览器是否支持WebSocket
|
||||
if ('WebSocket' in window) {
|
||||
var time = '${time}';
|
||||
if (time == null || time == '') {
|
||||
time = "now";
|
||||
}
|
||||
$.post(ext.contextPath + '/work/camera/getCameraById.do', {
|
||||
id: id
|
||||
}, function (data) {
|
||||
var camera = JSON.parse(data);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + "/work/camera/isNet.do?nowUrl=" + window.location.host,
|
||||
async: false,
|
||||
globle: false,
|
||||
dataType: 'json',
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
let hostUrl = window.location.href;
|
||||
if (hostUrl.substring(0, 5) == 'https') {
|
||||
data.url = data.url.replace('ws', 'wss');
|
||||
}
|
||||
websocket = new WebSocket("" + data.url + "/videoWebSocket/" + camera.type + "/" + camera.url + "/" + camera.username + "/" + camera.password + "/" + camera.channel + "/" + time + "/${uuid}" + "/" + definition);
|
||||
<%--if (data.type == '1') {--%>
|
||||
<%-- websocket = new WebSocket("" + data.url + "/videoWebSocket/" + camera.type + "/" + camera.url + "/" + camera.username + "/" + camera.password + "/" + camera.channel + "/" + time + "/${uuid}" + "/high");--%>
|
||||
<%--} else if (data.type == '2') {--%>
|
||||
<%-- websocket = new WebSocket("" + data.url + "/videoWebSocket/" + camera.type + "/" + camera.netUrl + "/" + camera.username + "/" + camera.password + "/" + camera.channel + "/" + time + "/${uuid}" + "/high");--%>
|
||||
<%--}--%>
|
||||
}
|
||||
});
|
||||
websocket.onerror = function () {
|
||||
};
|
||||
|
||||
//连接成功建立的回调方法
|
||||
websocket.onopen = function () {
|
||||
console.info('消息滚动websocker开启');
|
||||
}
|
||||
//接收到消息的回调方法
|
||||
websocket.onmessage = function (event) {
|
||||
// var result = JSON.parse(event.data);
|
||||
$("#show_video_1").attr("src", event.data);
|
||||
}
|
||||
})
|
||||
// websocket = new WebSocket(ext.basePath.replace("http", "ws") + "/videoWebSocket/" + id + "/" + time + "/dpvideo");
|
||||
} else {
|
||||
alert('当前浏览器 Not support websocket')
|
||||
}
|
||||
}
|
||||
|
||||
//关闭WebSocket连接
|
||||
function closeWebSocket() {
|
||||
websocket.onclose = function () {
|
||||
}; // disable onclose handler first
|
||||
websocket.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="viewThisCamera('${id}')" class="hold-transition ${cu.themeclass} sidebar-mini"
|
||||
style="width: 100%;height: 100%;background-color: rgb(23, 39, 55);">
|
||||
<div id="videos" style="width:100%;height:100%;float: left;background-color: rgb(23, 39, 55);">
|
||||
<div style="width: 100%;height: 100%;float: left;background-color: rgb(23, 39, 55);" id="video_1" class="white">
|
||||
<img id="show_video_1" style="width: 100%;height: 100%;" src="">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user