!function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t){!function e(){var t="3.7.0",i=function(){return!!(window.ActiveXObject||"ActiveXObject"in window)},n=function(){var e=new Date;return e.getMonth()+"_"+e.getDay()+"_"+e.getHours()+"_"+e.getMinutes()+"_"+e.getSeconds()},o=function(){return 0==h.delay};!function(){function e(e){console.log&&console.log(e)}function i(e){console.warn&&console.warn(e)}function n(e,t){for(var i=e.split("."),n=t.split("."),o=0,a=i.length,r=!1;oc){r=!0;break}if(s=6e4&&(e.isCaton=!1);var t={event:"heartbeat",code:200,blocktimes:e.catonCount,blockduration:e.catonDuration>=6e4?0:e.catonDuration,rid:(new Date).getTime(),num:e.ccTrackCount,heartinter:60,cdn:e.ccTrackCDN};e.catonCount=0,e.catonDuration=0,e.ccTrackTiming=(new Date).getTime(),ccTrack.tragger(t)}catch(e){console.log("ccTrackTimer:",e)}},e.HEART_BEAT)},setUrl(e){this.ccTrackCDN=/^http(s)?:\/\/(.*?)\//.exec(e)[2]},endLive(){this.isEnd=!0,this.isFrist=!0},bindVideoEvent:function(e){var t=this;this.isEnd=!1;var i=e;try{i.removeEventListener("waiting",function(){}),i.removeEventListener("play",function(){}),i.removeEventListener("canplay",function(){}),i.removeEventListener("ended",function(){})}catch(e){}i.addEventListener("canplay",function(){t.startPlayTime=(new Date).getTime(),t.isCaton&&(t.isCaton=!1,0===t.catonCount?(t.catonCount=t.catonCount+1,t.catonDuration=t.catonDuration+((new Date).getTime()-t.ccTrackTiming)):t.catonDuration=t.catonDuration+((new Date).getTime()-t.catonTime))}),i.addEventListener("play",function(){var e=(new Date).getTime();if(t.isFrist){t.ccTrackTimerFoo(),t.isFrist=!1;try{var i={event:"play",et:e-t.startPlayTime,code:200,rid:(new Date).getTime(),cdn:t.ccTrackCDN};ccTrack.tragger(i)}catch(e){}}}),i.addEventListener("waiting",function(){t.isSeeking||(t.catonCount=t.catonCount+1,t.isCaton=!0,t.catonTime=(new Date).getTime())}),i.addEventListener("playing",function(){}),i.addEventListener("seeking",function(){t.isSeeking=!0},!1),i.addEventListener("seeked",function(){t.isSeeking=!1},!1),i.addEventListener("ended",function(){},!1),i.onerror=function(){try{var e={event:"play",code:400,rid:(new Date).getTime()};ccTrack.tragger(e)}catch(e){}}}},r=function(e,t,i){$.ajax({url:e,type:"GET",dataType:"jsonp",data:t,xhrFields:{withCredentials:!0},success:function(e){"function"==typeof i?i&&i(e):console.log&&console.log("onQuestionnairePublish is undefined")},error:function(e){"function"==typeof i?i({errorCode:1,msg:"request error",result:e}):console.log&&console.log("onQuestionnairePublish is undefined")}})},s={DocModeType:{NormalMode:0,FreeMode:1},isDPReady:!1,dpc:{},fastMode:!0,init:function(){this.dpc=new Dpc({roomId:c.roomid,acountId:c.userid,token:l.options.key,type:1,isOpenWaterMark:parseInt(c.fileProcess,10)}),$("#drawPanel").css({height:"100%",width:"100%"})},appendDrawPanel:function(){var e='';"isMobile"==A.isMobile()&&(e=''),$("#drawPanel").append(e),"function"==typeof window.on_cc_live_db_flip&&window.on_cc_live_db_flip()},destroy:function(){this.dpc&&this.dpc.dispose&&this.dpc.dispose(),$("#dpa").remove()},pageChange:function(e){this.isDPReady&&this.fastMode&&this.dpc.pageChange(e)},animationChange:function(e){this.isDPReady&&this.fastMode&&this.dpc.animationChange(e)},history:function(e){this.isDPReady&&this.fastMode&&this.dpc.history(e)},draw:function(e){this.isDPReady&&this.fastMode&&this.dpc.draw(e)},clear:function(){this.isDPReady&&this.fastMode&&this.dpc.clear()},reload:function(){this.isDPReady&&this.fastMode&&this.dpc.reload()},setDocMode:function(e){this.isDPReady&&this.fastMode&&this.dpc.setFreeDocMode(e)},getDocs:function(e){this.isDPReady&&this.fastMode&&this.dpc.getDocs(c.roomid,c.userid,e)},changePageTo:function(e,t){this.isDPReady&&this.fastMode&&this.dpc.changePageTo(e,t)},showMarquee:function(e){this.isDPReady&&this.fastMode&&this.dpc.openMarquee(e)},closeMarquee:function(){this.isDPReady&&this.fastMode&&this.dpc.closeMarquee()},openBarrage:function(e){this.isDPReady&&this.fastMode&&this.dpc.openBarrage()},insertBarrage:function(e){if(this.isDPReady&&this.fastMode){var t;try{t=JSON.parse(e)}catch(i){t={type:"text",content:e}}this.dpc.insertBarrage(t)}},closeBarrage:function(){this.isDPReady&&this.fastMode&&this.dpc.closeBarrage()},docAdapt:function(e){if(this.isDPReady&&this.fastMode){var t=e?"1":"2";this.dpc.setDisplayMode(t)}}};window.isRequesting=!1;var c={DocModeType:{NormalMode:0,FreeMode:1},MediaScaleMode:{scale43:"4:3",scale169:"16:9",scaleFull:"full",scaleNormal:"normal"},init:function(e){var t,i,n,o;void 0===e&&(e={}),this.userid=$.trim(e.userid),this.roomid=$.trim(e.roomid),this.groupid=$.trim(e.groupid),this.viewername=$.trim(e.viewername),this.viewertoken=$.trim(e.viewertoken),this.forcibly=$.trim(e.forcibly),this.viewercustomua=$.trim(e.viewercustomua),this.language=$.trim(e.language),this.viewercustominfo=$.trim(e.viewercustominfo),this.ua=$.trim(e.ua),this.viewerid=$.trim(e.viewerid),this.upid=$.trim(e.upid),this.isPCH5Live=!1,e.pcH5Live&&(this.isPCH5Live="true"===$.trim(e.pcH5Live.toString())),t="lang",i=this.language,n=1e5,(o=new Date).setDate(o.getDate()+n),document.cookie=t+"="+i+"; expires="+o.toDateString(),"string"==typeof e.fastMode?"false"===e.fastMode?this.fastMode=!1:this.fastMode=!0:"boolean"==typeof e.fastMode?this.fastMode=e.fastMode:this.fastMode=!0,s.fastMode=this.fastMode,this.forceNew=!1,"boolean"==typeof e.forceNew&&(this.forceNew=e.forceNew);var a=this,r=["//static.csslcloud.net/js/socket.io.js","//static.csslcloud.net/js/report.js","//class.csslcloud.net/cctrack/ccTrack.js","//view.csslcloud.net/js/aliyun-rts-sdk.js"];navigator.appVersion.indexOf("MSIE")>=0||"isMobile"==A.isMobile()||r.push("//static.csslcloud.net/js/AgoraRTCSDK-2.7.1.js");var u=document.getElementById("drawPanel");if(s.fastMode&&u&&r.push("//image.csslcloud.net/live/1.0.4/web/js/dpc.js?v="+(new Date).getTime()),"isMobile"==A.isMobile())$("#drawPanel").length>0&&(s.fastMode||r.push("//static.csslcloud.net/js/module/drawingBoard-2.0.0.js"));else{if(!function(){var e=!0;if(navigator.appVersion.indexOf("MSIE")>=0)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(t){e=!1}else navigator.plugins["Shockwave Flash"]||(e=!1);return e}()&&("function"==typeof c.onNotSupportFlash&&c.onNotSupportFlash(),"18452D400D6B81D5"==this.userid)){var d=$("#"+h.id).parent().height(),l=$("#"+h.id).parent().width();$("#"+h.id).append('

您还没有安装flash播放器,请点击这里安装

').parent().css("z-index","999999");var f=$($("#"+h.id+" div p")[0]).height(),p=$($("#"+h.id+" div p")[0]).width();$("#"+h.id+" div").css({"margin-left":(l-p-60)/2+"px","margin-top":(d-f)/2+"px"}),setInterval(function(){$("#"+h.id).parent().show()},3e3)}r.push("//static.csslcloud.net/js/swfobject.js","//static.csslcloud.net/js/json3.min.js")}a.loadScript(r,function(){if(a.login(function(){a.history=new y}),$("#drawPanel").css({height:"100%",width:"100%"}),"isMobile"==A.isMobile()&&$.DrawingBoard){$("#drawPanel").append(''),$("div#drawPanel").remove(),$.DrawingBoard.config()}})},login:function(e){$.ajax({url:"//view.csslcloud.net/api/room/login",type:"GET",dataType:"jsonp",data:{roomid:this.roomid,userid:this.userid,groupid:this.groupid,viewername:this.viewername,viewertoken:this.viewertoken,forcibly:this.forcibly,viewercustomua:this.viewercustomua,viewercustominfo:this.viewercustominfo,version:t,service:2,client:4},success:function(t){if(t.success){var i="https:"===window.location.protocol,n=t.datas.pusherNode.primary;if(i&&n&&n.indexOf(":")){var o=n.split(":");if(2==o.length){var r=parseInt(o[1]);if(!isNaN(r)){var d=r+400;n=o[0]+":"+d}}}var f=document.location.protocol+"//"+n+"/"+t.datas.pusher.nsp,g=t.datas.viewer.key;l.options.pusherUrl=f,l.options.key=g,c.viewerid=t.datas.viewer.id,c.sessionId=t.datas.viewer.key,c.viewername=t.datas.viewer.name,c.isBan=t.datas.room.isBan,c.liveId=t.datas.liveId,c.upid=t.datas.upId,c.multiQuality=t.datas.room.multiQuality,c.documentDisplayMode=t.datas.room.documentDisplayMode,c.isBarrage=t.datas.room.barrage,c.liveCountdown=t.datas.room.liveCountdown,c.groupId=t.datas.viewer.groupId,c.fileProcess=t.datas.fileProcess,c.rtsFlag=t.datas.room.rtsFlag;var v=document.getElementById("drawPanel");s.fastMode&&v&&($("#documentDisplayMode").length<=0&&$("body").append(""),$("#documentDisplayMode").val(c.documentDisplayMode),s.isDPReady=!0,s.appendDrawPanel(),s.init(),window.on_hdLive_drawPanel_complete&&window.on_hdLive_drawPanel_complete()),e();var m=t.datas.room.delayTime,w=t.datas.room.foreignPublish;h.delay=m,m<=0&&5e3,h.foreignPublish=w,h.openHostMode=t.datas.room.openHostMode,h.dvr=t.datas.room.dvr,h.barrageData=t.datas.room.barrage,h.warmVideoId=t.datas.room.encryptWarmVideoId,h.viewerid=t.datas.viewer.id;var y=t.datas.room.playerBackgroundImageUri;if(y)(i="https:"===window.location.protocol)&&(y=y.replace(/http:/g,"https:"));else y="";h.backgroundImageUri=y,"function"==typeof c.playerBackgroundImageUri&&c.playerBackgroundImageUri(y);var _=t.datas.room.playerBackgroundHint;_||(_=""),h.backgroundHint=_,"function"==typeof c.playerBackgroundHint&&c.playerBackgroundHint(_);var b=t.datas.announcement;"function"==typeof c.onAnnouncementShow&&b&&c.onAnnouncementShow(b);var T=t.datas.room.desc;"function"==typeof c.onLiveDesc&&c.onLiveDesc(T);var k=t.datas.room.showUserCount;"function"==typeof c.showUserCount&&c.showUserCount(k);var P=t.datas.viewer.marquee;if("function"==typeof c.getMarquee&&c.getMarquee(P),"function"==typeof c.onLoginSuccess){var M={desc:t.datas.template.desc,type:t.datas.template.type,name:t.datas.template.name,id:t.datas.template.id},L={id:t.datas.viewer.id,groupId:t.datas.viewer.groupId,name:t.datas.viewer.name},C={live:t.datas.live,template:M,viewer:L};c.onLoginSuccess(C)}var R=t.datas.live;switch("function"==typeof c.onLiveTime&&c.onLiveTime(R),l.init(),a.init(),u.init(),"isMobile"==A.isMobile()?A.init():h.init(),t.datas.template.type){case 6:I.init(),c.sendPublicChatMsg=c.sendPrivateChatMsg=function(){return!1};break;case 5:S.init(),I.init(),p.init();break;case 4:S.init(),p.init(),c.sendQuestionMsg=function(){return!1};break;case 3:S.init(),c.sendQuestionMsg=function(){return!1};break;case 2:S.init(),I.init();break;default:S.init(),I.init(),p.init()}}else"function"==typeof c.onLoginError&&c.onLoginError(t)}})},logout:function(e){e&&($.ajax({url:"//view.csslcloud.net/api/live/logout",type:"GET",dataType:"jsonp",timeout:5e3,xhrFields:{withCredentials:!0},success:function(t){"function"==typeof e.success&&e.success(t)},error:function(t,i,n){"function"==typeof e.error&&e.error({errorcode:"100",msg:"退出失败",info:n})}}),l.socket&&l.socket.disconnect())},getScript:function(e,t){var i=!1,n=document.createElement("script");n.src=e,n.onload=n.onreadystatechange=function(){i||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(i=!0,t&&t())},document.body.appendChild(n)},loadScript:function(e,t){if("string"==typeof e){var i=e;(e=[]).push(i)}var n=this,o=function(e,t){n.getScript(e.shift(),function(){e.length?o(e,t):t&&t()})};o(e,t)},changeNickname:function(e){if(!e||"string"!=typeof e||e.length>20)return!1;l.socket.emit("change_nickname",e)},destroy:function(){s&&s.destroy(),l&&l.destroy(),_.interaction&&_.interaction.disconnectInteraction(d.viewerId),h&&h.isReady&&h.destroy(),window.live&&window.live.interaction&&(window.live.interaction.hangupInteraction&&window.live.interaction.hangupInteraction(),window.live.interaction.leaveAgoraRTC()),e(window)},sendPublicChatMsg:function(e){!e||e.length>300||l.socket.emit("chat_message",e)},sendPrivateChatMsg:function(e,t,i){var n=(new Date).getHours(),o=(new Date).getMinutes(),a=(new Date).getSeconds();o=o>9?o:"0"+o,a=a>9?a:"0"+a;var r={fromuserid:this.viewerid,fromusername:this.viewername,touserid:e,tousername:t,msg:$.trim(i),time:n+":"+o+":"+a};l.socket.emit("private_chat",JSON.stringify(r))},sendQuestionMsg:function(e){if(e&&!(e.length>300)){var t={action:"question",value:{userId:this.viewerid,userName:this.viewername,content:e}};try{l.socket.emit("question",JSON.stringify(t))}catch(e){}}},barrage:function(e,t){if("isMobile"!=A.isMobile()){var i=$.trim(e);i&&(i=e.replace(/\[em2?_([0-9]*)\]/g,""),h.barrage({txt:i,color:null==t?16777215:t}))}},getLine:function(){return"isMobile"==A.isMobile()?A.getLine():h.getLine()},getCurrentLine:function(){return"isMobile"==A.isMobile()?A.getCurrentLine():h.getCurrentLine()},changeQuality:function(e,t){return"isMobile"==A.isMobile()?A.changeQuality(e,t):h.changeQuality(e,t)},getQualityIndex:function(){return"isMobile"==A.isMobile()?A.getQualityIndex():h.getQualityIndex()},changeLine:function(e){"isMobile"==A.isMobile()?A.changeLine(e):h.changeLine(e)},onlyAudio:function(){"isMobile"==A.isMobile()?A.onlyAudio():h.onlyAudio()},play:function(){"isMobile"==A.isMobile()&&A.play()},changeVideoScale:function(e){"isMobile"!=A.isMobile()&&h.changeVideoScale(e)},setSound:function(e){"isMobile"!=A.isMobile()&&h.setSound(e)},answerRollcall:function(e,t){var i={rollcallId:e,userId:this.viewerid,userName:this.viewername,publisherId:t};l.socket.emit("answer_rollcall",JSON.stringify(i))},replyVote:function(e,t,i){var n={voteId:e,voteOption:t,publisherId:i};l.socket.emit("reply_vote",JSON.stringify(n))},docBarrage:function(e,t){$.trim(e)&&p.barrage({txt:e,color:null==t?16777215:t})},openBarrage:function(e){h.openBarrage(e)},openDocBarrage:function(e){"isMobile"!=A.isMobile()&&s.fastMode&&s.openBarrage(e)},insertDocBarrage:function(e){"isMobile"!=A.isMobile()&&s.fastMode&&s.insertBarrage(e)},closeDocBarrage:function(){"isMobile"!=A.isMobile()&&s.fastMode&&s.closeBarrage()},showControl:function(e){"isMobile"==A.isMobile()?A.showControl(e):h.showControl(e)},switchFullScreen:function(e){"isMobile"==A.isMobile()?A.switchFullScreen(e):h.switchFullScreen(e)},livePlayerInit:function(){h.init()},openSound:function(){"isMobile"==A.isMobile()?A.setMuted(!1):h.openSound()},closeSound:function(){"isMobile"==A.isMobile()?A.setMuted(!0):h.closeSound()},docAdapt:function(e){s.fastMode?s.docAdapt(e):_.adapt=e},requestInteraction:function(e){window.isRequesting||(window.isRequesting=!0,navigator.appVersion.indexOf("MSIE")>=0||_.interaction.requestInteraction(e))},hangupInteraction:function(){_.interaction.hangupInteraction()},enterInteractionRoom:function(e){var t=void 0;try{l.socket.emit("speak_enter")}catch(e){t=e}finally{"function"==typeof e&&e(t)}},sendInteractionMessage:function(e,t,i,n,o){var a="audio";e.video&&(a="audiovideo");var r={type:a,fromname:this.viewername,fromid:this.viewerid,fromrole:"student",toid:t,event:i,data:JSON.stringify(n)},s=void 0;try{l.socket.emit("speak_message",JSON.stringify(r))}catch(e){s=e}finally{"function"==typeof o&&o(s)}},showMarquee:function(e){h.showMarquee(e)},closeMarquee:function(){h.closeMarquee()},showMarqueeDoc:function(e){s.fastMode?s.showMarquee(e):p.showMarquee(e)},closeMarqueeDoc:function(){s.fastMode&&s.closeMarquee()},setDocMode:function(e){s.fastMode&&s.setDocMode(e)},getDocs:function(e){s.fastMode&&s.getDocs(e)},changePageTo:function(e,t){s.fastMode&&s.changePageTo(e,t)},submitQuestionnaire:function(e,t){if(e){var i={questionnaireid:e.questionnaireId,answers:JSON.stringify({subjectsAnswer:e.subjectsAnswer})};$.ajax({url:"//eva.csslcloud.net/api/questionnaire/submit",type:"GET",dataType:"jsonp",timeout:5e3,data:i,xhrFields:{withCredentials:!0},success:function(e){t?t(e):console.log&&console.log("no callback")},error:function(e,i,n){t&&t({errorCode:1,msg:"request was aborted",result:n})}})}},commitLottery:function(e,t){u.commitLottery(e,t)},getPublishingQuestionnaire:function(){r("//eva.csslcloud.net/api/questionnaire/info",{},c.onQuestionnairePublish)},getPracticeInfo:function(e,t){var i={practiceId:e,sessionId:l.options.key};r("//eva.csslcloud.net/api/practice/info",i,t)},getPracticeInfomation:function(e,t){var i={practiceId:e,sessionId:l.options.key,mark:1};r("//eva.csslcloud.net/api/practice/info",i,t)},submitPracticeInfo:function(e,t,i){var n={practiceId:e,options:t,sessionId:l.options.key};r("//eva.csslcloud.net/api/practice/submit",n,i)},getPracticeStatisInfo:function(e,t){var i={practiceId:e,sessionId:l.options.key};r("//eva.csslcloud.net/api/practice/statis",i,t)},getPracticeRanking:function(e,t){var i={practiceId:e,sessionId:l.options.key};r("//eva.csslcloud.net/api/practice/ranking",i,t)},getHdInquirePunchInformation:function(e){this.httpRequest({url:"//view.csslcloud.net/servlet/punch/viewer",data:{sessionId:l.options.key},success:function(t){"function"==typeof e&&e(t)},error:function(t){e&&e(t)}})},hdCommitPunch:function(e,t){this.httpRequest({url:"//view.csslcloud.net/servlet/punch/commit",data:{punchId:e,sessionId:l.options.key},success:function(e){t&&t(e)},error:function(e){t&&t(e)}})},httpRequest:function(e){$.ajax({url:e.url||"",data:e.data||{},type:e.type||"GET",dataType:e.dataType||"json",timeout:e.timeout||5e3,success:function(t){"function"==typeof e.success&&e.success(t)},error:function(t){"function"==typeof e.error&&e.error(t)},fail:function(t){"function"==typeof e.fail&&e.fail(t)}})},clipVideoImage:function(){if(this.isPCH5Live||A.isMobile()){var e=document.createElement("canvas"),t=e.getContext("2d"),i=document.querySelector("#"+h.id+" video");return i?(e.width=i.videoWidth,e.height=i.videoHeight,t.drawImage(i,0,0,i.videoWidth,i.videoHeight),e.toDataURL()):""}}},u={init:function(){this.queryLotteryStatus()},create(){this.queryLotteryStatus()},cancel(){c.onLottery({lotteryStatus:1,haveLottery:!0})},complete(){this.queryLotteryUserInfo()},queryLotteryStatus(){var e=this;b("/api/lottery/student/status",{accountId:c.userid,roomId:c.roomid},function(t){if(t.success&&t.data.haveLottery){var i=t.data;if("function"==typeof c.onLottery){e.lotteryId=t.data.lotteryId,e.lotteryType=i.lotteryType;var n={lotteryId:i.lotteryId,lotteryStatus:i.lotteryStatus,haveLottery:!0,lotteryType:i.lotteryType};c.onLottery(n)}}else"function"==typeof c.onLottery&&c.onLottery({haveLottery:!1})})},queryLotteryUserInfo(){var e=this;b("/api/lottery/query/own",{accountId:c.userid,roomId:c.roomid,lotteryId:e.lotteryId},function(t){if(t.success){var i=t.data;e.isWinner=i.isWinner,e.collectTemplateInfo=i.isWinner?i.collectTemplate:[];var n={lotteryId:e.lotteryId,haveLottery:!0,lotteryStatus:2,lotteryType:e.lotteryType,LotteryWinInfo:{LotteryCollectTemplate:i.collectTemplate||[],isWinner:i.isWinner,ownUserInfo:{userAvatar:i.isWinner?i.ownUserInfo.userAvatar:"",userName:i.isWinner?i.ownUserInfo.userName:"",userId:i.isWinner?i.ownUserInfo.userId:"",prizeCode:i.isWinner?i.ownUserInfo.prizeCode:""},LotteryPrize:i.prize,LotteryUserInfo:i.userInfos}};c.onLottery(n)}})},commitLottery:function(e,t){var i=e.collectInfos.find(function(e){return 1===e.index});if(""!==i.value&&" "!==i.value){var n=e.collectInfos.find(function(e){return 2===e.index});!n||/^[1][3,4,5,7,8,9][0-9]{9}$/.test(n.value)?T("/api/lottery/collect?accountId="+c.userid+"&roomId="+c.roomid,e,function(e){e.success?t&&t.onSuccess&&t.onSuccess("提交成功"):t&&t.onError&&t.onError("提交失败")}):t&&t.onError&&t.onError("请输入正确的电话号码")}else t&&t.onError&&t.onError("姓名不能未空")}},d={init:function(){this.userId=c.userid,this.roomId=c.roomid,this.groupId=c.groupId,this.liveId=c.liveId,this.viewerId=c.viewerid,this.upId=c.upid}},l={options:{pusherUrl:"",key:"",maxMessageCount:300,userId:"",roomId:"",livePlayerId:"",drawPanel:""},drawjson:[],pagechangedata:[],publishStreamTimer:0,endStreamTimer:0,init:function(){var e="isMobile"==A.isMobile()?1:0;this.timeIntervalID=-1,c.forceNew?(this.socket=io.connect(this.options.pusherUrl+"?sessionid="+l.options.key+"&platform=1&terminal="+e,{forceNew:!0}),x("forceNew: true")):(this.socket=io.connect(this.options.pusherUrl,{query:{sessionid:l.options.key,platform:1,terminal:e},secure:!0,transports:["websocket"]}),x("forceNew: false")),this.bind()},destroy:function(){this.hangupInteraction(),this.cancelRequestInteraction(),this.socket&&this.socket.disconnect(),-1!=this.timeIntervalID&&clearInterval(this.timeIntervalID)},bind:function(){var e=!1;this.socket.on("connect",function(){a.pusherSucces(),"function"==typeof window.onSocketConnect&&window.onSocketConnect()}),this.socket.on("disconnect",function(){a.pusherDisconnect(),"function"==typeof window.onSocketDisconnect&&window.onSocketDisconnect(),window.isRequesting=!1}),this.socket.on("reconnect_failed",function(){a.pusherFailed()}),this.socket.on("reconnecting",function(){a.pusherReconnecting()}),this.socket.on("reconnect",function(){a.pusherReconnect()}),this.socket.on("page_change",function(e){if(e&&"string"==typeof e&&l.pagechangedata.push(JSON.parse(e)),"function"==typeof window.on_cc_live_dw_page_change&&window.on_cc_live_dw_page_change(e),"function"==typeof c.onPageChange){var t=JSON.parse(e),i={docId:t.value.docid,docName:t.value.fileName,docTotalPage:t.value.totalPage,pageNum:t.value.page};c.onPageChange(i)}}),this.socket.on("change_nickname",function(e){c.viewername=e,"function"==typeof c.onChangeNickname&&c.onChangeNickname(e)}),this.socket.on("animation_change",function(e){"function"==typeof window.on_cc_live_dw_animation_change&&window.on_cc_live_dw_animation_change(e)}),this.socket.on("draw",function(e){e&&"string"==typeof e&&l.drawjson.push(JSON.parse(e)),"function"==typeof window.on_cc_live_dw_draw&&window.on_cc_live_dw_draw(e)}),this.socket.on("room_user_count",function(e){"function"==typeof c.onUserCountMessage&&c.onUserCountMessage(e)}),this.socket.on("publish_stream",function(e){this.publishStreamTimer&&clearTimeout(this.publishStreamTimer),this.publishStreamTimer=setTimeout(function(){h&&(h.isPublishing=1),h&&h.start&&h.start(),"function"==typeof c.onLiveStart&&c.onLiveStart(e)},N())}),this.socket.on("end_stream",function(e){this.endStreamTimer&&clearTimeout(this.endStreamTimer),this.endStreamTimer=setTimeout(function(){h&&(h.isPublishing=0),h&&h.end&&h.end(),p&&p.clear&&p.clear(),s.clear(),"function"==typeof c.onLiveEnd&&c.onLiveEnd(e)},N())}),this.socket.on("kick_out",function(e){l.socket.disconnect(),"function"==typeof c.onKickOut&&c.onKickOut(e),"function"==typeof c.onKickOutMobile&&c.onKickOutMobile(e),A.isIPad()||A.isIPhone()||A.isAndroid()||A.isWindowsPhone()||h.isH5Video()||h.getFlash()._kickOff&&h.getFlash()._kickOff()}),this.socket.on("announcement",function(e){"release"==(e=F(e)).action?"function"==typeof c.onAnnouncementRelease&&c.onAnnouncementRelease(e.announcement):"remove"==e.action&&"function"==typeof c.onAnnouncementRemove&&c.onAnnouncementRemove(e)}),this.socket.on("ban_chat_broadcast",function(e){e=F(e),"function"==typeof c.HDBanChatBroadcastWithData&&c.HDBanChatBroadcastWithData(e)}),this.socket.on("in_remind",function(e){var t={userId:(e=F(e)).userId,userName:e.userName,userRole:e.userRole,groupId:e.groupId,clientType:e.clientType,prefixContent:e.prefixContent,suffixContent:e.suffixContent,remindAction:1};"function"==typeof c.HDUserRemindWithAction&&c.HDUserRemindWithAction(t)}),this.socket.on("out_remind",function(e){var t={userId:(e=F(e)).userId,userName:e.userName,userRole:e.userRole,groupId:e.groupId,clientType:e.clientType,prefixContent:e.prefixContent,suffixContent:e.suffixContent,remindAction:0};"function"==typeof c.HDUserRemindWithAction&&c.HDUserRemindWithAction(t)}),this.socket.on("start_rollcall",function(e){e=F(e),"function"==typeof c.onStartRollCall&&c.onStartRollCall(e)}),this.socket.on("start_punch",function(e){e=F(e),"function"==typeof c.onHdLiveStartPunch&&c.onHdLiveStartPunch(e)}),this.socket.on("stop_punch",function(e){e=F(e),"function"==typeof c.onHdLiveStopPunch&&c.onHdLiveStopPunch(e)}),this.socket.on("start_lottery",function(e){e=F(e),"function"==typeof c.onStartLottery&&c.onStartLottery(e)}),this.socket.on("win_lottery",function(e){e=F(e),"function"==typeof c.onWinLottery&&c.onWinLottery(e)}),this.socket.on("stop_lottery",function(e){e=F(e),"function"==typeof c.onStopLottery&&c.onStopLottery(e)}),this.socket.on("start_vote",function(e){e=F(e),"function"==typeof c.onStartVote&&c.onStartVote(e)}),this.socket.on("stop_vote",function(e){e=F(e),"function"==typeof c.onStopVote&&c.onStopVote(e)}),this.socket.on("vote_result",function(e){e=F(e),"function"==typeof c.onVoteResult&&c.onVoteResult(e)}),this.socket.on("ban_stream",function(e){e=F(e),c.isBan=1,"isMobile"==A.isMobile()?A.ban():h.banLive(),"function"==typeof c.onBanStream&&c.onBanStream(e)}),this.socket.on("unban_stream",function(e){e=F(e),c.isBan=0,"isMobile"==A.isMobile()?A.unban():h.unbanLive(),"function"==typeof c.onUnBanStream&&c.onUnBanStream(e)}),window.isSpeakThirdParty=!1,this.socket.on("room_setting",function(t){if(t=F(t),"function"==typeof c.onRoomSetting&&(window.allowSpeakThirdParty=t.allow_speak_third_party,"true"==t.allow_speak_interaction&&(window.isSpeakThirdParty=!1),"true"==window.allowSpeakThirdParty.status&&(window.isSpeakThirdParty=!0,t.allow_speak_interaction="true"),window.isSpeakThirdParty,c.onRoomSetting(t)),t.layout_video_main!=e){var i=t.layout_video_main;"function"==typeof c.onSwitchVideoDoc&&c.onSwitchVideoDoc(i),e=i}}),this.socket.on("silence_user_chat_message",function(e){"function"==typeof c.onSilenceUserChatMessage&&c.onSilenceUserChatMessage(F(e))}),this.socket.on("ban_delete_chat",function(e){"function"==typeof c.onBanDeleteChat&&c.onBanDeleteChat(F(e))}),this.socket.on("accept_speak",function(e){"function"==typeof window.on_cc_live_accept_interaction&&window.on_cc_live_accept_interaction(F(e))}),this.socket.on("speak_message",function(e){window.isSpeakThirdParty||"function"!=typeof window.on_cc_live_interaction_message||window.on_cc_live_interaction_message(F(e))}),this.socket.on("speak_peer_list",function(e){"function"==typeof window.on_cc_live_interaction_chatusers&&window.on_cc_live_interaction_chatusers(F(e))}),this.socket.on("speak_disconnect",function(e){"function"==typeof window.on_cc_live_interaction_disconnect_self&&window.on_cc_live_interaction_disconnect_self(F(e))}),this.socket.on("speak_disconnect_third_party",function(e){"function"==typeof window.on_cc_live_interaction_disconnect_self&&window.on_cc_live_interaction_disconnect_self(F(e))}),this.socket.on("broadcast_msg",function(e){"function"==typeof c.onBroadcastMsg&&c.onBroadcastMsg(F(e).value)}),this.socket.on("broadcast_action",function(e){"function"==typeof c.removeBroadcastMsg&&c.removeBroadcastMsg(F(e))}),this.socket.on("publish_question",function(e){"function"==typeof c.onQaPublish&&c.onQaPublish(F(e))}),this.socket.on("questionnaire_publish",function(e){e=F(e),"function"==typeof c.onQuestionnairePublish&&c.onQuestionnairePublish(e)}),this.socket.on("questionnaire_publish_stop",function(e){e=F(e),"function"==typeof c.onQuestionnairePublishStop&&c.onQuestionnairePublishStop(e)}),this.socket.on("practice_publish",function(e){e=F(e),"function"==typeof c.onPracticePublish&&c.onPracticePublish(e)}),this.socket.on("practice_stop",function(e){e=F(e),"function"==typeof c.onPracticePublishStop&&c.onPracticePublishStop(e)}),this.socket.on("practice_close",function(e){e=F(e),"function"==typeof c.onPracticeClose&&c.onPracticeClose(e)}),this.socket.on("prize_send",function(e){e=F(e),"function"==typeof c.onPrizeSend&&c.onPrizeSend(e)}),this.socket.on("questionnaire_publish_statis",function(e){e=F(e),"function"==typeof c.onQuestionnairePublishStatis&&c.onQuestionnairePublishStatis(e)}),this.socket.on("lottery_create",function(e){u.create(e)}),this.socket.on("lottery_cancel",function(e){u.cancel(e)}),this.socket.on("lottery_complete",function(e){u.complete(e)}),this.socket.on("room_teachers",function(e){"function"==typeof c.onOnlineTeachers&&c.onOnlineTeachers(F(e))}),this.socket.on("external_questionnaire_publish",function(e){"function"==typeof c.onExternalQuestionnairePublish&&c.onExternalQuestionnairePublish(F(e))}),this.socket.on("ban_chat",function(e){"function"==typeof c.onBanChat&&c.onBanChat(F(e))}),this.socket.on("unban_chat",function(e){"function"==typeof c.onUnBanChat&&c.onUnBanChat(F(e))}),this.socket.on("switch_source",function(e){"function"==typeof c.onSwitchSource&&c.onSwitchSource(e)});var t=this;setTimeout(function(){try{t.socket.emit("room_user_count")}catch(e){}try{t.socket.emit("room_teachers")}catch(e){}},1500),this.timeIntervalID=setInterval(function(){try{t.socket.emit("room_user_count")}catch(e){}try{t.socket.emit("room_teachers")}catch(e){}},15e3)},requestInteraction:function(e,t){var i="audio";e.video&&(i+="video");var n={viewerId:c.viewerid,viewerName:c.viewername,type:i},o=void 0;try{this.socket.emit("request_speak",JSON.stringify(n))}catch(e){o=e}finally{"function"==typeof t&&t(o)}},cancelRequestInteraction:function(e,t){var i={viewerId:c.viewerid,viewerName:c.viewername,type:window.live.interaction.local.type};x("interaction","取消申请:"+JSON.stringify(i));var n=void 0;try{this.socket.emit("cancel_request_speak",JSON.stringify(i))}catch(e){n=e}finally{"function"==typeof t&&t(n)}},hangupInteraction:function(e,t){var i={viewerId:c.viewerid,viewerName:c.viewername,type:e};x("interaction","挂断事件:"+JSON.stringify(i));var n=void 0;try{window.isSpeakThirdParty?this.socket.emit("hangup_interaction_third_party",JSON.stringify(i)):this.socket.emit("hangup_interaction",JSON.stringify(i))}catch(e){n=e}finally{"function"==typeof t&&t(n)}}},f=function(e){try{window.PeerConnection=window.PeerConnection||window.webkitPeerConnection00||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,window.URL=window.URL||window.webkitURL||window.msURL||window.oURL,window.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,window.nativeRTCIceCandidate=window.mozRTCIceCandidate||window.RTCIceCandidate,window.nativeRTCSessionDescription=window.mozRTCSessionDescription||window.RTCSessionDescription}catch(e){}this.usersPcs={length:0},this.local={type:{video:!1,audio:!1},video:{},audio:{}},this.isRequesting=!1,this.client=null,this.localStream=null,this.initAgoraRTC=function(e){if(AgoraRTC.checkSystemRequirements()||AgoraRTC.Logger.error("Your browser does not support WebRTC!"),AgoraRTC&&AgoraRTC.Logger.setLogLevel(AgoraRTC.Logger.ERROR),window.atob){var t=c.userid,i=c.roomid,n=c.sessionId,o=e.channelId,a=window.atob(this.hex2str(e.appId)),r=e.viewToken,s=e.videosize,u={agora:{appId:a,viewToken:r,channelId:o,type:this.local.type,ui:0,videoSize:s},tokens:{accountId:t,roomId:i,sessionId:n,channelId:o,ui:0}};this.joinAgoraRTC(u)}},this.hex2str=function(e){var t,i=e.trim(),n="0x"===i.substr(0,2).toLowerCase()?i.substr(2):i,o=n.length;if(o%2!=0)return alert("Illegal Format ASCII Code!"),"";for(var a=[],r=0;r'),t.localStream.play("agora_local"),t.client.publish(t.localStream,function(e){}),t.client.on("stream-published",function(e){})},function(e){})},function(e){})},function(e){}),t.client.on("stream-added",function(e){var i=e.stream;t.client.subscribe(i,function(e){})}),t.client.on("stream-subscribed",function(e){var t=e.stream;$("#videoInteractions").append('
'),t.play("interactionRemoteVideo"+t.getId(),{fit:"contain"})}),t.client.on("first-video-frame-decode",function(e){"function"==typeof window.on_cc_live_interaction_remote_media&&window.on_cc_live_interaction_remote_media(t.local.type),$("#agora_local").hide(),$("#livePlayer").hide(),window.isRequesting=!1})},this.leaveAgoraRTC=function(){this.client&&($("#livePlayer").show(),h.openSound(),this.localStream&&this.localStream.close(),this.client&&(this.client.leave(function(){$("#videoInteractions").empty(),$("#audioInteractions").empty(),$("#interactionLocalVideo")[0].src="",$("#agora_local").html("")},function(e){}),window.isRequesting=!1))},this.cameraId="",this.microphoneId="",this.getDevices=function(){var e=this;AgoraRTC.getDevices(function(t){for(var i=0;i!==t.length;++i){var n=t[i];"audioinput"!==n.kind||e.microphoneId||(e.microphoneId=n.deviceId),"videoinput"!==n.kind||e.cameraId||(e.cameraId=n.deviceId)}})},this.requestInteraction=function(e,t){x("Interaction","请求互动"),window.isSpeakThirdParty&&this.getDevices(),this.local.type=e,this.isRequesting=!0,this.setRequestTimeoutTimer(),this.createLocalMedia(function(i){i?"function"==typeof window.on_cc_live_interaction_error&&window.on_cc_live_interaction_error(_.interaction.local.type,i,"创建音视频信息出错"):l.requestInteraction(e,t)})},this.setCallingTimer=function(){_.interaction.interactionTime=0,_.interaction.interactionTimeInterval=setInterval(function(){if(++_.interaction.interactionTime,"function"==typeof window.on_cc_live_interaction_interval){var e=_.interaction.local.type,t=_.interaction.interactionTime;window.on_cc_live_interaction_interval(e,t)}},1e3)},this.clearCallingTimer=function(){_.interaction.interactionTime=0,clearInterval(_.interaction.interactionTimeInterval)},this.setRequestTimeoutTimer=function(){_.interaction.REQUEST_INTERACTION_TIMEOUT=setTimeout(function(){_.interaction.REQUEST_INTERACTION_TIMEOUT=-1,_.interaction.hangupInteraction(c.viewerid),_.interaction.stopLocalStream(),_.interaction.isRequesting=!1,$("#interactionLocalVideo")[0]&&($("#interactionLocalVideo")[0].src=""),"function"==typeof window.on_cc_live_interaction_request_timeout&&window.on_cc_live_interaction_request_timeout(_.interaction.local.type)},6e4),window.isRequesting=!1},this.clearRequestTimeoutTimer=function(){_.interaction.REQUEST_INTERACTION_TIMEOUT>0&&(clearTimeout(_.interaction.REQUEST_INTERACTION_TIMEOUT),_.interaction.REQUEST_INTERACTION_TIMEOUT=-1)},this.stopLocalStream=function(){if(_.interaction.local.video.stream)try{_.interaction.local.video.stream.getTracks().forEach(function(e){e.stop()})}catch(e){}if(_.interaction.local.audio.stream)try{_.interaction.local.audio.stream.getTracks().forEach(function(e){e.stop()})}catch(e){}},this.cancelInteraction=function(){_.interaction.isRequesting=!1,"function"==typeof window.on_cc_live_interaction_cancal&&window.on_cc_live_interaction_cancal(_.interaction.local.type)},this.disconnectInteraction=function(e){c.openSound(),this.clearRequestTimeoutTimer(),e==c.viewerid?$.each(_.interaction.usersPcs,function(e,t){var i=t.pc;if(null==i)return!0;if(i.close(),i=null,_.interaction.usersPcs[e]){delete _.interaction.usersPcs[e];var n=_.interaction.usersPcs.length-1;_.interaction.usersPcs.length=n<0?0:n}}):$.each(_.interaction.usersPcs,function(t,i){var n=i.pc;if(!n)return!0;if(t!=e)return!0;if(n.close(),n=null,_.interaction.usersPcs[t]){delete _.interaction.usersPcs[t];var o=_.interaction.usersPcs.length-1;_.interaction.usersPcs.length=o<0?0:o}}),0==_.interaction.usersPcs.length&&this.stopLocalStream(),_.interaction.isInteractioning=!1,_.interaction.isRequesting=!1},this.createLocalAudioAndVideoMedia=function(e){var t=this;getUserMedia.call(navigator,{video:!0,audio:!0},function(i){t.local.video.stream=i,e&&"function"==typeof e&&e(i)},function(t){x("Interaction","getUserMedia error: "+t),e&&"function"==typeof e&&e(t)})},this.createLocalAudioMedia=function(e){var t=this;getUserMedia.call(navigator,{video:!1,audio:!0},function(i){t.local.audio.stream=i,e&&"function"==typeof e&&e(i)},function(t){x("Interaction","getUserMedia error: "+t),e&&"function"==typeof e&&e(t)})},this.createLocalMedia=function(e){var t=this,i=t.local.type;getUserMedia.call(navigator,i,function(n){i.video?t.local.video.stream=n:t.local.audio.stream=n;var o=$("#interactionLocalVideo")[0];o&&(o.srcObject=n,o.volume=0),"function"==typeof window.on_cc_live_interaction_local_media&&window.on_cc_live_interaction_local_media(i,n),e&&"function"==typeof e&&e()},function(t){x("Interaction","getUserMedia error: "+t),e&&"function"==typeof e&&e(t)})},this.iceServers={iceServers:[{url:"stun:turn.csslcloud.net:3478",credential:"bokecc",username:"cc"},{url:"turn:turn.csslcloud.net:3478",credential:"bokecc",username:"cc"}],offerExtmapAllowMixed:!1},this.createAnswerPeerConnection=function(e){var t=new PeerConnection(this.iceServers);"audio"==e.type?(_.interaction.local.audio.stream||this.createLocalAudioMedia(),t.addStream(_.interaction.local.audio.stream)):(_.interaction.local.video.stream||this.createLocalAudioAndVideoMedia(),t.addStream(_.interaction.local.video.stream)),t.onaddstream=function(t){"function"==typeof window.on_cc_live_interaction_remote_media_self&&window.on_cc_live_interaction_remote_media_self(_.interaction.local.type,e,t.stream)},t.createAnswer(function(i){t.setLocalDescription(i),c.sendInteractionMessage(_.interaction.local.type,e.id,"answer",i)},function(e){x("Interaction","Failure callback: "+e)}),t.onicecandidate=function(t){null!==t.candidate&&c.sendInteractionMessage(_.interaction.local.type,e.id,"",t.candidate)},_.interaction.usersPcs[e.id]={pc:t,user:e},_.interaction.usersPcs.length+=1},this.createOfferPeerConnection=function(e){var t=new PeerConnection(this.iceServers),i=_.interaction.local.type;i.video?t.addStream(_.interaction.local.video.stream):t.addStream(_.interaction.local.audio.stream),t.onaddstream=function(t){"function"==typeof window.on_cc_live_interaction_remote_media_self&&window.on_cc_live_interaction_remote_media_self(_.interaction.local.type,e,t.stream)},t.oniceconnectionstatechange=function(e){x("Interaction","iceConnectionState ..."+t.iceConnectionState),"failed"==t.iceConnectionState&&(x("Interaction","iceConnectionState failed"),_.interaction.hangupInteraction(),"function"==typeof window.on_cc_live_interaction_disconnect_self&&window.on_cc_live_interaction_disconnect_self({disconnectid:c.viewerid}))},t.createOffer(function(n){t.setLocalDescription(n),c.sendInteractionMessage(i,e.id,"offer",n)},function(e){"function"==typeof window.on_cc_live_interaction_error&&window.on_cc_live_interaction_error(_.interaction.local.type,e,"createOfferPeerConnection")}),t.onicecandidate=function(t){null!==t.candidate&&c.sendInteractionMessage(i,e.id,"",t.candidate)},_.interaction.usersPcs[e.id]={pc:t,user:e},_.interaction.usersPcs.length+=1},this.id=e.interaction.id,this.isSupportInteraction=function(){return window.isSpeakThirdParty?!!AgoraRTC.checkSystemRequirements()||(AgoraRTC.Logger.error("Your browser does not support WebRTC!"),!1):"https:"===window.location.protocol&&!!(PeerConnection&&URL&&getUserMedia&&nativeRTCIceCandidate&&nativeRTCSessionDescription)},this.hangupInteraction=function(e){this.isInteractioning?l.hangupInteraction(this.type,e):this.isRequesting?(l.cancelRequestInteraction(this.type,e),this.stopLocalStream(),this.cancelInteraction()):(this.stopLocalStream(),this.cancelInteraction())}},h={id:"livePlayer",swfUrl:"//zeus.csslcloud.net/flash/Player.swf",isReady:!1,isPublishing:0,delay:"",foreignPublish:"",init:function(){var e={userid:c.userid,roomid:c.roomid,foreignPublish:this.foreignPublish,warmvideoid:this.warmVideoId,openhostmode:this.openHostMode,dvr:this.dvr,barrage:this.barrageData,backgroundImageUri:this.backgroundImageUri,backgroundHint:this.backgroundHint,countDownTime:c.liveCountdown,openMultiQuality:c.multiQuality,language:c.language||"",type:"liveplayer",upid:c.upid,viewerid:this.viewerid,ua:1},t=this.delay;t>0&&(e.buffer=t);var a={allowFullscreen:"true",allowScriptAccess:"always",wmode:"transparent"};if(c.isPCH5Live){c.roomid,c.userid;if(i())swfobject.embedSWF(this.swfUrl,this.id,"100%","100%","10.0.0","/flash/expressInstall.swf",e,a),c.on_hd_live_player_type&&c.on_hd_live_player_type("flash");else{var r=document.getElementById("livePlayer");$(".flashtip").remove();var s=document.createElement("script");s.src="//view.csslcloud.net/js/sdk/3.7.0/hdLivePlayer.js?v="+n(),document.body.appendChild(s),s.onload=function(){if(hdPcLivePlayer.isSuppoted()){var t={roomid:e.roomid,userid:e.userid,element:r,backgroundHint:e.backgroundHint,countDownTime:e.countDownTime,bacgroundImageUri:e.backgroundImageUri,warmVideoId:e.warmvideoid,upid:e.upid,viewerid:e.viewerid,isLowDelay:o(),barrage:1==parseInt(e.barrage,10),isBan:c.isBan,sessionid:c.sessionId};hdPcLivePlayer.config(t),window.UNKNOWSTATUSASKLX=!0,window._swfOk(),c.on_hd_live_player_type&&c.on_hd_live_player_type("h5")}else swfobject.embedSWF(this.swfUrl,this.id,"100%","100%","10.0.0","/flash/expressInstall.swf",e,a),c.on_hd_live_player_type&&c.on_hd_live_player_type("flash")}}window.hd_h5Live_create_error=function(){hdH5LiveVideo=null,swfobject.embedSWF(this.swfUrl,this.id,"100%","100%","10.0.0","/flash/expressInstall.swf",e,a),c.on_hd_live_player_type&&c.on_hd_live_player_type("flash")}.bind(this),window.UNKNOWSTATUSASKLX=!1,c.isBan&&"function"==typeof window.on_cc_live_room_ban&&window.on_cc_live_room_ban(this.banReason)}else swfobject.embedSWF(this.swfUrl,this.id,"100%","100%","10.0.0","/flash/expressInstall.swf",e,a),c.on_hd_live_player_type&&c.on_hd_live_player_type("flash")},getH5player:function(){return hdPcLivePlayer.player()},getFlash:function(){if(this.isReady&&swfobject&&swfobject.getObjectById)return swfobject.getObjectById(this.id)},getPlayerTime:function(){var e=parseInt("function"==typeof this.getFlash()._time?this.getFlash()._time():0);return isNaN(e)||e<0?0:e},isH5Video:function(){return!this.getFlash()&&"undefined"!=typeof hdPcLivePlayer||("undefined"==typeof hdPcLivePlayer&&this.getFlash(),!1)},start:function(){if("isMobile"==A.isMobile()){if(c.isBan)return $("#livePlayer").css({"text-align":"center",color:"white","font-size":"18px","line-height":"232px"}),void $("#livePlayer").html("

直播已封禁,请联系管理员

");A.init()}else{if(this.isH5Video()){if(c.isBan)return;return this.isPublishing=1,void this.getH5player().startLive()}if(!this.getFlash())return;this.isPublishing=1,this.getFlash()._streamStart()}},changeQuality(e,t){this.isH5Video()&&this.getH5player().changeStream(e,t)},getQualityIndex(){if(this.isH5Video())return this.getH5player().streamIndex},end:function(){if("isMobile"==A.isMobile())A.end();else{if(this.isH5Video()){if(c.isBan)return;return this.isPublishing=0,void this.getH5player().endLive()}if(!this.getFlash())return;this.isPublishing=0,this.getFlash()._streamEnd&&this.getFlash()._streamEnd()}},barrage:function(e){e&&(this.isH5Video()?this.getH5player().sendBarrage({type:"text",content:e.txt,css:{font:"微软雅黑",size:"14",color:e.color}}):this.getFlash()&&this.getFlash()._jsTOASbarrage&&this.getFlash()._jsTOASbarrage(e))},destroy:function(){this.end(),$(this.id).remove()},getCurrentLine:function(){if(this.isH5Video)return this.getH5player().hostIndex},getLine:function(){if(this.isH5Video()){for(var e=[],t=this.getH5player().lines.length,i=this.getH5player().hostIndex,n=0;n直播已封禁,请联系管理员

");b("/api/live/record",{accountId:c.userid,roomId:c.roomid,sessionId:c.sessionId},function(t){var i;t.success&&1===t.data.live.status?(d.init(),i=e.controls?'':'',$("#"+h.id).html(i),e.video=document.getElementById("player_live"),c.rtsFlag?e.getRTSHosts():e.getH5PlayerHosts()):($("#livePlayer").css({"text-align":"center",color:"white","font-size":"18px","line-height":"232px"}),$("#livePlayer").html("

直播等待中

"))})},getH5PlayerHosts:function(){var e=this;b("/api/live/play",{accountId:c.userid,roomId:c.roomid,sessionId:c.sessionId,types:"hls",platform:1,terminal:1},function(t){if(t.success&&t.data.stream.length>0){e.videoStreams=t.data.stream[0].videos,e.audioStreams=t.data.stream[0].audios,e.currentQualityStream=e.videoStreams[0],e.currentQualityCode=e.videoStreams[0].quality,e.currentLines=e.currentQualityStream.videoStream,e.currentLineIndex=0,e.currentLine=e.currentLines[0],e.initPlayer();var i=JSON.parse(JSON.stringify(e.videoStreams)).map(function(e){return delete e.videoStream,e});c.onHDReceivedVideoQuality&&c.onHDReceivedVideoQuality(i)}})},getRTSHosts:function(){var e=this;b("/api/live/play",{accountId:c.userid,roomId:c.roomid,sessionId:c.sessionId,types:"rts",platform:1,terminal:1},function(t){if(t.success&&t.data.stream.length>0){e.rtsStreams=t.data.stream[0],e.rtsVideoLine=e.rtsStreams.videos[0].videoStream[0],e.currentLines=e.rtsStreams.videos[0].videoStream,e.rtsAudioLine=e.rtsStreams.audios[0],e.currentLineIndex=0,e.currentQualityCode=e.rtsStreams.videos[0].quality,e.initRtsPlayer();var i=JSON.parse(JSON.stringify(e.rtsStreams.videos)).map(function(e){return delete e.videoStream,e});c.onHDReceivedVideoQuality&&c.onHDReceivedVideoQuality(i)}})},initRtsPlayer:function(){var e=this;e.aliRts=new AliRTS,e.bindRTSEvent(),e.aliRts.isSupport({isReceiveVideo:!0}).then(function(){c.onLiveStarting&&c.onLiveStarting(),e.isRtsStream=!0;$("#livePlayer").append('
'),$("#rtsPlayBtn").on("click",function(){$("#rtsPlayBtn").hide(),e.play()})}).catch(function(){e.getH5PlayerHosts()})},bindRTSEvent:function(){this.aliRts.on("onError",function(e){10201===e.errorCode&&window.rtsPlayOnError&&window.rtsPlayOnError()}),this.aliRts.on("onPlayEvent",function(e){e.event===R||e.event===D||e.event})},getLine:function(){return this.currentLines},getCurrentLine:function(){return this.currentLineIndex},initPlayer:function(){$("#player_live").show(),this.video.src=this.currentLine,a.setUrl(this.currentLine),a.bindVideoEvent(this.video),c.onLiveStarting&&c.onLiveStarting(),c.on_hd_live_player_type&&c.on_hd_live_player_type("h5"),c.onPlayerLoad&&c.onPlayerLoad(this.video),c.onKickOutMobile=function(){$("#"+h.id).html("")},this.report||(this.report=new ReportLog(d,1,11,this.video,!0))},showControl:function(e){this.controls=e,this.video.controls=e},switchFullScreen:function(e){var t=$("#player_live")[0];e?t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.webkitSupportsFullscreen&&t.webkitEnterFullscreen():t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozExitFullScreen?t.mozExitFullScreen():t.webkitExitFullscreen?t.webkitExitFullscreen():document.mozCancelFullScreen&&document.mozCancelFullScreen()},ban:function(){$("#livePlayer").css({"text-align":"center",color:"white","font-size":"18px","line-height":"232px"}),a.endLive(),$("#livePlayer").html("

直播已封禁,请联系管理员

")},unban:function(){$("#livePlayer").css({"text-align":"",color:"","font-size":"","line-height":""}),this.init()},end:function(){this.isRtsStream&&this.aliRts.stopLiveStream(),$("#livePlayer").css({"text-align":"center",color:"white","font-size":"18px","line-height":"232px"}),a.endLive(),$("#livePlayer").html("直播已结束")},appendDoc:function(e){"https:"===window.location.protocol&&(e=e.replace(/http:/g,"https:"));var t='';$("#"+p.id).html(t)},changeQuality:function(e,t){if(!this.isRtsStream&&!A.audio)if(this.videoStreams.find(function(t){return t.quality===e})){this.currentQualityCode=e,this.currentQualityStream=this.videoStreams.find(function(e){return e.quality===this.currentQualityCode}),this.currentLines=this.currentQualityStream.videoStream,this.currentLines[this.currentLineIndex]||(this.currentLineIndex=0);try{this.currentLine=this.currentLines[this.currentLineIndex],a.setUrl(this.currentLine),$("#"+h.id).find("video").attr("src",this.currentLine),t&&t(L)}catch(e){t&&t(M)}}else t&&t(k)},getQualityIndex(){if(!this.isRtsStream)return this.currentQualityCode},changeLine:function(e,t){if(!this.isRtsStream){if(A.audio){if(!this.audioStreams[e])return t&&t(P);audio.src="",audio.src=this.audioStreams[e],audio.play()}else{if(!this.currentLines[e])return t&&t(P);this.currentLine=this.currentLines[e],a.setUrl(this.currentLine),$("#"+h.id).find("video").attr("src",this.currentLine)}t&&t(C),this.currentLineIndex=e}},play:function(){var e=this;c.rtsFlag&&this.isRtsStream?($("#player_live").show(),e.aliRts.muteLiveStream(!1),e.aliRts.isSupport({isReceiveVideo:!0}).then(function(){e.aliRts.startLiveStream(e.rtsVideoLine,e.video).then(function(){}).catch(function(){alert("播放失败,请刷新页面重试")})}).catch(function(){this.isRtsStream=!1,e.getH5PlayerHosts()})):this.video.play()},onlyAudio:function(){var e=this,t=$("#"+h.id).find("video");e.video=document.getElementById("player_live"),t.show(),A.audio=!A.audio,this.isRtsStream?A.audio?(e.aliRts.stopLiveStream(),e.aliRts.isSupport({isReceiveVideo:!1}).then(function(){e.aliRts.startLiveStream(e.rtsAudioLine,null).then().catch(function(){alert("播放失败,请刷新页面重试")})}).catch(function(){e.aliRts.stopLiveStream(),alert("浏览器不支持RTS音频播放")})):(e.aliRts.stopLiveStream(),e.aliRts.isSupport({isReceiveVideo:!0}).then(function(){e.aliRts.startLiveStream(e.rtsVideoLine,e.video).then().catch(function(){alert("播放失败,请刷新页面重试")})}).catch(function(){alert("111"),alert("播放失败,请刷新页面重试")})):A.audio?(audio=new Audio,audio.src=this.audioStreams[this.currentLineIndex],audio.play()):(audio.src="",t.attr("src",this.currentLines[this.currentLineIndex]),t.play())},setMuted:function(e){this.isRtsStream?this.aliRts.muteLiveStream(e):this.video.muted=e},isMobile:function(){if(this.isIPad()||this.isIPhone()||this.isAndroid()||this.isWindowsPhone())return"isMobile"},isIPad:function(){return null!=navigator.userAgent.match(/iPad/i)},isIPhone:function(){return null!=navigator.userAgent.match(/iPhone/i)},isAndroid:function(){return null!=navigator.userAgent.match(/Android/i)},isWindowsPhone:function(){return null!=navigator.userAgent.match(/Windows Phone/i)}};window.on_cc_live_accept_interaction=function(e){!window.isSpeakThirdParty&&_&&_.livePlayer&&h.closeSound(),_.interaction.clearRequestTimeoutTimer(),window.isSpeakThirdParty&&_.interaction.initAgoraRTC(e),c.enterInteractionRoom(),_.interaction.isInteractioning=!0,_.interaction.setCallingTimer(),"function"==typeof window.on_cc_live_interaction_accept&&window.on_cc_live_interaction_accept(_.interaction.local.type,F(e))},window.on_cc_live_interaction_disconnect_self=function(e){if(window.isSpeakThirdParty){_.interaction.leaveAgoraRTC();var t=_.interaction.local.type;"function"==typeof window.on_cc_live_interaction_disconnect&&window.on_cc_live_interaction_disconnect(e,t)}var i=e.disconnectid,n=!!_.interaction.usersPcs[i];if(i==c.viewerid||n){if(i!=c.viewerid&&n&&c.hangupInteraction(),_.interaction.clearCallingTimer(),_.interaction.disconnectInteraction(i),i==c.viewerid||0==_.interaction.usersPcs.length){_.interaction.stopLocalStream();t=_.interaction.local.type;$("#videoInteractions").empty(),$("#audioInteractions").empty(),$("#interactionLocalVideo")[0]&&($("#interactionLocalVideo")[0].src=""),t.video&&($("#livePlayer").show(),h.openSound()),window.isSpeakThirdParty||"function"!=typeof window.on_cc_live_interaction_disconnect||window.on_cc_live_interaction_disconnect(e,t)}window.isRequesting=!1}},window.on_cc_live_interaction_remote_media_self=function(e,t,i){if("function"==typeof window.on_cc_live_interaction_remote_media&&window.on_cc_live_interaction_remote_media(e,t,i),window.isRequesting=!1,e.video){$("#livePlayer").hide();var n="interactionRemoteVideo"+t.id;$("#"+n).length<1&&($("#videoInteractions").append(''),$("#"+n)[0].srcObject=i)}else{n="interactionRemoteAudio"+t.id;$("#"+n).length<1&&($("#audioInteractions").append(''),$("#"+n)[0].srcObject=i)}},window.on_cc_live_interaction_chatusers=function(e){e=F(e),$.each(e,function(e,t){return t.id==c.viewerid||("publisher"==t.role&&!t.isMainSpeaker||void _.interaction.createOfferPeerConnection(t))})},window.on_cc_live_interaction_message=function(e){e=F(e);x("Interaction","rtc互动信息:"+JSON.stringify(e));var t=e.toid,i=e.fromid,n=e.fromname,o=e.type,a=e.data;"string"==typeof a&&(a=JSON.parse(a));var r=e.event;if("offer"===r){if(a.type=r,_.interaction.createAnswerPeerConnection({id:i,name:n,type:o}),!(s=_.interaction.usersPcs[i].pc))return;s.setRemoteDescription(new nativeRTCSessionDescription(a)),s.createAnswer(function(){},function(e){x("Interaction","Failure callback: "+e)})}else if("answer"===r){if(!(s=_.interaction.usersPcs[i].pc))return;a.type=r,x("Interaction","answer spark_message信息:"+a),s.setRemoteDescription(new nativeRTCSessionDescription(a)),s.receivedAnswer=!0,!s.hasAddIce&&s.RTCICE&&s.addIceCandidate(s.RTCICE)}else{var s,c=_.interaction.usersPcs[i];if(c||(c=_.interaction.usersPcs[t]),!(s=c?c.pc:null))return;var u=new RTCIceCandidate(a);s.receivedAnswer?(s.hasAddIce=!0,s.addIceCandidate(u)):(s.hasAddIce=!1,s.RTCICE=u)}},window.isDebug=!1;var x=function(e,t){window.isDebug&&console&&"function"==typeof console.log&&console.log(e,t)};function F(e){if("string"==typeof e)try{return JSON.parse(e)}catch(e){return{}}return e}function q(){var e=h.delay;return(isNaN(e)||e<0)&&(e=0),e*=1e3,"isMobile"==A.isMobile()?0===e?5e3:1e4:0===e?1300:3e3}function N(){var e=h.delay;return(isNaN(e)||e<0)&&(e=0),"isMobile"==A.isMobile()?0===e?5e3:1e4:0===e?1300:3e3}window.DWLive=c,window.live=_,c.isSupportInteraction=window.live.interaction.isSupportInteraction,window.onunload=function(){window.live.interaction.hangupInteraction()},window.onbeforeunload=function(){window.live.interaction.hangupInteraction()},window._swfInit=function(){"function"==typeof window.on_cc_live_player_ready&&window.on_cc_live_player_ready()},window._swfOk=function(e){"function"==typeof window.on_cc_swf_loading_completed&&window.on_cc_swf_loading_completed(e),h.isReady=!0}}(window)}]);