var isInitFinished = false;//视频插件是否加载完成 var swfobject; var lang = new langZhCn(); function langZhCn() { this.videoExample = "视频用例(H5---Chrome/firefox)"; this.videoDesc = "此示例,只支持H5,Chrome使用h5插件。如果需要兼容IE,请参照videoExample.html"; this.h5Example = "videoExample--支持H5-IE"; this.geSessionId = "获取会话号"; this.userId = "用户名:"; this.password = "密码:"; this.login = "登陆"; this.videoInit = "初始化"; this.videoLang = "插件语言:"; this.videoWidth = "插件宽度:"; this.videoHeight = "插件高度:"; this.vodModeTitle = "插件模式"; this.realMode = "实时视频"; this.vodMode = "视频回放"; this.serverIp = "服务器IP:"; this.serverPort = "端口:"; this.windowNumber = "窗口数目:"; this.settings = "设置"; this.videoLive = "实时视频"; this.windowIndex = "窗口下标:"; this.title = "标题:"; this.jsession = "会话号:"; this.stream = "码流:"; this.devIdno = "设备号:"; this.channel = "通道:"; this.play = "播放"; this.stop = "停止"; this.reset = "重置"; this.monitor = "监听"; this.talkback = "对讲"; this.url = "url链接:"; this.playback = "远程回放"; this.nullMic = "您的电脑上没有麦克风,无法启动对讲"; this.micStop = "没有开启FLASH插件麦克风"; this.loginError = "登陆失败"; this.talkback_flashMicStep1 = "第一步,请在视频窗上右键菜单中选择设置"; this.talkback_flashMicStep2 = "第二步在设置窗口中 选择 “允许”,并勾选“记住”"; this.talkback_flashMicStep3 = "关闭设置,并重新启动对讲"; this.bufferTimeDesc = "说明:主要用于调整视频延时,当缓存的数据达到了最小缓冲时长时(默认为2秒),则会进行播放,当到了最大缓冲时长(默认为6秒),则进行快放。"; this.minBufferTime = "最小缓冲时长:"; this.maxBufferTime = "最大缓冲时长:"; this.vedioStatus = "选中窗口播放状态"; this.vedioEventStart = '选中事件:选中第'; this.vedioEventEnd = '个窗口'; this.vedioPlay = "当前选中窗口正在进行视频播放"; this.vedioNoPlay = "当前选中窗口未进行视频播放"; this.playbackDesc = "h5播放器,初始化时将isVodMode配置为true,则可以有回放工具栏,可以进行拖动操作。h5播放器同时可以支持多路同步回放 startVodM(url, \"0,1,2,3\"),需要设备支持多路同步回放,第二个参数\"0,1,2,3\"表示回放的通道"; this.talkbackDesc = "h5播放器,https可以直接对讲;http对讲时,需要下载安装PCM音频采集工具。h5播放器通过 onTtxVideoMsg 消息回调来判断 type=isTalking表示正在对讲中,type=showDownLoadDialog表示需要下载pcm采集工具"; this.downPcmToolBtn = "下载音频采集工具"; this.singleChannel = '单通道播放' this.multiChannel = '多通道同步回放' this.multiChannelUnSync = '多通道同时回放' this.getPlaybackLink = '获取播放连接' this.deviceNoError = '设备号错误' } function langEn() { this.videoExample = "Video Example(H5----Chrome/firefox)"; this.h5Example = "videoExample( IE/H5 Support)"; this.videoDesc = "In this example, only H5 is supported, and Chrome uses the h5 plugin. If you need to be compatible with IE, please refer to videoExample.html"; this.geSessionId = "Get Jsession"; this.userId = "Account:"; this.password = "Password:"; this.login = "Login"; this.videoInit = "Init"; this.videoLang = "language:"; this.videoWidth = "Width:"; this.videoHeight = "Height:"; this.vodModeTitle = "Video Mode"; this.realMode = "Real Video"; this.vodMode = "Playback"; this.serverIp = "ServerIP:"; this.serverPort = "Port:"; this.windowNumber = "WindowNum:"; this.settings = "Setting"; this.videoLive = "Live Video"; this.windowIndex = "Index:"; this.title = "Title:"; this.jsession = "Jsession:"; this.stream = "Stream:"; this.devIdno = "DevIdno:"; this.channel = "Channel:"; this.play = "Play"; this.stop = "Stop"; this.reset = "Reset"; this.monitor = "Monitor"; this.talkback = "Talkback"; this.url = "url:"; this.playback = "Playback"; this.nullMic = "On your computer does not have a microphone, you can not start speaking"; this.micStop = "FLASH plug-in microphone is not turned on"; this.loginError = "Login failed"; this.talkback_flashMicStep1 = "1. select Settings in the video window on the right-click menu"; this.talkback_flashMicStep2 = "The second step in the Settings window select 'Allow' and check the 'Remember'"; this.talkback_flashMicStep3 = "Close the settings and restart the intercom"; this.bufferTimeDesc = "Description:It's mainly used for the adjustment of video lazy load. When the video buffers the minimum buffer time(defaults to 2 seconds) of video," + " then it will play the video. When the video buffers the maximum buffer time(defaults to 6 seconds) of video, then it will play the video fast-forward."; this.minBufferTime = "Minimun Buffer Time:"; this.maxBufferTime = "Maximun Buffer Time:"; this.vedioStatus = "Select window play status"; this.vedioEventStart = 'Select event: selected Window '; this.vedioEventEnd = ' '; this.vedioPlay = "The currently selected window is Playing video now"; this.vedioNoPlay = "There is no video playback in the current selected window"; this.playbackDesc = "For h5 player, if isVodMode is configured as true when initializing, there can be a playback toolbar and drag operation can be performed. The h5 player can also support multi-channel synchronous playback startVodM(url, \"0,1,2,3\"), and the device needs to support multi-channel synchronous playback. The second parameter \"0,1,2,3\" Indicates the playback channel"; this.talkbackDesc = "h5 player, https can talk directly; for http talk, you need to download and install the PCM audio collection tool. The h5 player judges by the onTtxVideoMsg message callback. type=isTalking means the intercom is in progress, type=showDownLoadDialog means the pcm collection tool needs to be downloaded"; this.downPcmToolBtn = "Download Pcm Tool"; this.singleChannel = 'Single channel playback' this.multiChannel = 'Multi-channel simultaneous playback' this.multiChannelUnSync = 'Multi-channel unsyn playback' this.getPlaybackLink = 'Get playback link' this.deviceNoError = 'Device Number Error' } function getUrlParameter(name) { if (location.search == '') { return ''; } var o = {}; var search = location.search.replace(/\?/, '');//只替换第一个问号,如果参数中带有问号,当作普通文本 var s = search.split('&'); for (var i = 0; i < s.length; i++) { o[s[i].split('=')[0]] = s[i].split('=')[1]; } return o[name] == undefined ? '' : o[name]; } function setText(domId, val) { var domItem = document.getElementById(domId); if (domItem != null) { domItem.innerHTML = val; } } function setValue(domId, val) { var domItem = document.getElementById(domId); if (domItem != null) { domItem.value = val; } } function getValue(domId) { var domItem = document.getElementById(domId); if (domItem != null) { return domItem.value; } else { return ""; } } function setFocus(domId) { var domItem = document.getElementById(domId); if (domItem != null) { domItem.focus(); } } function loadLang() { document.title = lang.videoExample; setText('h5Example', lang.h5Example); setText('descTitle', lang.videoDesc); setText('getJsessionTitle', lang.geSessionId); setText('accountTitle', lang.userId); setText('passwordTitle', lang.password); setText('userLoginBtn', lang.login); setText('isPlay', lang.vedioStatus); setText('videoInitTitle', lang.videoInit); setText('videoInitBtn', lang.videoInit); setText('videoLangTitle', lang.videoLang); setText('videoWidthTitle', lang.videoWidth); setText('videoHeightTitle', lang.videoHeight); setText('vodModeTitle', lang.vodModeTitle); var objOption = document.createElement("OPTION"); objOption.value = "0"; objOption.text = lang.realMode; document.getElementById("vodMode").add(objOption); objOption = document.createElement("OPTION"); objOption.value = "1"; objOption.text = lang.vodMode; document.getElementById("vodMode").add(objOption); document.getElementById("vodMode").value = "0"; setText('windowNumberTitle', lang.windowNumber); setText('videoLiveTitle', lang.videoLive); setText('videoTitleTitle', lang.title); setText('videoStreamTitle', lang.stream); setText('videoPlayBtn', lang.play); setText('videoResetBtn', lang.reset); setText('monitorTitle', lang.monitor); setText('monitorBtn', lang.monitor); setText('talkbackTitle', lang.talkback); setText('talkbackBtn', lang.talkback); setText('playbackTitle', lang.playback); setText('urlTitle', lang.url); setText('urlTitle2', lang.url); setText('urlTitle3', lang.url); setText('playbackBtn', lang.playback); setText('bufferTimeDesc', lang.bufferTimeDesc); setText('minBufferTimeTitle', lang.minBufferTime); setText('maxBufferTimeTitle', lang.maxBufferTime); setText('aServerIp', lang.serverIp); setText('aServerPort', lang.serverPort); setText('settings', lang.settings); setText('windowIndex', lang.windowIndex); setText('jsessionId', lang.jsession); setText('realDevIdnoTitle', lang.devIdno); setText('listenDevIdnoTitle', lang.devIdno); setText('talkDevIdnoTitle', lang.devIdno); setText('playbackDevIdnoTitle', lang.devIdno); setText('realDevChannelTitle', lang.channel); setText('listenDevChannelTitle', lang.channel); setText('stop', lang.stop); setText('playbackDesc', lang.playbackDesc); setText('talkbackDesc', lang.talkbackDesc); setText('setLangBtn', lang.settings); setText('setServerBtn', lang.settings); setText('setWndBtn', lang.settings); setText('initBtn', lang.settings); setText('setTitleBtn', lang.settings); setText('setBufferBtn', lang.settings); setText('videoStopBtn', lang.stop); setText('monitorStopBtn', lang.stop); setText('talkStopBtn', lang.stop); setText('playbackStopBtn', lang.stop); setText('downPcmToolBtn', lang.downPcmToolBtn); setText('playbackChannelTitle', lang.channel); setText('playbackTypeSpan1', lang.singleChannel) setText('playbackTypeSpan2', lang.multiChannel) setText('playbackTypeSpan3', lang.multiChannelUnSync) } function onReady() { var host = window.location.host; var ip = host.split(":")[0]; if (!ip || ip == 'localhost') { ip = '127.0.0.1'; } setValue('serverIp', ip); setValue('serverPort', 6605); var strLang = getUrlParameter('lang'); if (strLang == "en") { lang = new langEn(); setValue('languagePath', 'en.xml'); } loadLang(); //初始化视频插件 initPlayerExample(); } //初始化视频插件 function initPlayerExample() { for (var i = 0; i < 101; i++) { playingStatusArray.push(false); } var _isVodMode = getValue('vodMode'); //赋值初始化为未完成 isInitFinished = false; //视频插件宽度 var width = getValue('playerWidth'); if (width == '') { setFocus('playerWidth'); return; } //视频插件高度 var hieght = getValue('playerHeight'); if (hieght == '') { setFocus('playerHeight'); return; } var strLang = getUrlParameter('lang'); var options = { domId: "cmsv6flash", isVodMode: _isVodMode == "1" ? true : false, width: width, height: hieght, lang: strLang == "" ? "en" : strLang } swfobject = new Cmsv6Player(options); initFlash(); } //插件初始化完成后执行 function initFlash() { if (typeof swfobject == "undefined" || typeof swfobject.setWindowNum == "undefined") { setTimeout(initFlash, 50); } else { //初始化插件语言 var language = getValue('languagePath'); if (!language) { return; } swfobject.setLanguage(language); //先将全部窗口创建好 swfobject.setWindowNum(36); //再配置当前的窗口数目 var windowNum = getValue('windowNumber'); if (windowNum == '') { setFocus('windowNumber'); return; } swfobject.setWindowNum(windowNum); //设置服务器信息 var serverIp = getValue('serverIp'); if (!serverIp) { setFocus('serverIp'); return; } var serverPort = getValue('serverPort'); if (!serverPort) { setFocus('serverPort'); return; } swfobject.setServerInfo(serverIp, serverPort); isInitFinished = true; // 监听回放Radio monitorPlaybackRadio() } } //设置视频插件窗口数量 function setVideoWindowNumber() { if (!isInitFinished) { return; } else { //窗口数目 var windowNum = getValue('windowNumber'); if (windowNum == '') { setFocus('windowNumber'); return; } swfobject.setWindowNum(windowNum); } } //设置视频插件服务器信息 function setVideoServer() { if (!isInitFinished) { return; } else { //服务器信息 var serverIp = getValue('serverIp'); if (!serverIp) { setFocus('serverIp'); return; } var serverPort = getValue('serverPort'); if (!serverPort) { setFocus('serverPort'); return; } swfobject.setServerInfo(serverIp, serverPort); } } //设置视频插件语言 function setVideoLanguage() { if (!isInitFinished) { return; } else { //语言文件 var language = getValue('languagePath'); if (!language) { setFocus('languagePath'); return; } swfobject.setLanguage(language); } } //设置窗口标题 function setWindowTitle() { if (!isInitFinished) { return; } else { //窗口下标 var index = getValue('liveVideoIndex'); if (index == '') { setFocus('liveVideoIndex'); return; } //标题 var title = getValue('liveWindowTitle'); swfobject.setVideoInfo(index, title); } } //播放实时视频 function playLiveVideo() { if (!isInitFinished) { return; } //窗口下标 var index = getValue('liveVideoIndex'); if (index == '') { setFocus('liveVideoIndex'); return; } //jsession会话号 var jsession = getValue('liveJsession'); if (jsession == '') { setFocus('liveJsession'); return; } //设备号 var devIdno = getValue('liveDevIdno'); if (devIdno == '') { setFocus('liveDevIdno'); return; } //通道号 var channel = getValue('liveChannel'); if (channel == '') { setFocus('liveChannel'); return; } //码流 var stream = getValue('liveStream'); if (stream == '') { setFocus('liveStream'); return; } //最小缓冲时长 var minBufferTime = getValue('minBufferTime'); if (minBufferTime != '') { swfobject.setBufferTime(index, minBufferTime); } //最大缓冲时长 var maxBufferTime = getValue('maxBufferTime'); if (maxBufferTime != '') { swfobject.setBufferTimeMax(index, maxBufferTime); } //先停止视频窗口 swfobject.stopVideo(index); //设置窗口标题 var title = getValue('liveWindowTitle'); swfobject.setVideoInfo(index, title); //播放视频 swfobject.startVideo(index, jsession, devIdno, channel, stream, true); } //停止视频窗口播放视频窗口 function stopLiveVideo() { if (!isInitFinished) { return; } else { //窗口下标 var index = getValue('liveVideoIndex'); if (index == '') { setFocus('liveVideoIndex'); return; } swfobject.stopVideo(index); } } //重置实时视频窗口 function reSetLiveVideo() { if (!isInitFinished) { return; } else { //窗口下标 var index = getValue('liveVideoIndex'); if (index == '') { setFocus('liveVideoIndex'); return; } swfobject.reSetVideo(index); } } //开始监听 function startMonitor() { if (!isInitFinished) { return; } else { //会话号 var jsession = getValue('liveJsession'); if (jsession == '') { setFocus('monitorJsession'); return; } //设备号 var devIdno = getValue('monitorDevIdno'); if (devIdno == '') { setFocus('monitorDevIdno'); return; } //通道号 var channel = getValue('monitorChannel'); if (channel == '') { setFocus('monitorChannel'); return; } swfobject.setListenParam(1); swfobject.startListen(jsession, devIdno, channel); } } //停止监听 function stopMonitor() { if (!isInitFinished) { return; } else { swfobject.stopListen(); } } //开始对讲 function startTalkback() { if (!isInitFinished) { return; } else { //会话号 var jsession = getValue('liveJsession'); if (jsession == '') { setFocus('talkbackJsession'); return; } //设备号 var devIdno = getValue('talkbackDevIdno'); if (devIdno == '') { setFocus('talkbackDevIdno'); return; } swfobject.setTalkParam(1); var ret = swfobject.startTalkback(jsession, devIdno, 0); //flash播放器通过startTalkback返回值判断来判断, h5播放器通过 onTtxVideoMsg 消息回调来判断 type=isTalking表示正在对讲中,type=showDownLoadDialog表示需要下载pcm采集工具 //返回 0成功,1表示正在对讲,2表示没有mic,3表示禁用了mic if (ret == 0) { } else if (ret == 1) { } else if (ret == 2) { alert(lang.nullMic); } else if (ret == 3) { //alert(lang.micStop); alert(lang.talkback_openMic); } else { } //flash end } } //停止对讲 function stopTalkback() { if (!isInitFinished) { return; } else { swfobject.stopTalkback(); } } // 开始远程回放 function startPlayback() { if (!isInitFinished) { return; } else { //回放url var url = getValue('playbackUrl'); if (url == '') { setFocus('playbackUrl'); return; } //flash begin ----- //回放之前先停止 //swfobject.getObjectById('cmsv6flash').stopVideo(0); //开始回放 //swfobject.getObjectById("cmsv6flash").startVod(0, url); //flash end ------ //h5 begin ----- //回放之前先停止 swfobject.stopVodM(); var playbackChannelCount = 0 var playbackChannelObj = document.getElementById("playbackChannel") if (playbackChannelObj) { playbackChannelCount = playbackChannelObj.value } var playbackUrlObj2 = document.getElementById('playbackUrl2') var playbackUrlObj3 = document.getElementById('playbackUrl2') var urls = [] if (playbackUrlObj2.value) { urls.push(playbackUrlObj2.value) if (playbackUrlObj3.value) { urls.push(playbackUrlObj3.value) } } if (document.getElementById('playbackType3').checked) { urls.push(url) //开始回放 swfobject.startVodM(urls, ""); } else { swfobject.startVodM(url, playbackChannelCount); } //h5 end ------ } } function monitorPlaybackRadio() { document.getElementById("playbackRadio").addEventListener("click", function (e) { if (e.target.tagName === "INPUT") { var playbackChannelObj = document.getElementById("playbackChannel") var playbackChannelObj2 = document.getElementById("playbackChannel2") var playbackChannelObj3 = document.getElementById("playbackChannel3") switch (e.target.value) { case "1": playbackChannelObj.value = "0" playbackChannelObj.disabled = 'disabled' playbackChannelObj2.style.display = 'none' playbackChannelObj3.style.display = 'none' break case "2": playbackChannelObj.value = "0,1,2" playbackChannelObj.disabled = '' playbackChannelObj2.style.display = 'none' playbackChannelObj3.style.display = 'none' break case "3": playbackChannelObj.value = "" playbackChannelObj.disabled = 'disabled' playbackChannelObj2.style.display = '' playbackChannelObj3.style.display = '' break } } }) } //停止远程回放 function stopPlayback() { if (!isInitFinished) { return; } else { //flash begin ----- //swfobject.getObjectById("cmsv6flash").stopVideo(0); //flash end ------ //h5 begin ----- swfobject.stopVodM(); //h5 end ------ } } var channel = '' function getPlaybackLink() { var serverIp = getValue('serverIp'); if (!serverIp) { setFocus('serverIp'); return; } var serverPort = getValue('serverPort'); if (!serverPort) { setFocus('serverPort'); return; } var devIdno = getValue('playbackDevIdno'); if (!devIdno) { setFocus('playbackDevIdno'); return; } var jsession = getValue('liveJsession'); if (!jsession) { setFocus('liveJsession'); return; } var _url = location.protocol + '//' + window.location.host + '/StandardApiAction_getVideoFileInfo.action?DevIDNO=' + devIdno + '&LOC=1&CHN=0&YEAR=2014&MON=12&DAY=10&RECTYPE=-1&FILEATTR=2&BEG=0&END=86399&ARM1=0&ARM2=0&RES=0&STREAM=0&STORE=0&jsession=' + jsession ajax({ type: 'POST', url: _url, cache: false, dataType: 'json', success: function (data) { if (data.result == 0) { var files = data.files if (files.length > 0) { var firstFile = files[0] if (firstFile.PlaybackUrlWs) { setValue('playbackUrl', firstFile.PlaybackUrlWs) } else { setValue('playbackUrl', firstFile.PlaybackUrl) } var secondFile = files[1] if (secondFile && secondFile.PlaybackUrlWs) { var playbackUrlObj2 = document.getElementById('playbackUrl2') playbackUrlObj2.value = secondFile.PlaybackUrlWs } var thirdFile = files[2] if (thirdFile && thirdFile.PlaybackUrlWs) { var playbackUrlObj3 = document.getElementById('playbackUrl3') playbackUrlObj3.value = thirdFile.PlaybackUrlWs } } } else if (data.result === 32) { alert(lang.deviceNoError) setFocus('playbackDevIdno'); } else { alert(lang.loginError); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { try { if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown); } catch (e) { } alert(lang.loginError); } }) } function downPcmTool() { window.open('/product/CMSV6PcmTool/CMSV6PcmTool.exe'); } function ajax() { var ajaxData = { type: arguments[0].type || "GET", url: arguments[0].url || "", async: arguments[0].async || "true", data: arguments[0].data || null, dataType: arguments[0].dataType || "text", contentType: arguments[0].contentType || "application/x-www-form-urlencoded", beforeSend: arguments[0].beforeSend || function () { }, success: arguments[0].success || function () { }, error: arguments[0].error || function () { } } ajaxData.beforeSend() var xhr = createxmlHttpRequest(); xhr.responseType = ajaxData.dataType; xhr.open(ajaxData.type, ajaxData.url, ajaxData.async); xhr.setRequestHeader("Content-Type", ajaxData.contentType); xhr.send(convertData(ajaxData.data)); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { ajaxData.success(xhr.response) } else { ajaxData.error() } } } } function createxmlHttpRequest() { if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { return new XMLHttpRequest(); } } function convertData(data) { if (typeof data === 'object') { var convertResult = ""; for (var c in data) { convertResult += c + "=" + data[c] + "&"; } convertResult = convertResult.substring(0, convertResult.length - 1) return convertResult; } else { return data; } } //用户登录 function userLogin() { //用户名 var account = getValue('account'); if (account == '') { setFocus('account'); return; } //密码 var password = getValue('userPassword'); if (password == '') { setFocus('userPassword'); return; } var _url = location.protocol + '//' + window.location.host + '/StandardApiAction_login.action?account=' + account + "&password=" + password; ajax({ type: 'POST', url: _url, cache: false, dataType: 'json', success: function (data) { if (data.result == 0) { setValue('liveJsession', data.jsession); } else { alert(lang.loginError); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { try { if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown); } catch (e) { } alert(lang.loginError); } }); } //设置缓冲时长 function setBufferInfo() { if (!isInitFinished) { return; } else { //窗口下标 var index = getValue('liveVideoIndex'); if (index == '') { setFocus('liveVideoIndex'); return; } //最小缓冲时长 var minBufferTime = getValue('minBufferTime'); //最大缓冲时长 var maxBufferTime = getValue('maxBufferTime'); if (minBufferTime == '' && maxBufferTime == '') { return; } if (maxBufferTime != '') { swfobject.setBufferTimeMax(index, maxBufferTime); } if (minBufferTime != '') { swfobject.setBufferTime(index, minBufferTime); } } } function onTtxVideoMsg(index, type) { if (index != null && index != "") { index = parseInt(index, 10); } //窗口事件 //window message if (type == "select") { //选中窗口 select window selectIndex = index; $('#eventTip', lang.vedioEventStart + (index + 1) + lang.vedioEventEnd); } else if (type == "full") { //全屏 Full screen } else if (type == "norm") { //退出全屏 Exit full screen } //视频播放事件 //video play messsage else if (type == "stop") { //停止播放 stop playing playingStatusArray[index] = false; } else if (type == "start") { //开始播放 Start play playingStatusArray[index] = true; } else if (type == "sound") { //开启声音 Turn on the sound } else if (type == "silent") { //静音 Mute } else if (type == "play") { //暂停或停止后重新播放 Play again after pause or stop } else if (type == "PicSave") { //截图 screenshot } //对讲事件 //Intercom messsage else if (type == "startRecive" || type == "uploadRecive" || type == "loadRecive") { //开启对讲 Open intercom } else if (type == "stopTalk") { //关闭对讲 Turn off intercom } else if (type == "playRecive") { //对讲中 Talkback } else if (type == "reciveStreamStop" || type == "reciveNetError" || type == "reciveStreamNotFound") { //对讲异常(网络异常等) Talkback anomalies (network exceptions, etc.) } else if (type == "uploadNetClosed" || type == "uploadNetError") { //连接异常 Connection exception } else if (type == "upload") { //对讲讲话 Talkback speech } else if (type == "uploadfull") { //对讲讲话结束 Talkback speech ends } //监听事件 //Listen messsage else if (type == "startListen") { //开始监听 Start listening } else if (type == "stopListen") { //主动停止监听 Active stop monitoring } else if (type == "listenNetError") { //网络异常 Network anomaly } else if (type == "playListen") { //监听中 In listening } else if (type == "loadListen" || type == "listenStreamNotFound" || type == "listenStreamStop") { //等待请求监听 Waiting request monitoring } else if (type == 'showDownLoadDialog') { alert("down pcm tool"); downPcmTool(); } else if (type == 'isTalking') { alert("is talking"); } } var selectIndex = 0; var playingStatusArray = []; //判断当前选择窗口是否播放状态 function checkIsPlaying() { if (playingStatusArray[selectIndex]) { alert(lang.vedioPlay); } else { alert(lang.vedioNoPlay); } }