(this.webpackJsonp=this.webpackJsonp||[]).push([["w41m"],{w41m:function(e,t,o){"use strict";!function(t,o){"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?o(t,!0):function(e){if(!e.document)throw new Error("EZUIPlayer requires a window with a document");return o(e)}:o(t)}("undefined"!=typeof window?window:void 0,function(e,t){function o(e,t){for(var o=document.getElementsByTagName("head")[0].getElementsByTagName("script"),a=!1,i=0;i0&&(e+="&controls="+t.controls.join(","))),t.websocketParams&&(e+="&websocketParams="+JSON.stringify(t.websocketParams)),e;case"standard":return n+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+l.opt.url+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=1&id="+c;case"security":return n+"/ezopen/h5/iframe_se?bSupporDoubleClickFull=0&url="+l.opt.url+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=0&id="+c;default:return n+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+l.opt.url+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=0&id="+c}}();var p=document.getElementById(c).offsetHeight,u=document.getElementById(c).offsetWidth;t.height&&(p=parseInt(t.height)),t.width&&(u=parseInt(t.width)),d.width=u,d.height=p,d.id="EZUIKitPlayer-"+c,d.setAttribute("allowfullscreen",!0),d.setAttribute("allow","autoplay"),d.setAttribute("frameborder",0),r.appendChild(d);o(l.opt.filePath+"/js/jquery.js",function(){o("https://open.ys7.com/assets/layer/layer.js",function(){if(g().headerContainer){var s=document.createElement("div");s.setAttribute("class","panel-top");var c=document.createElement("div");if(c.setAttribute("class","contros"),s.appendChild(c),r.insertBefore(s,d),g().capturePictureModule){var p=document.createElement("span");p.innerHTML=' ',p.onclick=function(){l.capturePicture()},c.appendChild(p)}if(console.log("matchHeaderOpt().saveModule",g().saveModule),g().saveModule){var u=document.createElement("span");u.innerHTML=' ',u.onclick=function(){l.startSave(),document.getElementById("startSave").setAttribute("class","icon hide"),document.getElementById("stopSave").setAttribute("class","icon")},c.appendChild(u);var m=document.createElement("span");m.innerHTML=' ',m.onclick=function(){l.stopSave(),document.getElementById("stopSave").setAttribute("class","icon hide"),document.getElementById("startSave").setAttribute("class","icon")},c.appendChild(m)}if(g().zoomModule){var h=document.createElement("span");h.innerHTML=' ',h.onclick=function(){l.enableZoom(),document.getElementById("enableZoom").setAttribute("class","icon hide"),document.getElementById("closeZoom").setAttribute("class","icon")},c.appendChild(h);var f=document.createElement("span");f.innerHTML=' ',f.onclick=function(){l.closeZoom(),document.getElementById("closeZoom").setAttribute("class","icon hide"),document.getElementById("enableZoom").setAttribute("class","icon")},c.appendChild(f)}}function v(){var e={footerContainer:!1,talkModule:!1,broadcastModule:!1,hdModule:!1,fullScreenModule:!1};switch(l.opt.template){case"simple":case"standard":var o;if(t.footer&&t.footer instanceof Array)e={footerContainer:!0,talkModule:-1!==(o=t.footer).indexOf("talk"),broadcastModule:-1!==o.indexOf("broadcast"),hdModule:-1!==o.indexOf("hd"),fullScreenModule:-1!==o.indexOf("fullScreen")};break;case"security":break;case"voice":e={footerContainer:!0,talkModule:!0,broadcastModule:!0,hdModule:!0,fullScreenModule:!0}}return e}function g(){var e={headerContainer:!1,capturePictureModule:!1,saveModule:!1,zoomModule:!1};switch(l.opt.template){case"simple":if(t.header&&t.header instanceof Array){var o=t.header;e={headerContainer:!0,capturePictureModule:-1!==o.indexOf("capturePicture"),saveModule:-1!==o.indexOf("save"),zoomModule:-1!==o.indexOf("zoom")}}break;case"standard":case"security":break;case"voice":e={headerContainer:!0,capturePictureModule:!0,saveModule:!0,zoomModule:!0}}return e}if(v().footerContainer||-1!==l.opt.plugin.indexOf("talk")){var y=l.opt.filePath+"/npm/css/recoder.css",w=l.opt.filePath+"/npm/js/recoder.js",k=l.opt.filePath+"/recorder.js";if(function(e,t){for(var o=document.getElementsByTagName("head")[0].getElementsByTagName("link"),a=!1,i=0;i{l.opt.videoLoading=!1,-1===l.opt.url.indexOf(".hd")?(l.opt.url=l.opt.url.replace(".live",".hd.live"),M.innerHTML=-1===l.opt.url.indexOf(".hd")?"标清":"高清"):(l.opt.url=l.opt.url.replace(".hd.live",".live"),M.innerHTML=-1===l.opt.url.indexOf(".hd")?"标清":"高清"),l.play(l.opt.url)}).catch(e=>{console.log("error",e)})},b.appendChild(M)}if(v().fullScreenModule){var E=document.createElement("span");E.setAttribute("class","hide"),E.setAttribute("id","ezuikit-open-sound"),E.setAttribute("title","打开声音"),E.setAttribute("style","vertical-align: top;"),E.innerHTML='',E.onclick=function(){l.openSound(0),E.setAttribute("class","hide"),T.setAttribute("class","")};var T=document.createElement("span");E.setAttribute("id","ezuikit-close-sound"),T.setAttribute("class","hide"),T.setAttribute("title","关闭声音"),T.setAttribute("style","vertical-align: top;"),T.innerHTML='',T.onclick=function(){l.closeSound(0),E.setAttribute("class",""),T.setAttribute("class","hide")},b.appendChild(E),b.appendChild(T)}if(1==l.opt.audio?T.setAttribute("class",""):(E.setAttribute("class",""),l.closeSound(0)),v().fullScreenModule){var z=document.createElement("span");z.setAttribute("title","全屏"),z.setAttribute("style","vertical-align: top;"),z.innerHTML=' ',z.onclick=function(){l.fullScreen()},b.appendChild(z)}}if(v().talkModule){var I=document.createElement("div"),B=document.createElement("div");I.setAttribute("class","ptp-talk off"),I.innerHTML=' 开启对讲',I.onclick=function(){if(console.log("EZUIKit.state.countTimer",i.state.countTimer),i.state.countTimer)return e.layer.msg("语音设备正忙,请稍后重试"),!1;O("add",0),console.log("开始对讲,关闭声音"),l.closeSound(0),console.log(l.opt),l.startTalk(),this.setAttribute("class","ptp-talk off hide"),B.setAttribute("class","ptp-talk on")},B.setAttribute("class","ptp-talk on hide"),B.innerHTML=' 关闭对讲',B.onclick=function(){console.log(l.opt),l.stopTalk(),O("destory",0),l.openSound(0),this.setAttribute("class","ptp-talk on hide"),I.setAttribute("class","ptp-talk off")},S.appendChild(I),S.appendChild(B)}if(v().broadcastModule){var C=document.createElement("div"),A=document.createElement("div");function x(e){a(n+"/api/lapp/voice/query","POST",{accessToken:l.opt.accessToken,pageStart:e,pageSize:i.state.pageSize,default:i.state.fetchDefaultList?"true":"false"},0,function(t){console.log("data",t),200==t.code&&(function(e){if(console.log("renderVoliceList",e),e&&e.length>0){for(var t=0;t"+(e[t].voiceName.length>10?e[t].voiceName.substr(0,10)+"...":e[t].voiceName)+"",document.getElementsByClassName("voice-list-ul")[0].append(o),o.onclick=function(e){console.log("点击元素",e.target,e.target.dataset.url);var t=e.target.dataset.url,o=e.target.dataset.time;P(t,o)}}e.length===i.state.pageSize?document.getElementById("voice-list-end").innerHTML="向下滚动加载更多":document.getElementById("voice-list-end").innerHTML="没有更多数据了"}}(t.data),i.state.page=t.page.page,0!=e||0!=t.data.length||i.state.fetchDefaultList||(i.state.fetchDefaultList=!0,x(0)))})}function P(t,o){console.log("播放语音",t,o),a(n+"/api/lapp/voice/send","POST",{accessToken:l.opt.accessToken,deviceSerial:l.opt.deviceSerial,channelNo:l.opt.channelNo,fileUrl:t},0,function(t){console.log("data.data",t.data),200==t.code?O("sub",parseInt(o)):"10001"==t.code?e.layer.msg("未找到当前语音"):e.layer.msg(t.msg||"发送失败,请稍后再试")})}C.setAttribute("class","broadcast off"),A.setAttribute("class","broadcast on hide"),C.innerHTML=' 语音播报',C.onclick=function(){this.setAttribute("class","broadcast off hide"),A.setAttribute("class","broadcast on")},A.innerHTML='
自定义语音
语音播报',A.onclick=function(){this.setAttribute("class","broadcast on hide"),C.setAttribute("class","broadcast off")},S.appendChild(C),S.appendChild(A),document.getElementById("voice-custom").onclick=function(){console.log("显示自定义语音"),H.setAttribute("class","speak off")},x(0);var H=document.createElement("div"),L=document.createElement("div");H.setAttribute("class","speak off hide"),L.setAttribute("class","speak on hide"),H.setAttribute("id","startSpeak"),L.setAttribute("id","stopSpeak"),H.innerHTML=' 按住说话',L.innerHTML=' 松开发送',S.appendChild(H),S.appendChild(L),document.getElementById("voice-list").onscroll=function(e){var t=this.scrollHeight;console.log("sum",t,this.scrollTop,document.getElementById("voice-list").clientHeight),t<=this.scrollTop+this.clientHeight&&(console.log("拖动到底,执行加载",i.state.page),x(++i.state.page))};var U,Z=document.createElement("div");Z.setAttribute("class","time-area"),Z.setAttribute("id","time-area"),Z.innerHTML="00:00",S.appendChild(Z),document.getElementById("startSpeak").onmousedown=function(){if(i.state.countTimer)return e.layer.msg("语音设备正忙,请稍后重试"),!1;var t;function o(o){var a=t.createMediaStreamSource(o);U=new e.Recorder(a)}console.log("按住说话"),H.setAttribute("class","speak off hide"),L.setAttribute("class","speak on"),function(){console.log("run init");try{e.AudioContext=e.AudioContext||e.webkitAudioContext,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia,e.URL=e.URL||e.webkitURL,t=new AudioContext,console.log("Audio context set up."),console.log("navigator.getUserMedia "+(navigator.getUserMedia?"available.":"not present!"))}catch(t){console.log("err",t),e.layer.msg("No web audio support in this browser!")}navigator.getUserMedia({audio:!0},o,function(e){console.log("No live audio input: "+e)})}(),O("add",0),setTimeout(function(){i.state.recodeTime=0,U&&U.record()},1e3),i.state.recodeTimer&&clearInterval(i.state.recodeTimer),i.state.recodeTimer=setInterval(function(){i.state.recodeTime>=59?(l.stopTalk(),O("destory",0),this.setAttribute("class","ptp-talk on hide"),I.setAttribute("class","ptp-talk off"),e.layer.msg("不超过1分钟")):i.state.recodeTime=i.state.recodeTime+1},1e3)},document.getElementById("stopSpeak").onmouseup=function(){console.log("松开发送"),L.setAttribute("class","speak on hide"),function(){if(O("destory",0),i.state.recodeTime<1)return e.layer.msg("说话时间过短"),clearInterval(i.state.recodeTimer),!1;clearInterval(i.state.recodeTimer),function(){try{U&&U.stop(),U&&U.exportWAV(function(t){if(console.log("wav_file",t),t.size<1e3)return e.layer.msg("录音失败,请重试"),i.state.recodeTime=0,!1;O("sub",i.state.recodeTime+2);var o=new FormData;o.append("voiceFile",t),o.append("accessToken",l.opt.accessToken),o.append("deviceSerial",l.opt.deviceSerial),o.append("channelNo",l.opt.channelNo),a(n+"/api/lapp/voice/sendonce","POST",{voiceFile:t,accessToken:l.opt.accessToken,deviceSerial:l.opt.deviceSerial,channelNo:l.opt.channelNo},0,function(t){console.log("data.data",t.data),200==t.code?O("sub",i.state.recodeTime+2):"10001"==t.code?e.layer.msg("未找到当前语音"):e.layer.msg(t.msg||"发送失败,请稍后再试")})}),U&&U.clear()}catch(e){console.log(e)}}()}()}}function O(e,t){if(clearInterval(i.state.countTimer),"add"===e){var o=t;i.state.countTimer=setInterval(function(){++o,document.getElementById("time-area").innerHTML=a(o)},1e3)}else if("sub"===e){o=t;i.state.countTimer=setInterval(function(){o>0?(o--,document.getElementById("time-area").innerHTML=a(o)):(clearInterval(i.state.countTimer),i.state.countTimer=void 0,console.log("倒计时结束,开启声音"))},1e3)}else"destory"===e&&(clearInterval(i.state.countTimer),i.state.countTimer=void 0,document.getElementById("time-area").innerHTML="00:00");function a(e){var t,o,a,i=parseInt(e),n=0,s=0;return i>59&&(n=parseInt(i/60),i=parseInt(i%60),n>59&&(s=parseInt(n/60),n=parseInt(n%60))),t=parseInt(i)>9?parseInt(i):"0"+parseInt(i),o=parseInt(n)>9?parseInt(n):"0"+parseInt(n),a=parseInt(s)>9?parseInt(s):"0"+parseInt(s),s>0?a+":"+o+":"+t:n>0?o+":"+t:"00:"+t}}}}})});l=this;e.addEventListener("message",function(e){console.log("EZUIKitPlayer收到反馈",e);e.origin;var o=l.opt.id;if(e.data.type)switch(e.data.type){case"openSound":o==e.data.id&&t.openSoundCallBack&&t.openSoundCallBack(e.data);break;case"closeSound":o==e.data.id&&t.closeSoundCallBack&&t.closeSoundCallBack(e.data);break;case"capturePicture":o==e.data.id&&t.capturePictureCallBack&&t.capturePictureCallBack(e.data);break;case"startSave":o==e.data.id&&t.startSaveCallBack&&t.startSaveCallBack(e.data);break;case"stopSave":o==e.data.id&&t.stopSaveCallBack&&t.stopSaveCallBack(e.data);break;case"fullScreen":o==e.data.id&&t.fullScreenCallBack&&t.fullScreenCallBack(e.data);break;case"getOSDTime":o==e.data.id&&t.getOSDTimeCallBack&&t.getOSDTimeCallBack(e.data);break;case"handleSuccess":o==e.data.id&&t.handleSuccess&&t.handleSuccess(e.data);break;case"handleError":o==e.data.id&&t.handleError&&t.handleError(e.data);break;case"dblclick":o==e.data.id&&l.opt.bSupporDoubleClickFull&&(0===l.opt.fullScreenStatus?l.fullScreen():l.cancelFullScreen())}})};return l.prototype.play=function(t){var o="EZUIKitPlayer-"+this.opt.id,a=document.getElementById(o).contentWindow;"object"==typeof t&&t.url&&(this.opt.url=t.url),"object"==typeof t&&t.accessToken&&(this.opt.accessToken=t.accessToken),"string"==typeof t&&(this.opt.url=t),a.postMessage({action:"play",accessToken:this.opt.accessToken,url:this.opt.url},n+"/ezopen/h5/iframe");var i=this;return this.opt.videoLoading=!0,new Promise(function(t,o){e.addEventListener("message",function(e){i.opt.id==e.data.id&&"handleSuccess"===e.data.type&&(setTimeout(()=>{i.opt.videoLoading=!1},1e3),t(e.data))})})},l.prototype.stop=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("stop",n+"/ezopen/h5/iframe");var o=this;return new Promise(function(t,a){e.addEventListener("message",function(e){o.opt.id==e.data.id&&"stop"===e.data.type&&t(e.data)})})},l.prototype.openSound=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("openSound",n+"/ezopen/h5/iframe");var o=this;return new Promise(function(t,a){e.addEventListener("message",function(e){o.opt.id==e.data.id&&"openSound"===e.data.type&&t(e.data)})})},l.prototype.closeSound=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("closeSound",n+"/ezopen/h5/iframe");var o=this;return new Promise(function(t,a){e.addEventListener("message",function(e){o.opt.id==e.data.id&&"closeSound"===e.data.type&&t(e.data)})})},l.prototype.startSave=function(t){var o="EZUIKitPlayer-"+this.opt.id;document.getElementById(o).contentWindow.postMessage({action:"startSave",fileName:t||"default"},n+"/ezopen/h5/iframe");var a=this;return new Promise(function(t,o){e.addEventListener("message",function(e){a.opt.id==e.data.id&&"startSave"===e.data.type&&t(e.data)})})},l.prototype.stopSave=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("stopSave",n+"/ezopen/h5/iframe");var o=this;return new Promise(function(t,a){e.addEventListener("message",function(e){o.opt.id==e.data.id&&"stopSave"===e.data.type&&t(e.data)})})},l.prototype.fullScreen=function(){if(1===this.opt.fullScreenStatus)return!1;var t=this,o="EZUIKitPlayer-"+this.opt.id,a=document.getElementById(o).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var i=document.documentElement.clientWidth,s=document.documentElement.clientHeight,l=(document.body,"");l+="width:"+s+"px;",l+="height:"+i+"px;",l+="-webkit-transform: rotate(90deg); transform: rotate(90deg);",l+="-webkit-transform-origin: "+i/2+"px "+i/2+"px;",l+="transform-origin: "+i/2+"px "+i/2+"px;",l+="position: fixed;top: 0;left: 0;z-index:10",document.getElementById(o).style.cssText=l;var c=document.createElement("div");c.id=o+"cancel-full-screen";var r="width:30px;height:"+s+"px;z-index:1000;position:fixed;top:0px;right:0px;";r+="background-image: url(https://resource.ys7cloud.com/group1/M00/00/7E/CtwQE1-01qeAH2wAAAABOliqQ5g167.png);",r+="background-size: contain;background-repeat:no-repeat;background-color:rgba(0,0,0,0.2)",c.style=r,c.onclick=function(){t.cancelFullScreen()},document.body.appendChild(c),setTimeout(function(){a.postMessage("autoResize",n+"/ezopen/h5/iframe")},200)}else{!function(t){var o=t.requestFullScreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullScreen;if(o)o.call(t);else if(void 0!==e.ActiveXObject){var a=new ActiveXObject("WScript.Shell");null!==a&&a.SendKeys("{F11}")}}(document.getElementById(o)),setTimeout(function(){a.postMessage("autoResize",n+"/ezopen/h5/iframe")},200)}this.params.fullScreenCallBack&&this.params.fullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=1},l.prototype.cancelFullScreen=function(){if(0===this.opt.fullScreenStatus)return!1;var e="EZUIKitPlayer-"+this.opt.id,t=document.getElementById(e).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var o=document.getElementById(e).width,a=document.getElementById(e).height,i=(document.body,"");i+="width:"+o+"px;",i+="height:"+a+"px;",i+="-webkit-transform: rotate(0); transform: rotate(0);",i+="-webkit-transform-origin: 0 0;",i+="transform-origin: 0 0;",document.getElementById(e).style.cssText=i,setTimeout(function(){t.postMessage("autoResize",n+"/ezopen/h5/iframe")},200);var s=e+"cancel-full-screen",l=document.getElementById(s);l&&document.body.removeChild(l)}else document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen&&document.mozCancelFullScreen();this.params.cancelFullScreenCallBack&&this.params.cancelFullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=0},l.prototype.capturePicture=function(t,o){var a="EZUIKitPlayer-"+this.opt.id;document.getElementById(a).contentWindow.postMessage({action:"capturePicture",fileName:t||"default",isUndownload:o},n+"/ezopen/h5/iframe");var i=this;return new Promise(function(t,o){e.addEventListener("message",function(e){i.opt.id==e.data.id&&"capturePicture"===e.data.type&&t(e.data)})})},l.prototype.enableZoom=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("enableZoom",n+"/ezopen/h5/iframe")},l.prototype.closeZoom=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("closeZoom",n+"/ezopen/h5/iframe")},l.prototype.getOSDTime=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("getOSDTime",n+"/ezopen/h5/iframe");var o=this;return new Promise(function(t,a){e.addEventListener("message",function(e){o.opt.id==e.data.id&&"getOSDTime"===e.data.type&&t(e.data)})})},l.prototype.autoResize=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("autoResize",n+"/ezopen/h5/iframe")},l.prototype.reSize=function(e,t){var o="EZUIKitPlayer-"+this.opt.id,a=document.getElementById(o).contentWindow,i=document.getElementById(this.opt.id);i.style.width=e+"px",i.style.height=t+"px";var s=document.getElementById(o);s.setAttribute("width",e),s.setAttribute("height",t),setTimeout(function(){a.postMessage({action:"autoResize"},n+"/ezopen/h5/iframe")},200)},l.prototype.startTalk=function(){console.log("执行开始对讲"),console.log(this.opt);var t=this;i.opt=this.opt;a(t.opt.apiDomain,"POST",{accessToken:t.opt.accessToken,deviceSerial:t.opt.deviceSerial,channelNo:t.opt.channelNo},0,function(o){if(200==o.code){var a=o.data;if(a){var i=a.rtcUrl;-1===i.indexOf("ws")&&(i=i.replace("https","wss").replace("rtcgw","rtcgw-ws")),t.opt.rtcUrl=i,t.opt.ttsUrl="tts://"+a.ttsUrl;var n="talk://"+t.opt.deviceSerial+":0:"+t.opt.channelNo+":cas.ys7.com:6500";t.opt.talkLink=t.opt.ttsUrl+"/"+n,t.opt.stream=a.stream,e.startTalk()}}})},l.prototype.stopTalk=function(){console.log("执行结束对讲"),e.stopTalk()},i.EZUIKitPlayer=l,e.EZUIKit=i,t||(e.EZUIKit=i),i})}}]);