You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
414 lines
33 KiB
JavaScript
414 lines
33 KiB
JavaScript
2 weeks ago
|
define(function (require, exports, module) {
|
||
|
function e() {
|
||
|
this.m_iCurPage = 0, this.m_aPlugins = [], h = 0, f = "", v = ""
|
||
|
}
|
||
|
|
||
|
var a, t, n, i, o, r, s, l, c, d, m, u, p, g, h, f, v;
|
||
|
a = require("jquery"), require("quickTime"), t = require("common"), n = require("service"), i = require("translator"), o = require("isapi/device"), r = require("utils"), s = require("dialog"), l = require("common/header"), m = require("common/tool"), c = require("common/channel"), d = require("common/plugin"), u = require("common/ptz"), p = require("isapi/response"), g = require("base64"), e.prototype = {
|
||
|
init: function () {
|
||
|
var e = this, a = i.getLanguage("Preview");
|
||
|
i.appendLanguage(a, t.m_oLanCommon), document.title = i.getValue("preview"), e.initLayout(), e.initController(), e.checkLoaded()
|
||
|
}, checkLoaded: function () {
|
||
|
var e = this;
|
||
|
setTimeout(function () {
|
||
|
if (n.m_oLoaded.bPlugin) {
|
||
|
var t = d.getLocalConfig(), i = r.parseXmlFromStr(t);
|
||
|
a(i).find("CaptureFileFormat").length > 0 && (h = r.nodeValue(i, "CaptureFileFormat", "i")), f = r.nodeValue(i, "CapturePath"), v = r.nodeValue(i, "RecordPath"), n.m_iStreamType = !o.m_oDeviceCapa.bSupportTransCode && r.nodeValue(a(i), "StreamType", "i") > 1 ? 0 : r.nodeValue(a(i), "StreamType", "i");
|
||
|
for (var s = 0; n.m_aChannelList.length > s; s++) n.m_aChannelList[s].iStreamType = n.m_iStreamType;
|
||
|
if (n.isSingleChannel()) {
|
||
|
var l = e.checkPlugins();
|
||
|
if (0 == l.length) return n.m_iPluginType = 4, void 0;
|
||
|
n.m_iPluginType = -1 != a.inArray("webcomponents", l) ? 4 : -1 != a.inArray("quicktime", l) ? 1 : -1 != a.inArray("vlc", l) ? 2 : -1 != a.inArray("mjpeg", l) ? 3 : 4
|
||
|
}
|
||
|
var p = r.nodeValue(a(i), "RealPlayAll", "i");
|
||
|
(1 === p || n.isSingleChannel()) && (e.startPlayAll(), 4 !== n.m_iPluginType && e.pluginChange(n.m_iPluginType)), c.update(), m.update(), u.update();
|
||
|
var g = decodeURI(document.URL);
|
||
|
if (g.indexOf("?") > -1) {
|
||
|
var y = r.getURIParam("open", g);
|
||
|
"" !== y && (y = y.match(/\{(.+)\}/), null !== y && setTimeout(function () {
|
||
|
for (var a = y[1].split(","), t = 0; a.length > t; t++) e.startPlay(parseInt(a[t], 10) - 1, t, !0);
|
||
|
c.update(), m.update(), u.update()
|
||
|
}, 100))
|
||
|
}
|
||
|
} else e.checkLoaded()
|
||
|
}, 10)
|
||
|
}, initLayout: function () {
|
||
|
var e = this, i = {
|
||
|
defaults: {spacing_open: 0, spacing_closed: 0},
|
||
|
north: {paneSelector: ".layout-north", size: 40},
|
||
|
west: {
|
||
|
paneSelector: ".layout-west", size: n.isSingleChannel() ? 15 : 200, onresize_end: function () {
|
||
|
c.resize()
|
||
|
}
|
||
|
},
|
||
|
center: {
|
||
|
paneSelector: ".layout-center",
|
||
|
childOptions: {
|
||
|
defaults: {spacing_open: 0},
|
||
|
center: {
|
||
|
paneSelector: ".layout-center-inner", onresize_end: function () {
|
||
|
m.hideSound(), e.sizeChange(n.m_iWndSizeMode)
|
||
|
}
|
||
|
},
|
||
|
south: {paneSelector: ".layout-south-inner", size: 40}
|
||
|
}
|
||
|
},
|
||
|
east: {
|
||
|
paneSelector: ".layout-east",
|
||
|
initClosed: n.isSingleChannel(),
|
||
|
size: 209,
|
||
|
spacing_open: t.m_bAnonymous ? 0 : 10,
|
||
|
spacing_closed: t.m_bAnonymous ? 0 : 10,
|
||
|
onresize_end: function () {
|
||
|
u.resize()
|
||
|
}
|
||
|
},
|
||
|
south: {paneSelector: ".layout-south", size: 30}
|
||
|
};
|
||
|
a("body").layout(i)
|
||
|
}, initController: function () {
|
||
|
var e = this;
|
||
|
t.m_bAnonymous || o.getPanoramicMapCap(), l.init("header", 0), c.init("channel", "preview", {
|
||
|
onPlay: function (a, t) {
|
||
|
e.startPlay(a, t), m.update(), u.update()
|
||
|
}, onRecord: function (a) {
|
||
|
e.startRecord(a), m.update()
|
||
|
}, onSelected: null, onChangeStream: function (a, t) {
|
||
|
e.channelStreamChange(a, t), m.update(), u.update()
|
||
|
}
|
||
|
}), m.init("tool", "preview", {
|
||
|
onPlayAll: function () {
|
||
|
e.startPlayAll(), c.update(), u.update()
|
||
|
}, onRecordAll: function () {
|
||
|
e.startRecordAll(), c.update()
|
||
|
}, onCapture: function () {
|
||
|
e.capture()
|
||
|
}, onEnableEzoom: function () {
|
||
|
e.enableEzoom()
|
||
|
}, onEnableRegionExposure: function () {
|
||
|
e.enableRegionExposure(), u.update()
|
||
|
}, onEnableRegionFocus: function () {
|
||
|
e.enableRegionFocus(), u.update()
|
||
|
}, onPrevPage: function () {
|
||
|
e.prevPage(), c.update()
|
||
|
}, onNextPage: function () {
|
||
|
e.nextPage(), c.update()
|
||
|
}, onArrangeWindow: function () {
|
||
|
e.m_iCurPage = 0, m.update(!0)
|
||
|
}, onStreamChange: function (a) {
|
||
|
e.streamChange(a), c.update()
|
||
|
}, onSizeChange: function (a) {
|
||
|
e.sizeChange(a)
|
||
|
}, onPluginChange: function (a) {
|
||
|
e.pluginChange(a)
|
||
|
}, onTalkChange: function (a, t, n, i) {
|
||
|
e.enableTalk(a, t, n, i)
|
||
|
}
|
||
|
});
|
||
|
var a = decodeURI(document.URL);
|
||
|
if (a.indexOf("?") > -1) {
|
||
|
var i = r.getURIParam("slice", a);
|
||
|
"" !== i && (n.m_iWndSplitMode = Math.ceil(Math.sqrt(parseInt(i, 10))))
|
||
|
}
|
||
|
d.init("plugin", n.m_iWndSplitMode, {
|
||
|
onGetSelectWndInfo: function (a) {
|
||
|
e.getSelectWndInfo(a), m.update(), u.update()
|
||
|
}, onPluginEventHandler: function (a, t, n) {
|
||
|
e.pluginEventHandler(a, t, n)
|
||
|
}, onZoomInfoCallback: function (a) {
|
||
|
e.zoomInfoCallback(a)
|
||
|
}, onPTZCtrlCallback: function (a, t, n) {
|
||
|
e.ptzCtrlCallback(a, t, n)
|
||
|
}
|
||
|
}), u.init("ptz")
|
||
|
}, unload: function () {
|
||
|
try {
|
||
|
d.stopRealPlayAll(), d.stopTalk()
|
||
|
} catch (e) {
|
||
|
}
|
||
|
}, pluginEventHandler: function (e, a) {
|
||
|
var t = this;
|
||
|
21 == e ? (s.tip(i.getValue("noEnoughSpace")), -1 !== n.m_aWndList[a].iChannelPlayIndex && n.m_aWndList[a].bRecord && setTimeout(function () {
|
||
|
t.startRecord(n.m_aWndList[a].iChannelPlayIndex), c.update(), m.update()
|
||
|
}, 500)) : 3 == e ? (t.enableTalk(0), s.tip(i.getValue("voiceTalkFailed"))) : 7 == e && s.tip(i.getValue("noStreamSecret"))
|
||
|
}, zoomInfoCallback: function (e) {
|
||
|
var l, c, d = n.m_aWndList[n.m_iWndIndex], m = n.m_aChannelList[d.iChannelPlayIndex].iId,
|
||
|
u = r.parseXmlFromStr(e);
|
||
|
if (d.bManualTrackEvidence) l = "<?xml version='1.0' encoding='UTF-8'?><ManualTraceEvidenceArea><StartPoint><positionX>" + a(u).find("StartPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY>" + "</StartPoint>" + "<EndPoint>" + "<positionX>" + a(u).find("EndPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY>" + "</EndPoint>" + "</ManualTraceEvidenceArea>", c = "trafficManualTrackCapture"; else if (d.bManualTrack) "TFS" == o.m_oDeviceCapa.oVCAResourceType || o.m_oDeviceCapa.oSupportTraffic.bSupportManualEvidence ? (l = "<?xml version='1.0' encoding='UTF-8'?><ManualItsCap><StartPoint><positionX>" + a(u).find("StartPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY>" + "</StartPoint>" + "<EndPoint>" + "<positionX>" + a(u).find("EndPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY>" + "</EndPoint>" + "</ManualItsCap>", c = "manualEvidence") : (l = "<?xml version='1.0' encoding='UTF-8'?><ManualTrace><positionX>" + a(u).find("StartPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY></ManualTrace>", c = "manualTrace"); else if (d.bRegionFocus) {
|
||
|
var g = parseInt(1e3 * (parseInt(a(u).find("StartPoint").eq(0).find("positionX").eq(0).text(), 10) / 255), 10),
|
||
|
h = 1e3 - parseInt(1e3 * (parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10) / 255), 10),
|
||
|
f = parseInt(1e3 * (parseInt(a(u).find("EndPoint").eq(0).find("positionX").eq(0).text(), 10) / 255), 10),
|
||
|
v = 1e3 - parseInt(1e3 * (parseInt(a(u).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10) / 255), 10);
|
||
|
l = "<?xml version='1.0' encoding='UTF-8'?><RegionalFocus><StartPoint><positionX>" + g + "</positionX>" + "<positionY>" + h + "</positionY></StartPoint><EndPoint><positionX>" + f + "</positionX>" + "<positionY>" + v + "</positionY></EndPoint></RegionalFocus>", c = "regionalFocus"
|
||
|
} else if (d.bRegionExposure) {
|
||
|
var g = parseInt(1e3 * (parseInt(a(u).find("StartPoint").eq(0).find("positionX").eq(0).text(), 10) / 255), 10),
|
||
|
h = 1e3 - parseInt(1e3 * (parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10) / 255), 10),
|
||
|
f = parseInt(1e3 * (parseInt(a(u).find("EndPoint").eq(0).find("positionX").eq(0).text(), 10) / 255), 10),
|
||
|
v = 1e3 - parseInt(1e3 * (parseInt(a(u).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10) / 255), 10);
|
||
|
l = "<?xml version='1.0' encoding='UTF-8'?><RegionalExposure><StartPoint><positionX>" + g + "</positionX>" + "<positionY>" + h + "</positionY></StartPoint><EndPoint><positionX>" + f + "</positionX>" + "<positionY>" + v + "</positionY></EndPoint></RegionalExposure>", c = "regionalExposure"
|
||
|
} else l = "<?xml version='1.0' encoding='UTF-8'?><position3D><StartPoint><positionX>" + a(u).find("StartPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY>" + "</StartPoint><EndPoint><positionX>" + a(u).find("EndPoint").eq(0).find("positionX").eq(0).text() + "</positionX>" + "<positionY>" + (255 - parseInt(a(u).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10)) + "</positionY></EndPoint></position3D>", c = "position3D";
|
||
|
var y = r.parseXmlFromStr(l);
|
||
|
WebSDK.WSDK_SetDeviceConfig(t.m_szHostName, c, {channel: m}, {
|
||
|
data: y, success: function () {
|
||
|
d.bManualTrack && ("TFS" == o.m_oDeviceCapa.oVCAResourceType || o.m_oDeviceCapa.oSupportTraffic.bSupportManualEvidence) && s.tip(i.getValue("manualCaptureStarting")), d.bManualTrackEvidence && s.tip(i.getValue("manualTraceSucces"))
|
||
|
}, error: function (e, a, t) {
|
||
|
p.saveState(t)
|
||
|
}
|
||
|
})
|
||
|
}, ptzCtrlCallback: function (e, a, t) {
|
||
|
if (0 === a) switch (t) {
|
||
|
case 1:
|
||
|
u.m_oService.ptzControl(5, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 2:
|
||
|
u.m_oService.ptzControl(1, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 3:
|
||
|
u.m_oService.ptzControl(7, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 4:
|
||
|
u.m_oService.ptzControl(3, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 5:
|
||
|
u.m_oService.ptzControl(15, u.m_oService.m_oParams.iSpeed), u.update();
|
||
|
break;
|
||
|
case 6:
|
||
|
u.m_oService.ptzControl(4, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 7:
|
||
|
u.m_oService.ptzControl(6, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 8:
|
||
|
u.m_oService.ptzControl(2, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
case 9:
|
||
|
u.m_oService.ptzControl(8, u.m_oService.m_oParams.iSpeed);
|
||
|
break;
|
||
|
default:
|
||
|
} else switch (t) {
|
||
|
case 1:
|
||
|
u.m_oService.ptzControl(5, 0);
|
||
|
break;
|
||
|
case 2:
|
||
|
u.m_oService.ptzControl(1, 0);
|
||
|
break;
|
||
|
case 3:
|
||
|
u.m_oService.ptzControl(7, 0);
|
||
|
break;
|
||
|
case 4:
|
||
|
u.m_oService.ptzControl(3, 0);
|
||
|
break;
|
||
|
case 6:
|
||
|
u.m_oService.ptzControl(4, 0);
|
||
|
break;
|
||
|
case 7:
|
||
|
u.m_oService.ptzControl(6, 0);
|
||
|
break;
|
||
|
case 8:
|
||
|
u.m_oService.ptzControl(2, 0);
|
||
|
break;
|
||
|
case 9:
|
||
|
u.m_oService.ptzControl(8, 0);
|
||
|
break;
|
||
|
default:
|
||
|
}
|
||
|
}, enableTalk: function (e, o, r, l) {
|
||
|
if (0 === e) {
|
||
|
var c = d.stopTalk();
|
||
|
return 0 === c && (a("#btn_talk_change i").eq(0).removeClass().addClass("icon-talk"), a("#btn_talk_change .icon-sel").show(), n.m_oWndParams.bTalking = !1, m.update()), void 0
|
||
|
}
|
||
|
var u = t.m_szHttpProtocol + t.m_szHostName + ":" + t.m_iHttpPort + "/ISAPI/System/TwoWayAudio/channels/" + e + "/open",
|
||
|
p = t.m_szHttpProtocol + t.m_szHostName + ":" + t.m_iHttpPort + "/ISAPI/System/TwoWayAudio/channels/" + e + "/close",
|
||
|
g = t.m_szHttpProtocol + t.m_szHostName + ":" + t.m_iHttpPort + "/ISAPI/System/TwoWayAudio/channels/" + e + "/audioData";
|
||
|
"G.711ulaw" == o ? iAudioType = 1 : "G.711alaw" == o ? iAudioType = 2 : "G.726" == o ? iAudioType = 3 : "MP2L2" == o || "MPEL2" == o ? iAudioType = 4 : "G.722.1" == o ? iAudioType = 0 : "AAC" == o ? iAudioType = 5 : "PCM" == o && (iAudioType = 6);
|
||
|
var h = d.talk(u, p, g, t.m_szPluginNamePwd, iAudioType, r, l);
|
||
|
if (0 != h) {
|
||
|
var f = d.getLastError();
|
||
|
return 403 === f ? s.tip(i.getValue("noPermission")) : s.tip(i.getValue("voiceTalkFailed")), n.m_oWndParams.bTalking = !1, void 0
|
||
|
}
|
||
|
a("#btn_talk_change i").eq(0).removeClass().addClass("icon-talk-" + e).addClass("on"), a("#btn_talk_change .icon-sel").hide(), n.m_oWndParams.bTalking = !0
|
||
|
}, startPlay: function (e, l, c) {
|
||
|
if (d.isInstalled()) {
|
||
|
var m = this, u = 80, p = "", g = "", h = "", f = null, v = -1;
|
||
|
if (h = d.getLocalConfig(), f = r.parseXmlFromStr(h), o.m_oDeviceCapa.bSupportStreamEncrypt && d.setSecretKey(1, r.nodeValue(f, "SecretKey")), void 0 === l) var l = n.m_iWndIndex; else var l = l;
|
||
|
var y = n.m_aChannelList[e], _ = n.m_aWndList[l];
|
||
|
if (v = parseInt(a(f).find("ProtocolType").eq(0).text(), 10), 0 == seajs.iDeviceType && 4 == v && (a(f).find("ProtocolType").eq(0).text("0"), d.setLocalConfig(r.xmlToStr(f)), v = 0), u = "https://" === t.m_szHttpProtocol ? o.m_oDevicePort.iSHttpPort : t.m_iHttpPort, p = "http://", "zero" != y.szType) {
|
||
|
var P = y.iStreamType;
|
||
|
if (o.m_oSHttpCapa.bSupportShttpPlay && 0 == v) if (g = p + t.m_szHostName + ":" + ("" + u) + "/SDK/play/", "analog" == y.szType) g += 100 * y.iId + P + "/004"; else {
|
||
|
var b = o.m_oSHttpCapa.iIpChanBase + y.iId - n.m_iAnalogChNum - 1;
|
||
|
g += 100 * b + P + "/004"
|
||
|
} else 4 != v && (u = o.m_oDevicePort.iRtspPort), g = "rtsp://" + t.m_szHostName + ":" + ("" + u) + "/ISAPI/streaming/channels/", g += 100 * y.iId + P + 1
|
||
|
} else g = o.m_oSHttpCapa.bSupportShttpPlay && 0 === v ? p + t.m_szHostName + ":" + ("" + u) + "/SDK/play/100/004/ZeroStreaming" : "rtsp://" + t.m_szHostName + ":" + o.m_oDevicePort.iRtspPort + "/ISAPI/Custom/SelfExt/ContentMgmt/ZeroStreaming/channels/" + (100 * y.iId + 1);
|
||
|
if (y.bPlay) y.bRecord && 0 === d.stopSave(y.iWndPlayIndex) && (n.m_aChannelList[e].bRecord = !1, n.m_aWndList[y.iWndPlayIndex].bRecord = !1, s.tip(i.getValue("recordSucceed") + "<p id='openDirectory' class='dir pointer'>" + y.szFilePath + "</a></p>", 5), a("#openDirectory").click(function () {
|
||
|
d.openDirectory(y.szDir)
|
||
|
})), 0 === d.stop(y.iWndPlayIndex) && (n.m_aWndList[y.iWndPlayIndex].bPlay = !1, n.m_aWndList[y.iWndPlayIndex].bEzoom = !1, n.m_aWndList[y.iWndPlayIndex].bRegionExposure = !1, n.m_aWndList[y.iWndPlayIndex].bRegionFocus = !1, n.m_aWndList[y.iWndPlayIndex].iChannelId = -1, n.m_aWndList[y.iWndPlayIndex].iChannelPlayIndex = -1, n.m_aWndList[y.iWndPlayIndex].bAutoPan = !1, n.m_aWndList[y.iWndPlayIndex].bLight = !1, n.m_aWndList[y.iWndPlayIndex].bWiper = !1, n.m_aWndList[y.iWndPlayIndex].bManualTrack = !1, n.m_aWndList[y.iWndPlayIndex].b3DZoom = !1, n.m_aWndList[y.iWndPlayIndex].bPTZCtrl = !1, n.m_aWndList[y.iWndPlayIndex].bManualTrackEvidence = !1, y.bPlay = !1, n.m_oWndParams.iSoundWndIndex === n.m_aChannelList[e].iWndPlayIndex && (n.m_oWndParams.iSoundWndIndex = -1), y.iWndPlayIndex = -1, m.updateChannelCap(l)); else {
|
||
|
if (_.bPlay) {
|
||
|
if (_.bRecord && 0 === d.stopSave(l)) {
|
||
|
n.m_aChannelList[_.iChannelPlayIndex].bRecord = !1, _.bRecord = !1;
|
||
|
var S = _.iChannelPlayIndex;
|
||
|
s.tip(i.getValue("recordSucceed") + "<p id='openDirectory' class='dir pointer'>" + n.m_aChannelList[S].szFilePath + "</a></p>", 5), a("#openDirectory").click(function () {
|
||
|
d.openDirectory(n.m_aChannelList[S].szDir)
|
||
|
})
|
||
|
}
|
||
|
0 === d.stop(l) && (n.m_aChannelList[_.iChannelPlayIndex].bPlay = !1, _.bPlay = !1, _.bEzoom = !1, _.bRegionExposure = !1, _.bRegionFocus = !1, _.bAutoPan = !1, _.bLight = !1, _.bWiper = !1, _.bManualTrack = !1, _.bManualTrackEvidence = !1, _.b3DZoom = !1, _.bPTZCtrl = !1, n.m_oWndParams.iSoundWndIndex === oService.m_aChannelList[e].iWndPlayIndex && (n.m_oWndParams.iSoundWndIndex = -1))
|
||
|
}
|
||
|
0 === d.play(g, t.m_szPluginNamePwd, l, "", "") ? (y.bPlay = !0, y.iWndPlayIndex = l, _.iChannelId = y.iId, _.bPlay = !0, _.iChannelPlayIndex = e, m.updateChannelCap(l)) : c || s.tip(i.getValue("previewFailed"))
|
||
|
}
|
||
|
3 === n.m_iWndSizeMode && m.sizeChange(3), m.isPlayOrRecord()
|
||
|
}
|
||
|
}, startPlayAll: function () {
|
||
|
if (d.isInstalled()) {
|
||
|
var e = this, a = n.m_iWndSplitMode * n.m_iWndSplitMode, t = n.m_aChannelList.length;
|
||
|
if (n.m_oWndParams.bHasWndPlay) e.stopPlayAll(); else for (var i = !(1 >= t || 1 >= a), o = 0; t > o; o++) a > o && e.startPlay(o, o, i);
|
||
|
e.isPlayOrRecord()
|
||
|
}
|
||
|
}, stopPlayAll: function () {
|
||
|
var e = this, a = n.m_aChannelList.length;
|
||
|
if (0 === d.stopRealPlayAll()) {
|
||
|
for (var t = 0; a > t; t++) n.m_aChannelList[t].bPlay = !1, n.m_aChannelList[t].bRecord = !1, n.m_aChannelList[t].iWndPlayIndex = -1;
|
||
|
for (var t = 0; n.m_iMaxWndNum > t; t++) n.m_aWndList[t].bPlay = !1, n.m_aWndList[t].bRecord = !1, n.m_aWndList[t].bEzoom = !1, n.m_aWndList[t].bRegionExposure = !1, n.m_aWndList[t].bRegionFocus = !1, n.m_aWndList[t].iChannelId = -1, n.m_aWndList[t].iChannelPlayIndex = -1, n.m_aWndList[t].bAutoPan = !1, n.m_aWndList[t].bLight = !1, n.m_aWndList[t].bWiper = !1, n.m_aWndList[t].bManualTrack = !1, n.m_aWndList[t].b3DZoom = !1, n.m_aWndList[t].bPTZCtrl = !1, n.m_aWndList[t].bManualTrackEvidence = !1;
|
||
|
n.m_oWndParams.iSoundWndIndex = -1, e.updateChannelCap(n.m_iWndIndex)
|
||
|
}
|
||
|
n.m_oWndParams.bHasWndRecord && s.tip(i.getValue("recordSucceed"))
|
||
|
}, startRecord: function (e) {
|
||
|
var o = this, l = "", c = "", m = new Date, u = n.m_aChannelList[e];
|
||
|
if (l = 0 > t.m_szHostName.indexOf("[") ? t.m_szHostName : t.m_szHostName.substring(1, t.m_szHostName.length - 1).replace(/:/g, "."), c = "zero" === u.szType ? l + "_" + u.szName.replace(/\s/g, "") + "_" + r.dateFormat(m, "yyyyMMddhhmmssS") : 9 >= u.iId ? l + "_0" + u.iId + "_" + r.dateFormat(m, "yyyyMMddhhmmssS") : l + "_" + u.iId + "_" + r.dateFormat(m, "yyyyMMddhhmmssS"), u.bPlay) if (u.bRecord) u.bRecord = !1, n.m_aWndList[u.iWndPlayIndex].bRecord = !1, 0 === d.stopSave(u.iWndPlayIndex) ? (s.tip(i.getValue("recordSucceed") + "<p id='openDirectory' class='dir pointer'>" + u.szFilePath + "</a></p>", 5), a("#openDirectory").click(function () {
|
||
|
d.openDirectory(n.m_aChannelList[e].szDir)
|
||
|
})) : s.tip(i.getValue("recordfailed")); else {
|
||
|
var p = d.startSave(u.iWndPlayIndex, c);
|
||
|
if (0 == p) {
|
||
|
u.bRecord = !0, n.m_aWndList[u.iWndPlayIndex].bRecord = !0, t.m_bAnonymous || WebSDK.WSDK_SetDeviceConfig(t.m_szHostName, "requestKeyFrame", {
|
||
|
channel: u.iId,
|
||
|
videoStream: u.iStreamType + 1
|
||
|
}, {async: !1});
|
||
|
var m = new Date;
|
||
|
u.szFilePath = v + "\\" + r.dateFormat(m, "yyyy-MM-dd") + "\\" + c + ".mp4", u.szDir = v + "\\" + r.dateFormat(m, "yyyy-MM-dd")
|
||
|
} else if (-1 === p) {
|
||
|
var g = d.getLastError();
|
||
|
10 === g || 9 === g ? s.tip(i.getValue("createFileFailed")) : s.tip(i.getValue("recordfailed"))
|
||
|
} else -2 === p ? s.tip(i.getValue("noEnoughSpace")) : -3 === p && s.tip(i.getValue("createFileFailed"))
|
||
|
}
|
||
|
o.isPlayOrRecord()
|
||
|
}, startRecordAll: function () {
|
||
|
var e = this, a = n.m_iWndSplitMode * n.m_iWndSplitMode;
|
||
|
if (n.m_oWndParams.bHasWndRecord) for (var t = 0; a > t; t++) n.m_aWndList[t].bRecord && e.startRecord(n.m_aWndList[t].iChannelPlayIndex); else for (var i = n.m_aChannelList.length, t = 0; i > t; t++) e.startRecord(t);
|
||
|
e.isPlayOrRecord()
|
||
|
}, capture: function () {
|
||
|
var e = n.m_iWndIndex, o = n.m_aWndList[e], l = o.iChannelPlayIndex, c = n.m_aChannelList[l];
|
||
|
if (o.bPlay) {
|
||
|
var m = new Date, u = "", p = "", g = "";
|
||
|
g = 0 > t.m_szHostName.indexOf("[") ? t.m_szHostName : t.m_szHostName.substring(1, t.m_szHostName.length - 1).replace(/:/g, "."), p = "zero" === c.szType ? g + "_" + c.szName.replace(/\s/g, "") + "_" + r.dateFormat(m, "yyyyMMddhhmmssS") : 9 >= o.iChannelId ? g + "_0" + o.iChannelId + "_" + r.dateFormat(m, "yyyyMMddhhmmssS") : g + "_" + o.iChannelId + "_" + r.dateFormat(m, "yyyyMMddhhmmssS"), u = f + "\\" + r.dateFormat(m, "yyyy-MM-dd") + "\\" + p + (1 == h ? ".bmp" : ".jpg"), p += 1 == h ? ".bmp" : "";
|
||
|
var v = d.capture(e, p);
|
||
|
if (0 === v) {
|
||
|
var y = f + "\\" + r.dateFormat(m, "yyyy-MM-dd");
|
||
|
s.tip(i.getValue("captureSucceeded") + "<p id='openDirectory' class='dir pointer'>" + u + "</a></p>", 5), a("#openDirectory").click(function () {
|
||
|
d.openDirectory(y)
|
||
|
})
|
||
|
} else if (-1 === v) {
|
||
|
var _ = d.getLastError();
|
||
|
10 === _ || 9 === _ ? s.tip(i.getValue("createFileFailed")) : s.tip(i.getValue("captureFailed"))
|
||
|
} else -2 === v ? s.tip(i.getValue("noEnoughSpace")) : -3 === v && s.tip(i.getValue("createFileFailed"))
|
||
|
}
|
||
|
}, enableEzoom: function () {
|
||
|
var e = n.m_aWndList[n.m_iWndIndex];
|
||
|
e.bEzoom ? 0 === d.disableEzoom(n.m_iWndIndex) && (e.bEzoom = !1) : (n.disableEzoom(d), 0 === d.enableEzoom(n.m_iWndIndex, 0) && (e.bEzoom = !0))
|
||
|
}, enableRegionExposure: function () {
|
||
|
var e = n.m_iWndIndex, a = n.m_aWndList[e];
|
||
|
a.bRegionExposure ? 0 === d.disableEzoom(e) && (a.bRegionExposure = !1) : (n.disableEzoom(d), 0 === d.enableEzoom(e, 1) && (a.bRegionExposure = !0))
|
||
|
}, enableRegionFocus: function () {
|
||
|
var e = n.m_aWndList[n.m_iWndIndex], a = n.m_iWndIndex, e = n.m_aWndList[a];
|
||
|
e.bRegionFocus ? 0 === d.disableEzoom(a) && (e.bRegionFocus = !1) : (n.disableEzoom(d), 0 === d.enableEzoom(a, 1) && (e.bRegionFocus = !0))
|
||
|
}, prevPage: function () {
|
||
|
var e = this, a = n.m_iWndSplitMode * n.m_iWndSplitMode, t = n.m_aChannelList.length, i = Math.ceil(t / a),
|
||
|
o = t % a;
|
||
|
if (0 === e.m_iCurPage) var r = 0; else var r = i - e.m_iCurPage + 1;
|
||
|
if (r === i && (r = 0), n.m_oWndParams.bHasWndPlay && e.startPlayAll(), o > 0) if (0 === r) for (var s = 0; o > s; s++) e.startPlay(t - s - 1, o - s - 1); else for (var s = o + (r - 1) * a; t > s; s++) o + (r - 1) * a + a > s && e.startPlay(t - s - 1, a - (s - (o + (r - 1) * a)) - 1); else for (var s = r * a; t > s; s++) r * a + a > s && e.startPlay(t - s - 1, a - (s - r * a) - 1);
|
||
|
t > r * a && (e.m_iCurPage = i - r)
|
||
|
}, nextPage: function () {
|
||
|
var e = this, a = n.m_iWndSplitMode * n.m_iWndSplitMode, t = n.m_aChannelList.length, i = Math.ceil(t / a);
|
||
|
e.m_iCurPage === i && (e.m_iCurPage = 0), n.m_oWndParams.bHasWndPlay && e.startPlayAll();
|
||
|
for (var o = e.m_iCurPage * a; t > o; o++) e.m_iCurPage * a + a > o && e.startPlay(o, o - e.m_iCurPage * a);
|
||
|
t > e.m_iCurPage * a && e.m_iCurPage++
|
||
|
}, sizeChange: function (e) {
|
||
|
var i = !1, o = n.m_iWndIndex, r = n.m_aWndList[o], s = r.iChannelPlayIndex;
|
||
|
if (s >= 0) {
|
||
|
var l = n.m_aChannelList[s];
|
||
|
i = l.bCorridor
|
||
|
}
|
||
|
n.m_iWndSizeMode = e, a(".plugin").css({background: "#ffffff"});
|
||
|
var c = a("#plugin").width(), d = a("#plugin").height();
|
||
|
if (1 === e) i ? 4 * c / d > 3 ? a("#main_plugin").width(3 * d / 4).height(d) : a("#main_plugin").width(c).height(4 * c / 3) : 3 * c / d > 4 ? a("#main_plugin").width(4 * d / 3).height(d) : a("#main_plugin").width(c).height(3 * c / 4); else if (2 === e) i ? 16 * c / d > 9 ? a("#main_plugin").width(9 * d / 16).height(d) : a("#main_plugin").width(c).height(16 * c / 9) : 9 * c / d > 16 ? a("#main_plugin").width(16 * d / 9).height(d) : a("#main_plugin").width(c).height(9 * c / 16); else if (3 === e) {
|
||
|
if (WebSDK.WSDK_GetDeviceConfig(t.m_szHostName, "StreamChannels", null, {
|
||
|
async: !1,
|
||
|
success: function (e, t) {
|
||
|
var i = a(t).find("StreamingChannel").eq(n.m_iStreamType);
|
||
|
c = parseInt(a(i).find("videoResolutionWidth").eq(0).text(), 10), d = parseInt(a(i).find("videoResolutionHeight").eq(0).text(), 10)
|
||
|
}
|
||
|
}), i) {
|
||
|
var m = c;
|
||
|
c = d, d = m
|
||
|
}
|
||
|
a("#main_plugin").width(c).height(d)
|
||
|
} else 4 === e && a("#main_plugin").width("100%").height("100%")
|
||
|
}, streamChange: function (e) {
|
||
|
var t = this;
|
||
|
a("#btn_stream_type i").eq(0).removeClass().addClass("icon-stream-" + e), n.m_iStreamType = e - 1;
|
||
|
for (var i = 0; n.m_aChannelList.length > i; i++) n.m_aChannelList[i].iStreamType = e - 1;
|
||
|
n.m_aWndList[n.m_iWndIndex].bPlay && 4 !== n.m_iPluginType && t.pluginChange(n.m_iPluginType)
|
||
|
}, channelStreamChange: function (e, a) {
|
||
|
var t = this, i = n.m_aChannelList[e];
|
||
|
i.iStreamType = a;
|
||
|
var o = i.iWndPlayIndex;
|
||
|
o > -1 && n.m_aWndList[o].bPlay && (t.startPlay(e, o), t.startPlay(e, o))
|
||
|
}, isPlayOrRecord: function () {
|
||
|
for (var e = 0; 16 > e; e++) {
|
||
|
if (n.m_aWndList[e].bPlay) {
|
||
|
n.m_oWndParams.bHasWndPlay = !0;
|
||
|
break
|
||
|
}
|
||
|
15 === e && (n.m_oWndParams.bHasWndPlay = !1)
|
||
|
}
|
||
|
for (var e = 0; 16 > e; e++) {
|
||
|
if (n.m_aWndList[e].bRecord) {
|
||
|
n.m_oWndParams.bHasWndRecord = !0;
|
||
|
break
|
||
|
}
|
||
|
15 === e && (n.m_oWndParams.bHasWndRecord = !1)
|
||
|
}
|
||
|
}, pluginChange: function (e) {
|
||
|
var i = this, r = "";
|
||
|
r = 0 === n.m_iStreamType ? "rtsp://" + t.m_szHostName + ":" + o.m_oDevicePort.iRtspPort + "/ISAPI/streaming/channels/101" : 1 === n.m_iStreamType ? "rtsp://" + t.m_szHostName + ":" + o.m_oDevicePort.iRtspPort + "/ISAPI/streaming/channels/102" : "rtsp://" + t.m_szHostName + ":" + o.m_oDevicePort.iRtspPort + "/ISAPI/streaming/channels/10" + (n.m_iStreamType + 1), 3 === e || t.m_bAnonymous || (r += "?auth=" + t.m_szNamePwd), 2 === e && t.m_bAnonymous && (r += "?auth=" + g.encode("anonymous:******")), n.m_oWndParams.bHasWndPlay && i.stopPlayAll(), n.m_oWndParams.bTalking && i.enableTalk(0), 1 === e ? (a("#main_plugin").html(""), a("#main_plugin").html("<embed id='PreviewActiveX' src='preview.asp' type='video/quicktime' width='100%' height='100%' autoplay='true' qtsrc='" + r + "' target='myself' scale='tofit' controller='false' pluginspage='http://www.apple.com/quicktime/download/' loop='false'>")) : 4 === e ? (n.m_aWndList[n.m_iWndIndex].bPlay = !1, n.m_aWndList[n.m_iWndIndex].iChannelId = -1, n.m_aWndList[n.m_iWndIndex].iChannelPlayIndex = -1, n.m_aChannelList[0].bPlay = !1, a(".plugin #main_plugin").css("background", "#343434"), a("#main_plugin").html(""), d.initPlugin(2, "", n.m_iWndSplitMode), setTimeout(function () {
|
||
|
i.startPlay(0, n.m_iWndIndex, !0), m.update(), u.update()
|
||
|
}, 100)) : 2 === e ? (a("#main_plugin").html(""), a("#main_plugin").html("<embed id='PreviewActiveX' type='application/x-vlc-plugin' width='100%' height='100%' target='" + r + "' autoplay='yes' controller='false' loop='no' volume='50' toolbar='false'>")) : 3 === e && (a("#main_plugin").html(""), a("#main_plugin").html("<img id='PreviewActiveX' src='/Streaming/channels/1/preview' width='100%' height='100%'>")), 4 !== e ? (n.m_aWndList[n.m_iWndIndex].bPlay = !0, n.m_aWndList[n.m_iWndIndex].iChannelId = 1, n.m_aWndList[n.m_iWndIndex].iChannelPlayIndex = 0, n.m_aChannelList[0].bPlay = !0, a(".tool-r").hide(), a("#btn_talk_change").hide()) : (a(".tool-r").show(), a("#btn_talk_change").show()), 4 !== e && (a(".plugin #main_plugin").css("background", "#ffffff"), a("#PreviewActiveX").css("height", "99.5%")), n.m_iPluginType = e
|
||
|
}, checkPlugins: function () {
|
||
|
var e = [];
|
||
|
if (a.browser.msie) {
|
||
|
var t = null;
|
||
|
try {
|
||
|
t = new ActiveXObject("WebVideoActiveX.WebVideoActiveXCtrl.1"), e.push("webcomponents")
|
||
|
} catch (n) {
|
||
|
}
|
||
|
try {
|
||
|
t = new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1"), e.push("quicktime")
|
||
|
} catch (n) {
|
||
|
}
|
||
|
} else {
|
||
|
for (var i = 0, o = navigator.mimeTypes.length; o > i; i++) "application/hwp-webvideo-plugin" == navigator.mimeTypes[i].type.toLowerCase() && e.push("webcomponents"), "application/x-vlc-plugin" == navigator.mimeTypes[i].type.toLowerCase() && e.push("vlc"), "video/quicktime" == navigator.mimeTypes[i].type.toLowerCase() && e.push("quicktime");
|
||
|
e.push("mjpeg")
|
||
|
}
|
||
|
return e
|
||
|
}, getSelectWndInfo: function (e) {
|
||
|
var a = this, t = n.m_aWndList[e];
|
||
|
c.m_iChannelId = t.iChannelId, c.switchChannel(), m.hideSound(), a.updateChannelCap(e)
|
||
|
}, updateChannelCap: function (e) {
|
||
|
var a, i;
|
||
|
if (e == n.m_iWndIndex) {
|
||
|
var r = n.m_aWndList[e].iChannelId;
|
||
|
r > -1 && !t.m_bAnonymous ? (a = o.getImageCap(r), i = o.getPTZChanelCap(r)) : (a = {
|
||
|
bSupportRegionalExposure: !1,
|
||
|
bSupportRegionalFocus: !1
|
||
|
}, i = {bSupportPosition3D: !1, bSupportWiperStatus: !1}), m.updateChannelCap(a), u.updateChannelCap(i)
|
||
|
}
|
||
|
}
|
||
|
}, module.exports = new e
|
||
|
});
|